Re: New-B Question #2 - Mailing list pgsql-novice

From Oliver Elphick
Subject Re: New-B Question #2
Date
Msg-id 1124777535.3560.142.camel@linda
Whole thread Raw
In response to New-B Question #2  (cbraden <cbraden@douglasknight.com>)
Responses SQL safe input?
List 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@lfix.co.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


pgsql-novice by date:

Previous
From: Oliver Elphick
Date:
Subject: Re: doubt
Next
From: "Adam Bickford"
Date:
Subject: Removing PostGreSQL Services and Accounts