Skip to content

Commit cd320f0

Browse files
authored
fix superuser permission check for func create (#367)
* fix superuser permission check for func create Signed-off-by: Alex Chi Z <chi@neon.tech> * only allow native function when creating trusted extensions Signed-off-by: Alex Chi Z <chi@neon.tech> --------- Signed-off-by: Alex Chi Z <chi@neon.tech>
1 parent f80e1ee commit cd320f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/commands/functioncmds.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt)
11251125
else
11261126
{
11271127
/* if untrusted language, must be superuser */
1128-
if (!superuser())
1128+
if (!(superuser() || (is_neon_superuser() && creating_extension)))
11291129
aclcheck_error(ACLCHECK_NO_PRIV, OBJECT_LANGUAGE,
11301130
NameStr(languageStruct->lanname));
11311131
}
@@ -2129,7 +2129,7 @@ ExecuteDoStmt(ParseState *pstate, DoStmt *stmt, bool atomic)
21292129
else
21302130
{
21312131
/* if untrusted language, must be superuser */
2132-
if (!superuser())
2132+
if (!(superuser() || (is_neon_superuser() && creating_extension)))
21332133
aclcheck_error(ACLCHECK_NO_PRIV, OBJECT_LANGUAGE,
21342134
NameStr(languageStruct->lanname));
21352135
}

0 commit comments

Comments
 (0)