X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1FEE35E4719 for ; Wed, 1 Sep 2004 12:14:44 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12616-04 for ; Wed, 1 Sep 2004 15:14:46 +0000 (GMT) Received: from sv0.iquer.net (sv0.iquer.net [195.234.230.122]) by svr1.postgresql.org (Postfix) with SMTP id 51EA55E40BA for ; Wed, 1 Sep 2004 12:14:34 -0300 (ADT) Received: (qmail 23323 invoked by uid 108); 1 Sep 2004 15:14:40 -0000 Received: from unknown (HELO ws1) (10.0.16.220) by sv0.iquer.net with SMTP; 1 Sep 2004 15:14:40 -0000 From: Erik Wasser To: pgsql-sql@postgresql.org Subject: Extracting fieldnames from a TABLE Date: Wed, 1 Sep 2004 17:14:49 +0200 User-Agent: KMail/1.6.2 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200409011714.49671.erik.wasser@iquer.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/18 X-Sequence-Number: 18864 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