pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Christoph Haller <ch@rodos.fzk.de>
To: pgsql-sql@postgresql.org
Subject: Re: PLpgSQL FOR IN EXECUTE question
Date: Thu, 7 Nov 2002 16:13:21 +0000
Message-ID: <200211071613.21773.dev@archonet.com> (raw)
In-Reply-To: <3DCA7A2E.6DD4CABE@rodos.fzk.de>
References: <3DCA7A2E.6DD4CABE@rodos.fzk.de>

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



view thread (5+ messages)  latest in thread

Message-ID: <200211071613.21773.dev@archonet.com>
Permalink:  ../200211071613.21773.dev@archonet.com/
Also on:    postgresql.org/message-id/200211071613.21773.dev@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, ch@rodos.fzk.de
  Subject: Re: PLpgSQL FOR IN EXECUTE question
  In-Reply-To: <200211071613.21773.dev@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox