Re: Matching the MYSQL "Describe " command - Mailing list pgsql-sql

From Andrew - Supernews
Subject Re: Matching the MYSQL "Describe " command
Date
Msg-id slrnd6o02v.fpt.andrew+nonews@trinity.supernews.net
Whole thread Raw
In response to Matching the MYSQL "Describe " command  (Alan Chandler <alan@chandlerfamily.org.uk>)
List pgsql-sql
On 2005-04-24, Alan Chandler <alan@chandlerfamily.org.uk> wrote:
> I am rather new to Postgres (running 7.4) but I am trying to port some PHP 
> code that has been built to run with mysql.
>
> I have got stuck trying to find the equivalent of the Mysql "DESCRIBE 
><tablename>;" SQL statement that lists the columns and type identifiers of a 
> table.
>
> I think I am going to do a SELECT on the "pg_attribute" table,

Steer clear of reading the system catalogs directly; getting the right
answers from them can be much harder than it appears, since they are
organized purely for the convenience of the backend.

For this specific task, information_schema.columns should be pretty close
to what you need.

-- 
Andrew, Supernews
http://www.supernews.com - individual and corporate NNTP services


pgsql-sql by date:

Previous
From: Theodore Petrosky
Date:
Subject: to_char(interval) ?
Next
From: John DeSoi
Date:
Subject: Re: php wrapper