Re: describe command

From: Charles Tassell <ctassell(at)isn(dot)net>
To: Merrill Oveson <merrill(at)actiontarget(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: describe command
Date: 2000-04-10 22:10:56
Message-ID: 4.2.0.58.20000410191005.00a57de0@mailer.isn.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ed Loehr 2000-04-10 23:47:25 Re: How big a database will PostgreSQL support?
Previous Message Ed Loehr 2000-04-10 22:10:30 Re: describe command