Re: New-B Question #2

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: cbraden(at)douglasknight(dot)com
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: New-B Question #2
Date: 2005-08-23 06:12:15
Message-ID: 1124777535.3560.142.camel@linda
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Mon, 2005-08-22 at 16:46 -0400, cbraden wrote:
> Folks,
>
> Thanks so much for all your help. Many people quickly replied to my
> question with the information I needed.
>
> What I would like to do, use PostgreSQL and PHP, is list all the columns
> for a given table. (Having finally choked the list of tables from
> postgre). In MySQL it is something like this "SHOW COLUMNS FROM
> {tablename} FROM {databasename}". I'm assuming I'm missing something
> obvious and bonehead, but I can't seem to translate that into postgreSQL
> to save my bacon.

The command in psql is

\d tablename

or

\d schemaname.tablename

If you start psql with the -E option, it will show you the SQL commands
it runs to satisfy these queries; you can adapt those for use from PHP.

--
Oliver Elphick olly(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC0 5664 7A2F A543 10EA
========================================
Do you want to know God? http://www.lfix.co.uk/knowing_god.html

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Adam Bickford 2005-08-23 13:25:30 Removing PostGreSQL Services and Accounts
Previous Message Oliver Elphick 2005-08-23 06:08:39 Re: doubt