Re: psql \dp equivalent or similar query?

From: "Davor J(dot)" <DavorJ(at)live(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: psql \dp equivalent or similar query?
Date: 2010-07-06 09:52:20
Message-ID: i0uuh1$hlq$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Great option!
Thanks Andreas

""A. Kretschmer"" <andreas(dot)kretschmer(at)schollglas(dot)com> wrote in message
news:20100706093242(dot)GD13709(at)a-kretschmer(dot)de(dot)(dot)(dot)
> 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(at)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2010-07-06 09:57:14 Re: PostgreSQL trigger execution order
Previous Message Davor J. 2010-07-06 09:47:44 Re: Extending postgres objects with attributes