Re: Listing table definitions by only one command

From: Wes James <comptekki(at)gmail(dot)com>
To: Carla Goncalves <cgourofino(at)hotmail(dot)com>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Listing table definitions by only one command
Date: 2013-07-17 16:07:29
Message-ID: CAFjCMHv0Kvi_nj2ezDGotD1=knTwQjXY2i_P9FRvUWskdYmrYA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, Jul 17, 2013 at 9:29 AM, Carla Goncalves <cgourofino(at)hotmail(dot)com>wrote:

> Hi
> I would like to list the definition of all user tables by only one
> command. Is there a way to *not* show pg_catalog tables when using "\d ."
> in PostgreSQL 9.1.9?
>
> Thanks.
>

I didn't see a way to do that with \ commands, but found this with a google
search:

SELECT
N.nspname,
C.relname,
A.attname,
pg_catalog.format_type(a.atttypid, a.atttypmod) AS typeName
FROM
pg_class C,
pg_namespace N,
pg_attribute A,
pg_type T
WHERE
(C.relkind='r') AND
(N.oid=C.relnamespace) AND
(A.attrelid=C.oid) AND
(A.atttypid=T.oid) AND
(A.attnum>0) AND
(NOT A.attisdropped) AND
(N.nspname ILIKE 'public')
ORDER BY
C.oid, A.attnum;

wes

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Giuseppe Broccolo 2013-07-18 16:39:47 Re: Listing table definitions by only one command
Previous Message Carla Goncalves 2013-07-17 15:29:47 Listing table definitions by only one command