@@ -554,7 +554,7 @@ CREATE VIEW column_privileges AS
554
554
pr_c .prtype ,
555
555
pr_c .grantable ,
556
556
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)) )).*
558
558
FROM pg_class
559
559
WHERE relkind IN (' r' , ' v' , ' f' )
560
560
) pr_c (oid , relname, relnamespace, relowner, grantor, grantee, prtype, grantable),
@@ -571,8 +571,8 @@ CREATE VIEW column_privileges AS
571
571
pr_a .prtype ,
572
572
pr_a .grantable ,
573
573
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 )
576
576
WHERE attnum > 0
577
577
AND NOT attisdropped
578
578
) pr_a (attrelid, attname, grantor, grantee, prtype, grantable),
@@ -1276,7 +1276,7 @@ CREATE VIEW routine_privileges AS
1276
1276
THEN ' YES' ELSE ' NO' END AS yes_or_no) AS is_grantable
1277
1277
1278
1278
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
1280
1280
) p (oid , proname, proowner, pronamespace, grantor, grantee, prtype, grantable),
1281
1281
pg_namespace n,
1282
1282
pg_authid u_grantor,
@@ -1797,7 +1797,7 @@ CREATE VIEW table_privileges AS
1797
1797
CAST(CASE WHEN c .prtype = ' SELECT' THEN ' YES' ELSE ' NO' END AS yes_or_no) AS with_hierarchy
1798
1798
1799
1799
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
1801
1801
) AS c (oid , relname, relnamespace, relkind, relowner, grantor, grantee, prtype, grantable),
1802
1802
pg_namespace nc,
1803
1803
pg_authid u_grantor,
@@ -2043,7 +2043,7 @@ CREATE VIEW udt_privileges AS
2043
2043
THEN ' YES' ELSE ' NO' END AS yes_or_no) AS is_grantable
2044
2044
2045
2045
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
2047
2047
) AS t (oid , typname, typnamespace, typtype, typowner, grantor, grantee, prtype, grantable),
2048
2048
pg_namespace n,
2049
2049
pg_authid u_grantor,
@@ -2129,7 +2129,7 @@ CREATE VIEW usage_privileges AS
2129
2129
THEN ' YES' ELSE ' NO' END AS yes_or_no) AS is_grantable
2130
2130
2131
2131
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
2133
2133
) AS t (oid , typname, typnamespace, typtype, typowner, grantor, grantee, prtype, grantable),
2134
2134
pg_namespace n,
2135
2135
pg_authid u_grantor,
@@ -2166,7 +2166,7 @@ CREATE VIEW usage_privileges AS
2166
2166
THEN ' YES' ELSE ' NO' END AS yes_or_no) AS is_grantable
2167
2167
2168
2168
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
2170
2170
) AS fdw (fdwname, fdwowner, grantor, grantee, prtype, grantable),
2171
2171
pg_authid u_grantor,
2172
2172
(
@@ -2200,7 +2200,7 @@ CREATE VIEW usage_privileges AS
2200
2200
THEN ' YES' ELSE ' NO' END AS yes_or_no) AS is_grantable
2201
2201
2202
2202
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
2204
2204
) AS srv (srvname, srvowner, grantor, grantee, prtype, grantable),
2205
2205
pg_authid u_grantor,
2206
2206
(
0 commit comments