select current_user, session_user, current_database();
select rolname, rolsuper, rolcreatedb, rolcreaterole, rolcanlogin from pg_roles where rolname in (sub2api,coolify,postgres) order by rolname;
select n.nspname as schema, r.rolname as owner, count(*) as objects
from pg_class c join pg_namespace n on n.oid=c.relnamespace join pg_roles r on r.oid=c.relowner
where n.nspname=public and c.relkind in (r,p,v,m,S,f)
group by 1,2 order by 1,2;
select n.nspname, c.relkind, c.relname, r.rolname as owner
from pg_class c join pg_namespace n on n.oid=c.relnamespace join pg_roles r on r.oid=c.relowner
where n.nspname=public and c.relkind in (r,p,v,m,S,f)
order by r.rolname, c.relkind, c.relname limit 220;
select table_name from information_schema.tables where table_schema=public order by table_name;
select case when exists (select 1 from information_schema.tables where table_schema=public and table_name=schema_migrations) then schema_migrations_exists else schema_migrations_missing end;
