@@ -326,16 +326,18 @@ declare
326
326
postgres_role_settings text[] := (select setconfig from pg_db_role_setting where setdatabase = 0 and setrole = 'postgres'::regrole);
327
327
supabase_admin_role_settings text[] := (select setconfig from pg_db_role_setting where setdatabase = 0 and setrole = 'supabase_admin'::regrole);
328
328
schemas jsonb[] := (
329
- select coalesce(array_agg(jsonb_build_object('oid', oid, 'owner', nspowner::regrole, 'acl', nspacl::text)), '{}')
330
- from pg_namespace
329
+ select coalesce(array_agg(jsonb_build_object('oid', n.oid, 'owner', a.rolname, 'acl', nspacl::text)), '{}')
330
+ from pg_namespace n
331
+ join pg_authid a on a.oid = n.nspowner
331
332
where true
332
- and nspname != 'information_schema'
333
- and not starts_with(nspname, 'pg_')
333
+ and n. nspname != 'information_schema'
334
+ and not starts_with(n. nspname, 'pg_')
334
335
);
335
336
types jsonb[] := (
336
- select coalesce(array_agg(jsonb_build_object('oid', t.oid, 'acl', t.typacl::text)), '{}')
337
+ select coalesce(array_agg(jsonb_build_object('oid', t.oid, 'owner', a.rolname, ' acl', t.typacl::text)), '{}')
337
338
from pg_type t
338
339
join pg_namespace n on n.oid = t.typnamespace
340
+ join pg_authid a on a.oid = t.typowner
339
341
where true
340
342
and n.nspname != 'information_schema'
341
343
and not starts_with(n.nspname, 'pg_')
@@ -360,20 +362,24 @@ declare
360
362
)
361
363
);
362
364
functions jsonb[] := (
363
- select coalesce(array_agg(jsonb_build_object('oid', p.oid, 'acl', p.proacl::text)), '{}')
365
+ select coalesce(array_agg(jsonb_build_object('oid', p.oid, 'owner', a.rolname, ' acl', p.proacl::text)), '{}')
364
366
from pg_proc p
365
367
join pg_namespace n on n.oid = p.pronamespace
368
+ join pg_authid a on a.oid = p.proowner
366
369
where true
367
370
and n.nspname != 'information_schema'
368
371
and not starts_with(n.nspname, 'pg_')
372
+ and a.rolname = 'postgres'
369
373
);
370
374
relations jsonb[] := (
371
- select coalesce(array_agg(jsonb_build_object('oid', c.oid, 'acl', c.relacl::text)), '{}')
375
+ select coalesce(array_agg(jsonb_build_object('oid', c.oid, 'owner', a.rolname, ' acl', c.relacl::text)), '{}')
372
376
from pg_class c
373
377
join pg_namespace n on n.oid = c.relnamespace
378
+ join pg_authid a on a.oid = c.relowner
374
379
where true
375
380
and n.nspname != 'information_schema'
376
381
and not starts_with(n.nspname, 'pg_')
382
+ and a.rolname = 'postgres'
377
383
and c.relkind not in ('c', 'i')
378
384
);
379
385
rec record;
0 commit comments