Skip to content

Commit b46c921

Browse files
committed
Fix assorted bugs in privileges-for-types patch.
Commit 7292055 added privileges on data types, but there were a number of oversights. The implementation of default privileges for types missed a few places, and pg_dump was utterly innocent of the whole concept. Per bug #7741 from Nathan Alden, and subsequent wider investigation.
1 parent a99c42f commit b46c921

File tree

7 files changed

+110
-29
lines changed

7 files changed

+110
-29
lines changed

doc/src/sgml/catalogs.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2674,7 +2674,8 @@
26742674
Type of object this entry is for:
26752675
<literal>r</> = relation (table, view),
26762676
<literal>S</> = sequence,
2677-
<literal>f</> = function
2677+
<literal>f</> = function,
2678+
<literal>T</> = type
26782679
</entry>
26792680
</row>
26802681

src/backend/catalog/aclchk.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,10 +1346,13 @@ RemoveRoleFromObjectACL(Oid roleid, Oid classid, Oid objid)
13461346
case DEFACLOBJ_FUNCTION:
13471347
iacls.objtype = ACL_OBJECT_FUNCTION;
13481348
break;
1349+
case DEFACLOBJ_TYPE:
1350+
iacls.objtype = ACL_OBJECT_TYPE;
1351+
break;
13491352
default:
13501353
/* Shouldn't get here */
1351-
elog(ERROR, "unexpected default ACL type %d",
1352-
pg_default_acl_tuple->defaclobjtype);
1354+
elog(ERROR, "unexpected default ACL type: %d",
1355+
(int) pg_default_acl_tuple->defaclobjtype);
13531356
break;
13541357
}
13551358

src/backend/catalog/dependency.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2899,6 +2899,11 @@ getObjectDescription(const ObjectAddress *object)
28992899
_("default privileges on new functions belonging to role %s"),
29002900
GetUserNameFromId(defacl->defaclrole));
29012901
break;
2902+
case DEFACLOBJ_TYPE:
2903+
appendStringInfo(&buffer,
2904+
_("default privileges on new types belonging to role %s"),
2905+
GetUserNameFromId(defacl->defaclrole));
2906+
break;
29022907
default:
29032908
/* shouldn't get here */
29042909
appendStringInfo(&buffer,

src/bin/pg_dump/dumputils.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,9 @@ do { \
890890
}
891891
else if (strcmp(type, "TABLESPACE") == 0)
892892
CONVERT_PRIV('C', "CREATE");
893+
else if (strcmp(type, "TYPE") == 0 ||
894+
strcmp(type, "TYPES") == 0)
895+
CONVERT_PRIV('U', "USAGE");
893896
else if (strcmp(type, "FOREIGN DATA WRAPPER") == 0)
894897
CONVERT_PRIV('U', "USAGE");
895898
else if (strcmp(type, "FOREIGN SERVER") == 0)

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