diff options
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r-- | src/backend/commands/tablecmds.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index cfc685b9499..a3a99d28806 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -432,6 +432,13 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId) errmsg("constraints on foreign tables are not supported"))); /* + * Look up the namespace in which we are supposed to create the relation, + * and check we have permission to create there. + */ + namespaceId = RangeVarGetAndCheckCreationNamespace(stmt->relation); + RangeVarAdjustRelationPersistence(stmt->relation, namespaceId); + + /* * Security check: disallow creating temp tables from security-restricted * code. This is needed because calling code might not expect untrusted * tables to appear in pg_temp at the front of its search path. @@ -443,12 +450,6 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId) errmsg("cannot create temporary table within security-restricted operation"))); /* - * Look up the namespace in which we are supposed to create the relation, - * and check we have permission to create there. - */ - namespaceId = RangeVarGetAndCheckCreationNamespace(stmt->relation); - - /* * Select tablespace to use. If not specified, use default tablespace * (which may in turn default to database's default). */ |