Fix diffs in error messages in create_index, privileges vanilla tests

pull/7766/head
Colm McHugh 2024-11-25 10:35:00 +00:00
parent 063be46444
commit 693e7aa85d
1 changed files with 13 additions and 1 deletions

View File

@ -1109,6 +1109,7 @@ RangeVarCallbackForReindexIndex(const RangeVar *relation, Oid relId, Oid oldRelI
char relkind; char relkind;
struct ReindexIndexCallbackState *state = arg; struct ReindexIndexCallbackState *state = arg;
LOCKMODE table_lockmode; LOCKMODE table_lockmode;
Oid table_oid;
/* /*
* Lock level here should match table lock in reindex_index() for * Lock level here should match table lock in reindex_index() for
@ -1146,13 +1147,24 @@ RangeVarCallbackForReindexIndex(const RangeVar *relation, Oid relId, Oid oldRelI
errmsg("\"%s\" is not an index", relation->relname))); errmsg("\"%s\" is not an index", relation->relname)));
/* Check permissions */ /* Check permissions */
#if PG_VERSION_NUM >= PG_VERSION_17
table_oid = IndexGetRelation(relId, true);
if (OidIsValid(table_oid))
{
AclResult aclresult = pg_class_aclcheck(table_oid, GetUserId(), ACL_MAINTAIN);
if (aclresult != ACLCHECK_OK)
aclcheck_error(aclresult, OBJECT_INDEX, relation->relname);
}
#else
if (!object_ownercheck(RelationRelationId, relId, GetUserId())) if (!object_ownercheck(RelationRelationId, relId, GetUserId()))
aclcheck_error(ACLCHECK_NOT_OWNER, OBJECT_INDEX, relation->relname); aclcheck_error(ACLCHECK_NOT_OWNER, OBJECT_INDEX, relation->relname);
#endif
/* Lock heap before index to avoid deadlock. */ /* Lock heap before index to avoid deadlock. */
if (relId != oldRelId) if (relId != oldRelId)
{ {
Oid table_oid = IndexGetRelation(relId, true); table_oid = IndexGetRelation(relId, true);
/* /*
* If the OID isn't valid, it means the index was concurrently * If the OID isn't valid, it means the index was concurrently