aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/execMain.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/executor/execMain.c')
-rw-r--r--src/backend/executor/execMain.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 643714a948c..923ac2c7d05 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -26,7 +26,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.256.2.7 2008/08/08 17:01:34 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.256.2.8 2009/12/09 21:58:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -764,6 +764,17 @@ InitPlan(QueryDesc *queryDesc, bool explainOnly)
TupleDesc tupdesc;
/*
+ * 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.
+ */
+ if (parseTree->into->istemp && InSecurityRestrictedOperation())
+ ereport(ERROR,
+ (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+ errmsg("cannot create temporary table within security-restricted operation")));
+
+ /*
* find namespace to create in, check permissions
*/
intoName = parseTree->into->relname;