Re: Matching the MYSQL "Describe <table-name>" command

From: Andrew - Supernews <andrew+nonews(at)supernews(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Matching the MYSQL "Describe <table-name>" command
Date: 2005-04-24 20:24:00
Message-ID: slrnd6o02v.fpt.andrew+nonews@trinity.supernews.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 2005-04-24, Alan Chandler <alan(at)chandlerfamily(dot)org(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message John DeSoi 2005-04-25 00:36:53 Re: php wrapper
Previous Message Theodore Petrosky 2005-04-24 20:08:04 to_char(interval) ?