Get DB owner's name in PostgreSql

后端 未结 7 2149
忘了有多久
忘了有多久 2020-12-15 02:07

I have DB \"test\" in PostgreSql. I want to write sql to get owner my database.

7条回答
  •  無奈伤痛
    2020-12-15 02:48

    The follwing query displays info for all tables in the public schema:

     select t.table_name, t.table_type, c.relname, c.relowner, u.usename
     from information_schema.tables t
     join pg_catalog.pg_class c on (t.table_name = c.relname)
     join pg_catalog.pg_user u on (c.relowner = u.usesysid)
     where t.table_schema='public';
    

    source :http://cully.biz/2013/12/11/postgresql-getting-the-owner-of-tables/

提交回复
热议问题