Re: Determining the names of columns in a dynamic query

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Determining the names of columns in a dynamic query
Date: 2009-04-28 10:01:52
Message-ID: gt6k6g$eu9$6@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2009-04-24, Johan Nel <johan555(dot)nel555(at)xsinet555(dot)co(dot)za> wrote:
> Hi,
>
> Sorry for cross posting, but seems nobody read the pgsql.sql NG. Have
> not received any response there so lets see if this create some reaction.
>
> Is it possible in pgsql to have something to manipulate columns where
> the column names will only be resolved during execution of the select
> statement:

no.

> FOR rec IN (SELECT * FROM table)
> LOOP
> -- This is what I would like to do
> FOR col IN (rec.column_names)
> LOOP

> For the above, it does not need to be exactly the same, but are there a
> group of functions available to at least return in a dynamic query the
> number of columns, name of a column given the ordinal number of the
> column, etc?

not in plpgsql, you have to use a different language like plpython,
plperl, or C.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Migowski 2009-04-28 10:19:19 Re: PostgreSQL Hibernate Problem
Previous Message Raymond O'Donnell 2009-04-28 10:00:49 Re: deleting function