Skip site navigation (1) Skip section navigation (2)

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 (view raw, whole thread or download thread mbox)
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


  \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                    
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
   Do you want to know God?

In response to


pgsql-novice by date

Next:From: Adam BickfordDate: 2005-08-23 13:25:30
Subject: Removing PostGreSQL Services and Accounts
Previous:From: Oliver ElphickDate: 2005-08-23 06:08:39
Subject: Re: doubt

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group