Re: describe command - Mailing list pgsql-general

From Charles Tassell
Subject Re: describe command
Date
Msg-id 4.2.0.58.20000410191005.00a57de0@mailer.isn.net
Whole thread Raw
In response to describe command  (Merrill Oveson <merrill@actiontarget.com>)
List pgsql-general
You can do this with \d tablename in psql.  Or, the SQL commands to
generate the same thing are:

QUERY: SELECT a.attnum, a.attname, t.typname, a.attlen, a.atttypmod,
a.attnotnull, a.atthasdef FROM pg_class c, pg_attribute a, pg_type t WHERE
c.relname = 'tablename'    and a.attnum > 0     and a.attrelid =
c.oid     and a.atttypid = t.oid   ORDER BY attnum

QUERY: SELECT viewname, definition FROM pg_views WHERE viewname like
'tablename'


At 06:05 PM 4/10/00, Merrill Oveson wrote:
>Postgresql:
>
>Oracle has a command "describe"
>
>e.g.
>
>"describe cars" or  "desc cars"
>
>where cars is the name of the table.
>
>this command  describes the attributes of a table.
>
>e.g.
>
>Name        Null        Type                Constraint
>------------------------------
>VIN                           char(20)        Primary key
>Make        Not Null   varchar(20)
>Model                        varchar(20)
>
>Does Postgresql have anything similar?
>I could find the command "describe" anywhere in the documentation.
>
>Merrill


pgsql-general by date:

Previous
From: Ed Loehr
Date:
Subject: Re: describe command
Next
From: Damien Tougas
Date:
Subject: How big a database will PostgreSQL support?