Re: Getting fields in a table through a query? - Mailing list pgsql-general

From Tom Lane
Subject Re: Getting fields in a table through a query?
Date
Msg-id 24946.1012923861@sss.pgh.pa.us
Whole thread Raw
In response to Getting fields in a table through a query?  ("Mitch Vincent" <mitch@doot.org>)
List pgsql-general
"Mitch Vincent" <mitch@doot.org> writes:
> How can I get the fields in a given table via an SQL query even if there are
> no records in that table? I just need the names of all the fields in a
> table -- is that even possible?

Why not just
    select * from foo where false;
and examine the column names that come back?  Lack of any data will not
stop the system from sending column headers.

            regards, tom lane

pgsql-general by date:

Previous
From: "Ben-Nes Michael"
Date:
Subject: caculating while select - maybe sum ?
Next
From: Tom Lane
Date:
Subject: Re: rule on update