SELECT
isc.table_name,
isc.ordinal_position::integer AS ordinal_position,
isc.column_name::character varying AS column_name,
isc.column_default::character varying AS column_default,
isc.data_type::character varying AS data_type,
isc.character_maximum_length::integer AS str_length,
CASE
WHEN isc.udt_name::text = 'int4'::text OR isc.udt_name::text =
'bool'::text THEN isc.data_type::character varying
ELSE isc.udt_name::character varying
END AS udt_name
FROM information_schema.columns isc
WHERE isc.table_schema::text = 'public'::text
ORDER BY isc.table_name, isc.ordinal_position;
"Patrick Hatcher" <PHatcher@macys.com> wrote in message
news:OF3278EBDC.8EACE142-ON882570AD.0080A52D-882570AD.0081F34C@FDS.com...
>
>
> I need to generate a data dictionary for all my tables (name, column,
> type, etc) in my database. Is there an easy to do this without having to
> do a \d tablename for each table?
> tia
> Patrick
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>