Skip to content

Commit 5cdee20

Browse files
yrashkCommitfest Bot
authored andcommitted
pg_creating_extension() to inspect if an extension is being created.
This allows for much better control of what data is subject to `pg_extension_config_dump` as such data provenance can be established using this function.
1 parent 5092aae commit 5cdee20

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/backend/commands/extension.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3928,3 +3928,13 @@ find_in_paths(const char *basename, List *paths)
39283928

39293929
return NULL;
39303930
}
3931+
3932+
Datum
3933+
pg_creating_extension(PG_FUNCTION_ARGS)
3934+
{
3935+
if (creating_extension)
3936+
{
3937+
PG_RETURN_OID(CurrentExtensionObject);
3938+
}
3939+
PG_RETURN_NULL();
3940+
}

src/include/catalog/pg_proc.dat

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10757,6 +10757,11 @@
1075710757
proname => 'pg_extension_config_dump', provolatile => 'v', proparallel => 'u',
1075810758
prorettype => 'void', proargtypes => 'regclass text',
1075910759
prosrc => 'pg_extension_config_dump' },
10760+
{ oid => '3814',
10761+
descr => 'determine if an extension is currently being created',
10762+
proname => 'pg_creating_extension', provolatile => 'v', proparallel => 'u',
10763+
prorettype => 'oid', proargtypes => '',
10764+
prosrc => 'pg_creating_extension' },
1076010765

1076110766
# SQL-spec window functions
1076210767
{ oid => '3100', descr => 'row number within partition',

0 commit comments

Comments
 (0)