I have DB \"test\" in PostgreSql. I want to write sql to get owner my database.
can just cast the role OID with magic ::regrole to give the role name of owner:
SELECT datdba::regrole FROM pg_database WHERE datname = 'test' ;