Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B55A3477434 for ; Thu, 7 Nov 2002 11:22:51 -0500 (EST) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by postgresql.org (Postfix) with ESMTP id ABEBE476DCE for ; Thu, 7 Nov 2002 11:15:04 -0500 (EST) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-35.mail.demon.net with esmtp (Exim 3.36 #2) id 189pJB-0005e3-0U; Thu, 07 Nov 2002 16:15:05 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id BA296177B8; Thu, 7 Nov 2002 16:13:11 +0000 (GMT) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id 1F43616916; Thu, 7 Nov 2002 16:13:11 +0000 (GMT) Content-Type: text/plain; charset="iso-8859-2" From: Richard Huxton Organization: Archonet Ltd To: Christoph Haller , pgsql-sql@postgresql.org Subject: Re: PLpgSQL FOR IN EXECUTE question Date: Thu, 7 Nov 2002 16:13:21 +0000 User-Agent: KMail/1.4.3 References: <3DCA7A2E.6DD4CABE@rodos.fzk.de> In-Reply-To: <3DCA7A2E.6DD4CABE@rodos.fzk.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200211071613.21773.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/109 X-Sequence-Number: 10251 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 :=3D 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? --=20 Richard Huxton