Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 5E1D663252C for ; Sun, 22 Aug 2010 18:24:29 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 13116-04 for ; Sun, 22 Aug 2010 21:24:20 +0000 (UTC) X-Greylist: delayed 00:05:30.680145 by SQLgrey-1.7.6 Received: from mail.djs-consulting.com (djs-consulting.com [173.203.86.83]) by mail.postgresql.org (Postfix) with ESMTP id 9EB336320CC for ; Sun, 22 Aug 2010 18:24:21 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.djs-consulting.com (Postfix) with ESMTP id 370382F4222 for ; Sun, 22 Aug 2010 21:20:09 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at djs-consulting.com Received: from mail.djs-consulting.com ([127.0.0.1]) by localhost (djs-consulting.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9qwV4VhuxIaK for ; Sun, 22 Aug 2010 21:20:08 +0000 (UTC) Received: from [192.168.0.101] (c-68-35-134-229.hsd1.nm.comcast.net [68.35.134.229]) (Authenticated sender: daniel@summershome.org) by mail.djs-consulting.com (Postfix) with ESMTPSA id A6EC32F4084 for ; Sun, 22 Aug 2010 21:20:08 +0000 (UTC) Message-ID: <4C719437.1060908@djs-consulting.com> Date: Sun, 22 Aug 2010 21:18:47 +0000 From: "Daniel J. Summers" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6 MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Re: getting list of columns from a query References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201008/143 X-Sequence-Number: 35392 On 08/22/2010 05:27 PM, c k wrote: > As I am using MS Access for a long time, many tools like ms access > provides a way to get the list of columns from a query. (using filed > list in combo boxes in ms access). But is it possible to get such list > of columns from a query where it is not known to the user, that which > columns are defined in the base 'SELECT' statement? How? I dynamically > created SQL statements many times this situation occurs where the > columns are not fixed and we have to get the list of columns from such > a query. What language are you using, and what technique in that language are you using? (ex. Java and JDBC, C# and ADO.NET, PHP and PDO, or PHP and PostgreSQL native) Most of these provide a way to get to the column names, but they're language- and technique-dependent.