Search Postgresql Archives

Re: psql \dp equivalent or similar query?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Great option!
Thanks Andreas

""A. Kretschmer"" <andreas.kretschmer@xxxxxxxxxxxxxx> wrote in message 
news:20100706093242.GD13709@xxxxxxxxxxxxxxxxxx
> In response to Davor J. :
>> I couldn't find it on the net. I also coudn't find any reference to it in
>> the psql source?
>>
>> Anyone any suggestions?
>
> Start your psql with option -E to display the query behind:
>
> kretschmer@tux:~$ psql -E test
> psql (8.4.2)
> Type "help" for help.
>
> test=# \dp foo
> ********* QUERY **********
> SELECT n.nspname as "Schema",
>  c.relname as "Name",
>  CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'S' THEN 
> 'sequence' END as "Type",
>  pg_catalog.array_to_string(c.relacl, E'\n') AS "Access privileges",
>  pg_catalog.array_to_string(ARRAY(
>    SELECT attname || E':\n  ' || pg_catalog.array_to_string(attacl, E'\n 
> ')
>    FROM pg_catalog.pg_attribute a
>    WHERE attrelid = c.oid AND NOT attisdropped AND attacl IS NOT NULL
>  ), E'\n') AS "Column access privileges"
> FROM pg_catalog.pg_class c
>     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
> WHERE c.relkind IN ('r', 'v', 'S')
>  AND c.relname ~ '^(foo)$'
>  AND n.nspname !~ '^pg_' AND pg_catalog.pg_table_is_visible(c.oid)
> ORDER BY 1, 2;
> **************************
>
>                            Access privileges
> Schema | Name |   Type   | Access privileges | Column access privileges
> --------+------+----------+-------------------+--------------------------
> public | foo  | sequence |                   |
> (1 row)
>
> test=#
>
>
> Regards, Andreas
> -- 
> Andreas Kretschmer
> Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
> GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431  2EB0 389D 1DC2 3172 0C99
>
> -- 
> Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
> 



-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux