summaryrefslogtreecommitdiff
path: root/src/backend/commands/tablecmds.c
diff options
context:
space:
mode:
authorShigeru Hanada2011-07-04 00:50:47 +0000
committerShigeru Hanada2011-07-04 00:50:47 +0000
commit99c74ddec4ba4dfcdf477c947a16924595e6d977 (patch)
treebb798e53d24fdc794fb0e625ad456b4f16032f57 /src/backend/commands/tablecmds.c
parentc01a5997ba93d319a9aed4f164305efcd9e5d0b6 (diff)
parent99e47ed0b2d2c559da813e679260e218f2c1d2ee (diff)
Merge branch 'master' into check_alwayscheck_always
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r--src/backend/commands/tablecmds.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index cfc685b949..a3a99d2880 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).
*/