Hi community,

I would like to retrieve all the fieldnames of a given table. In the 
perl module Tie::DBI[1] i found the following fragment:

   $dbh->prepare("LISTFIELDS $table");

in the case the DB supports this (Tie::DBI thinks so for Pg) or the 
alternative is:

   $dbh->prepare("SELECT * FROM $table WHERE 0=1");

The first one doesn't work in my PostgreSQL 7.4.3:

% LISTFIELDS foobar;
ERROR:  syntax error at or near "LISTFIELDS" at character 1
%

and the seconds one looks ugly. Is there a solution for the problem?

Greetings

[1]http://search.cpan.org/~lds/Tie-DBI-0.93/lib/Tie/DBI.pm

-- 
So long... Fuzz

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to