Get DB owner's name in PostgreSql

You can find such things in the system catalog

SELECT d.datname as "Name",
pg_catalog.pg_get_userbyid(d.datdba) as "Owner"
FROM pg_catalog.pg_database d
WHERE d.datname = 'database_name'
ORDER BY 1;

If you use the psql command-line tool, you can simply use \l


You can use the combination of pg_database, pg_users system tables and current_database() function in this way:

 SELECT u.usename 
 FROM pg_database d
  JOIN pg_user u ON (d.datdba = u.usesysid)
 WHERE d.datname = (SELECT current_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' ;