Re: Is there anything like DESCRIBE? - Mailing list pgsql-sql

From clayton cottingham
Subject Re: Is there anything like DESCRIBE?
Date
Msg-id 3A70944D.4541D0F3@smartt.com
Whole thread Raw
In response to Is there anything like DESCRIBE?  ("Mike D'Agosta" <mdagosta@earthtribe.net>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: Michael Davis
Date:
Subject: RE: Is there anything like DESCRIBE?
Next
From: "Oliver Elphick"
Date:
Subject: Re: Is there anything like DESCRIBE?