aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-01-05 02:58:16 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-01-05 02:58:16 +0000
commite62c38d0fccd16593ab2b126e97ea890ac646943 (patch)
tree4e471de19e3bbae40a026405eec4653fd1850a96 /src
parent21775721bc4aa2b54de35dfa64baa82b4d8d201b (diff)
downloadpostgresql-e62c38d0fccd16593ab2b126e97ea890ac646943.tar.gz
postgresql-e62c38d0fccd16593ab2b126e97ea890ac646943.zip
Disallow creation of a child table by a user who does not own the parent
table, per pghackers discussion around 22-Dec-00.
Diffstat (limited to 'src')
-rw-r--r--src/backend/commands/creatinh.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/backend/commands/creatinh.c b/src/backend/commands/creatinh.c
index 38e2c3a418e..22a34d2e5a3 100644
--- a/src/backend/commands/creatinh.c
+++ b/src/backend/commands/creatinh.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.69 2000/12/22 23:12:05 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.70 2001/01/05 02:58:16 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,6 +25,7 @@
#include "commands/creatinh.h"
#include "miscadmin.h"
#include "optimizer/clauses.h"
+#include "utils/acl.h"
#include "utils/syscache.h"
#include "utils/temprel.h"
@@ -384,6 +385,12 @@ MergeAttributes(List *schema, List *supers, bool istemp,
if (!istemp && is_temp_rel_name(name))
elog(ERROR, "CREATE TABLE: cannot inherit from temp relation \"%s\"", name);
+ /* We should have an UNDER permission flag for this, but for now,
+ * demand that creator of a child table own the parent.
+ */
+ if (!pg_ownercheck(GetUserId(), name, RELNAME))
+ elog(ERROR, "you do not own table \"%s\"", name);
+
parentOids = lappendi(parentOids, relation->rd_id);
setRelhassubclassInRelation(relation->rd_id, true);
tupleDesc = RelationGetDescr(relation);