pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to get table definition of a PostgreSQL table
3+ messages / 2 participants
[nested] [flat]

* How to get table definition of a PostgreSQL table
@ 2006-10-27 06:25 Sandeep Khandelwal <sandeep_khandelwal27@yahoo.com>
  2006-10-27 10:53 ` Re: How to get table definition of a PostgreSQL table Sean Davis <sdavis2@mail.nih.gov>
  0 siblings, 1 reply; 3+ messages in thread

From: Sandeep Khandelwal @ 2006-10-27 06:25 UTC (permalink / raw)
  To: pgsql-interfaces

Hi.

I would like to get field's name, datatype of each field, length of each field and precision of each field of a PostgreSQL table. Please let me SQL query to get this information.

Thanks, 
Sandeep





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: How to get table definition of a PostgreSQL table
  2006-10-27 06:25 How to get table definition of a PostgreSQL table Sandeep Khandelwal <sandeep_khandelwal27@yahoo.com>
@ 2006-10-27 10:53 ` Sean Davis <sdavis2@mail.nih.gov>
  0 siblings, 0 replies; 3+ messages in thread

From: Sean Davis @ 2006-10-27 10:53 UTC (permalink / raw)
  To: pgsql-interfaces; +Cc: Sandeep Khandelwal <sandeep_khandelwal27@yahoo.com>

On Friday 27 October 2006 02:25, Sandeep Khandelwal wrote:
> Hi.
>
> I would like to get field's name, datatype of each field, length of each
> field and precision of each field of a PostgreSQL table. Please let me SQL
> query to get this information.

See these two chapters in the postgresql docs:

http://www.postgresql.org/docs/8.1/interactive/catalogs.html
http://www.postgresql.org/docs/8.1/interactive/information-schema.html

Each has advantages over the other.

Also, if you start psql with the flag --echo-hidden, when you do commands like 
\dt and \d+, psql will show you the sql it uses to produce that output.

Sean



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: How to get table definition of a PostgreSQL table
@ 2006-10-31 10:41 Sandeep Khandelwal <sandeep_khandelwal27@yahoo.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Sandeep Khandelwal @ 2006-10-31 10:41 UTC (permalink / raw)
  To: sdavis2@mail.nih.gov; pgsql-interfaces

Thank you so much Sean.
 
Sandeep 


----- Original Message ----
From: Sean Davis <sdavis2@mail.nih.gov>
To: pgsql-interfaces@postgresql.org
Cc: Sandeep Khandelwal <sandeep_khandelwal27@yahoo.com>
Sent: Friday, October 27, 2006 4:23:18 PM
Subject: Re: [INTERFACES] How to get table definition of a PostgreSQL table


On Friday 27 October 2006 02:25, Sandeep Khandelwal wrote:
> Hi.
>
> I would like to get field's name, datatype of each field, length of each
> field and precision of each field of a PostgreSQL table. Please let me SQL
> query to get this information.

See these two chapters in the postgresql docs:

http://www.postgresql.org/docs/8.1/interactive/catalogs.html
http://www.postgresql.org/docs/8.1/interactive/information-schema.html

Each has advantages over the other.

Also, if you start psql with the flag --echo-hidden, when you do commands like 
\dt and \d+, psql will show you the sql it uses to produce that output.

Sean





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2006-10-31 10:41 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-10-27 06:25 How to get table definition of a PostgreSQL table Sandeep Khandelwal <sandeep_khandelwal27@yahoo.com>
2006-10-27 10:53 ` Sean Davis <sdavis2@mail.nih.gov>
2006-10-31 10:41 Re: How to get table definition of a PostgreSQL table Sandeep Khandelwal <sandeep_khandelwal27@yahoo.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox