aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/analyze.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-01-03 23:21:32 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-01-03 23:21:32 +0000
commitdc6b4deb9717a9f03b2f93baca9f93f13786e26b (patch)
tree586c04579f3337cc8fdbbc342eefbb0bdf21e607 /src/backend/parser/analyze.c
parentd02f0aaa3b7313cabd9e64deb34ab630832730ce (diff)
downloadpostgresql-dc6b4deb9717a9f03b2f93baca9f93f13786e26b.tar.gz
postgresql-dc6b4deb9717a9f03b2f93baca9f93f13786e26b.zip
Require ownership permission for CREATE INDEX, per bug report.
Disallow CREATE INDEX on system catalogs, non-tables (views, sequences, etc). Disallow CREATE/DROP TRIGGER on system catalogs, non-tables. Disallow ALTER TABLE ADD/DROP CONSTRAINT on system catalogs. Disallow FOREIGN KEY reference to non-table. None of these things can actually work in the present system structure, but the code was letting them pass without complaint.
Diffstat (limited to 'src/backend/parser/analyze.c')
-rw-r--r--src/backend/parser/analyze.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index 87df6f55e79..413513cfa6c 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.212 2001/11/12 21:04:45 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.213 2002/01/03 23:21:31 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2792,6 +2792,10 @@ transformFkeyCheckAttrs(FkConstraint *fkconstraint, Oid *pktypoid)
*/
pkrel = heap_openr(fkconstraint->pktable_name, AccessShareLock);
+ if (pkrel->rd_rel->relkind != RELKIND_RELATION)
+ elog(ERROR, "Referenced relation \"%s\" is not a table",
+ fkconstraint->pktable_name);
+
/*
* Get the list of index OIDs for the table from the relcache, and
* look up each one in the pg_index syscache for each unique one, and
@@ -2881,6 +2885,10 @@ transformFkeyGetPrimaryKey(FkConstraint *fkconstraint, Oid *pktypoid)
*/
pkrel = heap_openr(fkconstraint->pktable_name, AccessShareLock);
+ if (pkrel->rd_rel->relkind != RELKIND_RELATION)
+ elog(ERROR, "Referenced relation \"%s\" is not a table",
+ fkconstraint->pktable_name);
+
/*
* Get the list of index OIDs for the table from the relcache, and
* look up each one in the pg_index syscache until we find one marked