pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Erik Wasser <erik.wasser@iquer.net>
To: pgsql-sql@postgresql.org
Subject: Extracting fieldnames from a TABLE
Date: Wed, 1 Sep 2004 17:14:49 +0200
Message-ID: <200409011714.49671.erik.wasser@iquer.net> (raw)

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



view thread (2+ messages)  latest in thread

Message-ID: <200409011714.49671.erik.wasser@iquer.net>
Permalink:  ../200409011714.49671.erik.wasser@iquer.net/
Also on:    postgresql.org/message-id/200409011714.49671.erik.wasser@iquer.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: erik.wasser@iquer.net
  Subject: Re: Extracting fieldnames from a TABLE
  In-Reply-To: <200409011714.49671.erik.wasser@iquer.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox