Re: column names, types, properties for a table

From: "thomas(dot)silvi" <thomas(dot)silvi(at)laposte(dot)net>
To: Roger Tannous <roger77_lb(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: column names, types, properties for a table
Date: 2005-09-08 20:37:50
Message-ID: 4320A11E.30502@laposte.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Hello,
there is the view "columns" in the schema "information_schema" that
can give you most of the informations you need
( for PosgreSQL version >= 7.4.8 if I'm right).

SELECT *
FROM information_schema.columns
WHERE table_name = 'mytable';

See
http://www.postgresql.org/docs/8.0/interactive/infoschema-columns.html#AEN26185
or
http://www.postgresql.org/docs/8.0/static/infoschema-columns.html#AEN26185

Regards,
Thomas

Roger Tannous a écrit :

>Hi,
>
>Is it possible to issue an SQL query that lists column names, types (int,
>varchar, boolean, etc.), properties (like NOT NULL or UNIQUE)
>for a given table name ?
>
>
>Regards,
>Roger Tannous.
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam? Yahoo! Mail has the best spam protection around
>http://mail.yahoo.com
>
>---------------------------(end of broadcast)---------------------------
>TIP 2: Don't 'kill -9' the postmaster
>
>
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Joÿffffffffffe3o Carvalho 2005-09-08 20:53:27 Re: Statistics from Sequences
Previous Message Michael Fuhr 2005-09-08 20:08:02 Re: Statistics from Sequences