Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] getting list of columns from a query

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: c k <shreeseva(dot)learning(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-admin(at)postgresql(dot)org
Subject: Re: [GENERAL] getting list of columns from a query
Date: 2010-08-22 23:26:32
Message-ID: AANLkTi=FU+=humCnqD-t58rwQag4j5HowD=sZgHWYnih@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-adminpgsql-general
Hello

2010/8/22 c k <shreeseva(dot)learning(at)gmail(dot)com>:
> Hi all,
> 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.
> Thanks in advance.
>

Yes, it is possible, you can get a description of prepared statement's
result. See: PQprepare, PQdescribePrepared, PQdescribePortal. These
functions are in client postgresql library -
http://www.postgresql.org/docs/8.4/interactive/libpq-exec.html#LIBPQ-EXEC-MAIN

Regards

Pavel Stehule

> CPK
>

In response to

Responses

pgsql-admin by date

Next:From: Kenichiro TanakaDate: 2010-08-23 02:02:03
Subject: Re: installing Postgres 8.3 msi getting `Error` = 2888
Previous:From: Daniel J. SummersDate: 2010-08-22 21:18:47
Subject: Re: getting list of columns from a query

pgsql-general by date

Next:From: Yaroslav TykhiyDate: 2010-08-23 01:56:25
Subject: Re: Warm Standby and resetting the primary as a standby
Previous:From: Daniel J. SummersDate: 2010-08-22 21:18:47
Subject: Re: getting list of columns from a query

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group