diff options
author | Noah Misch <noah@leadboat.com> | 2017-02-12 16:03:41 -0500 |
---|---|---|
committer | Noah Misch <noah@leadboat.com> | 2017-02-12 16:04:09 -0500 |
commit | 804aad8ff46cbef9f520507bb8b4522a011cd1b2 (patch) | |
tree | 2d4401677356a390a59a5cae3a380df73bee3f5d /src/backend/commands/indexcmds.c | |
parent | 86ef376bbe1b9568fa71e76ecfd3091d522368bb (diff) | |
download | postgresql-804aad8ff46cbef9f520507bb8b4522a011cd1b2.tar.gz postgresql-804aad8ff46cbef9f520507bb8b4522a011cd1b2.zip |
Ignore tablespace ACLs when ignoring schema ACLs.
The ALTER TABLE ALTER TYPE implementation can issue DROP INDEX and
CREATE INDEX to refit existing indexes for the new column type. Since
this CREATE INDEX is an implementation detail of an index alteration,
the ensuing DefineIndex() should skip ACL checks specific to index
creation. It already skips the namespace ACL check. Make it skip the
tablespace ACL check, too. Back-patch to 9.2 (all supported versions).
Reviewed by Tom Lane.
Diffstat (limited to 'src/backend/commands/indexcmds.c')
-rw-r--r-- | src/backend/commands/indexcmds.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index a90cfc55ced..f46bdbbb58f 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -285,8 +285,8 @@ CheckIndexCompatible(Oid oldId, * 'indexRelationId': normally InvalidOid, but during bootstrap can be * nonzero to specify a preselected OID for the index. * 'is_alter_table': this is due to an ALTER rather than a CREATE operation. - * 'check_rights': check for CREATE rights in the namespace. (This should - * be true except when ALTER is deleting/recreating an index.) + * 'check_rights': check for CREATE rights in namespace and tablespace. (This + * should be true except when ALTER is deleting/recreating an index.) * 'skip_build': make the catalog entries but leave the index file empty; * it will be filled later. * 'quiet': suppress the NOTICE chatter ordinarily provided for constraints. @@ -420,8 +420,9 @@ DefineIndex(Oid relationId, /* note InvalidOid is OK in this case */ } - /* Check permissions except when using database's default */ - if (OidIsValid(tablespaceId) && tablespaceId != MyDatabaseTableSpace) + /* Check tablespace permissions */ + if (check_rights && + OidIsValid(tablespaceId) && tablespaceId != MyDatabaseTableSpace) { AclResult aclresult; |