Re: list fieldnames in table? (from PHP)

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Miles Keaton <mileskeaton(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: list fieldnames in table? (from PHP)
Date: 2004-10-26 04:04:39
Message-ID: 20041026040439.GA37556@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Oct 25, 2004 at 07:36:43PM -0700, Miles Keaton wrote:
> Is there a simple way to list fieldnames in a table, from PHP?
>
> When on the command-line, I just do \d tablename

If you run "psql -E" or type "\set ECHO_HIDDEN" after you're
in psql then you'll see the hidden queries that psql sends for
"\d tablename", etc. Examine those queries and use the relevant
parts in your own code.

You might want to familiarize yourself with the system catalogs,
which is what you'll be querying:

http://www.postgresql.org/docs/7.4/static/catalogs.html

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Deepa K 2004-10-26 05:00:32 [Fwd: Abrupt close of pgsql backend]
Previous Message Steven Klassen 2004-10-26 03:53:33 Re: list fieldnames in table? (from PHP)