Re: PLpgSQL FOR IN EXECUTE question

From: Richard Huxton <dev(at)archonet(dot)com>
To: Christoph Haller <ch(at)rodos(dot)fzk(dot)de>, pgsql-sql(at)postgresql(dot)org
Subject: Re: PLpgSQL FOR IN EXECUTE question
Date: 2002-11-07 16:13:21
Message-ID: 200211071613.21773.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thursday 07 Nov 2002 2:35 pm, Christoph Haller wrote:
> Consider the following PLpgSQL code fragment
>
> FOR this_record IN
> EXECUTE ''SELECT ''
>
> || quote_ident($1)
> || ''FROM ''
> || quote_ident($2)
>
> LOOP
> list := list || '', '' || this_record.$1 ;
> END LOOP;
>
> As expected, accessing a field via this_record.$1
> does not work.
> Can it be done otherwise?

Perhaps "SELECT ... AS known_name FROM ..." and then this_record.known_name?

--
Richard Huxton

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jean-Luc Lachance 2002-11-07 16:28:55 Re: Copying a rowtype variable.
Previous Message Tom Lane 2002-11-07 15:16:21 Re: cast lo to oid