pgsql-renameatt-check-relkind.patch

application/octect-stream

Filename: pgsql-renameatt-check-relkind.patch
Type: application/octect-stream
Part: 0
Message: Re: renameatt() can rename attribute of index, sequence, ...

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
src/backend/commands/tablecmds.c 3 10
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index a123a46..1006478 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -1956,19 +1956,12 @@ renameatt(Oid myrelid,
 				 errmsg("cannot rename column of typed table")));
 
 	/*
-	 * permissions checking.  this would normally be done in utility.c, but
-	 * this particular routine is recursive.
+	 * permissions and sanity checking.  this would normally be done in utility.c,
+	 * but this particular routine is recursive.
 	 *
 	 * normally, only the owner of a class can change its schema.
 	 */
-	if (!pg_class_ownercheck(myrelid, GetUserId()))
-		aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_CLASS,
-					   RelationGetRelationName(targetrelation));
-	if (!allowSystemTableMods && IsSystemRelation(targetrelation))
-		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("permission denied: \"%s\" is a system catalog",
-						RelationGetRelationName(targetrelation))));
+	ATSimplePermissions(targetrelation, true);
 
 	/*
 	 * if the 'recurse' flag is set then we are supposed to rename this