pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew - Supernews <andrew+nonews@supernews.com>
To: pgsql-sql@postgresql.org
Subject: Re: Matching the MYSQL "Describe <table-name>" command
Date: Sun, 24 Apr 2005 20:24:00 -0000
Message-ID: <slrnd6o02v.fpt.andrew+nonews@trinity.supernews.net> (raw)
References: <200504241902.16770.alan@chandlerfamily.org.uk>

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



view thread (5+ messages)  latest in thread

Message-ID: <slrnd6o02v.fpt.andrew+nonews@trinity.supernews.net>
Permalink:  ../slrnd6o02v.fpt.andrew+nonews@trinity.supernews.net/
Also on:    postgresql.org/message-id/slrnd6o02v.fpt.andrew+nonews@trinity.supernews.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: andrew+nonews@supernews.com
  Subject: Re: Matching the MYSQL "Describe <table-name>" command
  In-Reply-To: <slrnd6o02v.fpt.andrew+nonews@trinity.supernews.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox