Column names

Started by Mark Muffettover 24 years ago3 messagesgeneral
Jump to latest
#1Mark Muffett
markm@muffett.net

Is there a simple query to return the column names used in a table?

Thanks for any help.

Msark Muffett

#2Brett W. McCoy
bmccoy@chapelperilous.net
In reply to: Mark Muffett (#1)
Re: Column names

On Fri, 19 Oct 2001, Mark Muffett wrote:

Is there a simple query to return the column names used in a table?

If you start up psql with the -E option, and then do \dt <tablename>, it
will spit out the SQL used to retrieve the metadata on your table. You
can use that as your basis.

-- Brett
http://www.chapelperilous.net/
------------------------------------------------------------------------
After a number of decimal places, nobody gives a damn.

#3Randal L. Schwartz
merlyn@stonehenge.com
In reply to: Brett W. McCoy (#2)
Re: Column names

"Brett" == Brett W McCoy <bmccoy@chapelperilous.net> writes:

Brett> On Fri, 19 Oct 2001, Mark Muffett wrote:

Is there a simple query to return the column names used in a table?

Brett> If you start up psql with the -E option, and then do \dt <tablename>, it
Brett> will spit out the SQL used to retrieve the metadata on your table. You
Brett> can use that as your basis.

A little birdy whispered in my ear that my request to push all the SQL
that psql uses into views so they'd be trivially query-able and
stackable has been put on the official TO-DO list.

So, maybe in 7.2? :)

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/&gt;
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!