@@ -554,7 +554,7 @@ CREATE VIEW column_privileges AS
554554 pr_c .prtype ,
555555 pr_c .grantable ,
556556 pr_c .relowner
557- FROM (SELECT oid , relname, relnamespace, relowner, (aclexplode(relacl)).*
557+ FROM (SELECT oid , relname, relnamespace, relowner, (aclexplode(coalesce( relacl, acldefault( ' r ' , relowner)) )).*
558558 FROM pg_class
559559 WHERE relkind IN (' r' , ' v' , ' f' )
560560 ) pr_c (oid , relname, relnamespace, relowner, grantor, grantee, prtype, grantable),
@@ -571,8 +571,8 @@ CREATE VIEW column_privileges AS
571571 pr_a .prtype ,
572572 pr_a .grantable ,
573573 c .relowner
574- FROM (SELECT attrelid, attname, (aclexplode(attacl)).*
575- FROM pg_attribute
574+ FROM (SELECT attrelid, attname, (aclexplode(coalesce( attacl, acldefault( ' c ' , relowner)) )).*
575+ FROM pg_attribute a JOIN pg_class cc ON ( a . attrelid = cc . oid )
576576 WHERE attnum > 0
577577 AND NOT attisdropped
578578 ) pr_a (attrelid, attname, grantor, grantee, prtype, grantable),
@@ -1276,7 +1276,7 @@ CREATE VIEW routine_privileges AS
12761276 THEN ' YES' ELSE ' NO' END AS yes_or_no) AS is_grantable
12771277
12781278 FROM (
1279- SELECT oid , proname, proowner, pronamespace, (aclexplode(proacl)).* FROM pg_proc
1279+ SELECT oid , proname, proowner, pronamespace, (aclexplode(coalesce( proacl, acldefault( ' f ' , proowner)) )).* FROM pg_proc
12801280 ) p (oid , proname, proowner, pronamespace, grantor, grantee, prtype, grantable),
12811281 pg_namespace n,
12821282 pg_authid u_grantor,
@@ -1797,7 +1797,7 @@ CREATE VIEW table_privileges AS
17971797 CAST(CASE WHEN c .prtype = ' SELECT' THEN ' YES' ELSE ' NO' END AS yes_or_no) AS with_hierarchy
17981798
17991799 FROM (
1800- SELECT oid , relname, relnamespace, relkind, relowner, (aclexplode(relacl)).* FROM pg_class
1800+ SELECT oid , relname, relnamespace, relkind, relowner, (aclexplode(coalesce( relacl, acldefault( ' r ' , relowner)) )).* FROM pg_class
18011801 ) AS c (oid , relname, relnamespace, relkind, relowner, grantor, grantee, prtype, grantable),
18021802 pg_namespace nc,
18031803 pg_authid u_grantor,
@@ -2043,7 +2043,7 @@ CREATE VIEW udt_privileges AS
20432043 THEN ' YES' ELSE ' NO' END AS yes_or_no) AS is_grantable
20442044
20452045 FROM (
2046- SELECT oid , typname, typnamespace, typtype, typowner, (aclexplode(typacl)).* FROM pg_type
2046+ SELECT oid , typname, typnamespace, typtype, typowner, (aclexplode(coalesce( typacl, acldefault( ' T ' , typowner)) )).* FROM pg_type
20472047 ) AS t (oid , typname, typnamespace, typtype, typowner, grantor, grantee, prtype, grantable),
20482048 pg_namespace n,
20492049 pg_authid u_grantor,
@@ -2129,7 +2129,7 @@ CREATE VIEW usage_privileges AS
21292129 THEN ' YES' ELSE ' NO' END AS yes_or_no) AS is_grantable
21302130
21312131 FROM (
2132- SELECT oid , typname, typnamespace, typtype, typowner, (aclexplode(typacl)).* FROM pg_type
2132+ SELECT oid , typname, typnamespace, typtype, typowner, (aclexplode(coalesce( typacl, acldefault( ' T ' , typowner)) )).* FROM pg_type
21332133 ) AS t (oid , typname, typnamespace, typtype, typowner, grantor, grantee, prtype, grantable),
21342134 pg_namespace n,
21352135 pg_authid u_grantor,
@@ -2166,7 +2166,7 @@ CREATE VIEW usage_privileges AS
21662166 THEN ' YES' ELSE ' NO' END AS yes_or_no) AS is_grantable
21672167
21682168 FROM (
2169- SELECT fdwname, fdwowner, (aclexplode(fdwacl)).* FROM pg_foreign_data_wrapper
2169+ SELECT fdwname, fdwowner, (aclexplode(coalesce( fdwacl, acldefault( ' F ' , fdwowner)) )).* FROM pg_foreign_data_wrapper
21702170 ) AS fdw (fdwname, fdwowner, grantor, grantee, prtype, grantable),
21712171 pg_authid u_grantor,
21722172 (
@@ -2200,7 +2200,7 @@ CREATE VIEW usage_privileges AS
22002200 THEN ' YES' ELSE ' NO' END AS yes_or_no) AS is_grantable
22012201
22022202 FROM (
2203- SELECT srvname, srvowner, (aclexplode(srvacl)).* FROM pg_foreign_server
2203+ SELECT srvname, srvowner, (aclexplode(coalesce( srvacl, acldefault( ' S ' , srvowner)) )).* FROM pg_foreign_server
22042204 ) AS srv (srvname, srvowner, grantor, grantee, prtype, grantable),
22052205 pg_authid u_grantor,
22062206 (
0 commit comments