Data Dictionary generator?

Started by Patrick Hatcherover 20 years ago5 messagesgeneral
Jump to latest
#1Patrick Hatcher
PHatcher@macys.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

#2Dann Corbit
DCorbit@connx.com
In reply to: Patrick Hatcher (#1)
Re: Data Dictionary generator?

PostgreSQL has Information Schema

-----Original Message-----
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-
owner@postgresql.org] On Behalf Of Patrick Hatcher
Sent: Wednesday, November 02, 2005 3:39 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] Data Dictionary generator?

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)---------------------------

Show quoted text

TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

#3Patrick Hatcher
PHatcher@macys.com
In reply to: Dann Corbit (#2)
Re: Data Dictionary generator?

Thank you.
"select * From information_schema.columns where table_schema = 'public' and
table_name = 'mdc_products'
order by ordinal_position;"

Thanks again.

Patrick Hatcher

"Dann Corbit"
<DCorbit@connx.co
m> To
"Patrick Hatcher"
11/02/2005 03:45 <PHatcher@macys.com>,
PM <pgsql-general@postgresql.org>
cc

Subject
RE: [GENERAL] Data Dictionary
generator?

PostgreSQL has Information Schema

-----Original Message-----
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-
owner@postgresql.org] On Behalf Of Patrick Hatcher
Sent: Wednesday, November 02, 2005 3:39 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] Data Dictionary generator?

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)---------------------------

Show quoted text

TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

#4David Fetter
david@fetter.org
In reply to: Patrick Hatcher (#1)
Re: Data Dictionary generator?

On Wed, Nov 02, 2005 at 03:39:24PM -0800, Patrick Hatcher wrote:

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?

You could use pg_dump -s to get the schema, or in psql \d by itself
gets you everything :)

Cheers,
D
--
David Fetter david@fetter.org http://fetter.org/
phone: +1 510 893 6100 mobile: +1 415 235 3778

Remember to vote!

#5codeWarrior
gpatnude@hotmail.com
In reply to: Patrick Hatcher (#1)
Re: Data Dictionary generator?

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...

Show quoted text

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