Mike D'Agosta wrote:
>
> Hi,
>
> I have a number of empty tables and I want to get the column names and
> data types with an SQL statement. I want to do this procedurally, not
> interactively (so I can't use \d <tablename> in psql). Postgres doesn't
> support DESCRIBE... is there any other way to do this?
>
> Thanks!
> Mike
like this
drfrog=# \d messages Table "messages" Attribute | Type | Modifier
-------------------+---------+----------id | integer | not nullmsgid | text | boxid
| integer | accountid | integer | date | text | sentto | text | sentfrom
| text | subject | text | contenttype | text | contentxferencode | text | mimeversion
| text | precedence | text | approvedby | text | inreplyto | text | replyto
| text | listsub | text | listunsub | text | status | text | xorigip
| text | cc | text | bcc | text | sender | text | returnpath
| text | priority | text | xmailer | text | xuidl | text | xsender
|text | localdate | text | newmsg | text | replyf | integer | friendly
|text | rreceiptto | text | score | integer | ref | text | serverstat
|integer |
Index: messages_pkey