Skip to content

Commit 835d854

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 71ea0d6 commit 835d854

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

39053905
return NULL;
39063906
}
3907+
3908+
Datum
3909+
pg_creating_extension(PG_FUNCTION_ARGS)
3910+
{
3911+
if (creating_extension)
3912+
{
3913+
PG_RETURN_OID(CurrentExtensionObject);
3914+
}
3915+
PG_RETURN_NULL();
3916+
}

src/include/catalog/pg_proc.dat

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10745,6 +10745,11 @@
1074510745
proname => 'pg_extension_config_dump', provolatile => 'v', proparallel => 'u',
1074610746
prorettype => 'void', proargtypes => 'regclass text',
1074710747
prosrc => 'pg_extension_config_dump' },
10748+
{ oid => '3814',
10749+
descr => 'determine if an extension is currently being created',
10750+
proname => 'pg_creating_extension', provolatile => 'v', proparallel => 'u',
10751+
prorettype => 'oid', proargtypes => '',
10752+
prosrc => 'pg_creating_extension' },
1074810753

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

0 commit comments

Comments
 (0)