[SQL] Listing table definitions by only one command

2013-07-17 Thread Carla Goncalves
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.
  

Re: [SQL] Listing table definitions by only one command

2013-07-17 Thread Wes James
On Wed, Jul 17, 2013 at 9:29 AM, Carla Goncalves cgourof...@hotmail.comwrote:

 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.attnum0) AND
(NOT A.attisdropped) AND
(N.nspname ILIKE 'public')
ORDER BY
C.oid, A.attnum;

wes