Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit cee31da

Browse files
yrashkCommitfest Bot
authored and
Commitfest Bot
committed
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 f3622b6 commit cee31da

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
@@ -3906,3 +3906,13 @@ find_in_paths(const char *basename, List *paths)
39063906

39073907
return NULL;
39083908
}
3909+
3910+
Datum
3911+
pg_creating_extension(PG_FUNCTION_ARGS)
3912+
{
3913+
if (creating_extension)
3914+
{
3915+
PG_RETURN_OID(CurrentExtensionObject);
3916+
}
3917+
PG_RETURN_NULL();
3918+
}

src/include/catalog/pg_proc.dat

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10727,6 +10727,11 @@
1072710727
proname => 'pg_extension_config_dump', provolatile => 'v', proparallel => 'u',
1072810728
prorettype => 'void', proargtypes => 'regclass text',
1072910729
prosrc => 'pg_extension_config_dump' },
10730+
{ oid => '3814',
10731+
descr => 'determine if an extension is currently being created',
10732+
proname => 'pg_creating_extension', provolatile => 'v', proparallel => 'u',
10733+
prorettype => 'oid', proargtypes => '',
10734+
prosrc => 'pg_creating_extension' },
1073010735

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

0 commit comments

Comments
 (0)