Extracting fieldnames from a TABLE - Mailing list pgsql-sql

From Erik Wasser
Subject Extracting fieldnames from a TABLE
Date
Msg-id 200409011714.49671.erik.wasser@iquer.net
Whole thread Raw
Responses Re: Extracting fieldnames from a TABLE
List pgsql-sql
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


pgsql-sql by date:

Previous
From: Michael Kleiser
Date:
Subject: Re: German "umlaut insensitive" query
Next
From: Robert Strötgen
Date:
Subject: Re: German "umlaut insensitive" query