Skip to content

Commit e62c38d

Browse files
committed
Disallow creation of a child table by a user who does not own the parent
table, per pghackers discussion around 22-Dec-00.
1 parent 2177572 commit e62c38d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/backend/commands/creatinh.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.69 2000/12/22 23:12:05 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.70 2001/01/05 02:58:16 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -25,6 +25,7 @@
2525
#include "commands/creatinh.h"
2626
#include "miscadmin.h"
2727
#include "optimizer/clauses.h"
28+
#include "utils/acl.h"
2829
#include "utils/syscache.h"
2930
#include "utils/temprel.h"
3031

@@ -384,6 +385,12 @@ MergeAttributes(List *schema, List *supers, bool istemp,
384385
if (!istemp && is_temp_rel_name(name))
385386
elog(ERROR, "CREATE TABLE: cannot inherit from temp relation \"%s\"", name);
386387

388+
/* We should have an UNDER permission flag for this, but for now,
389+
* demand that creator of a child table own the parent.
390+
*/
391+
if (!pg_ownercheck(GetUserId(), name, RELNAME))
392+
elog(ERROR, "you do not own table \"%s\"", name);
393+
387394
parentOids = lappendi(parentOids, relation->rd_id);
388395
setRelhassubclassInRelation(relation->rd_id, true);
389396
tupleDesc = RelationGetDescr(relation);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy