Re: [SQL] PLpgSQL FOR IN EXECUTE question

2002-11-08 Thread Christoph Haller
Thanks to Josh, Richard, Tom EXECUTE ''SELECT CAST('' || quote_ident($1) || '' AS TEXT) AS foo FROM '' || quote_ident($2) and then list := list || '', '' || this_record.foo ; works perfectly. Regards, Christoph ---(end of broadcast)--

Re: [SQL] PLpgSQL FOR IN EXECUTE question

2002-11-07 Thread Josh Berkus
Chris, > 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?

Re: [SQL] PLpgSQL FOR IN EXECUTE question

2002-11-07 Thread Tom Lane
Christoph Haller <[EMAIL PROTECTED]> writes: > 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,

Re: [SQL] PLpgSQL FOR IN EXECUTE question

2002-11-07 Thread Richard Huxton
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 LOO

[SQL] PLpgSQL FOR IN EXECUTE question

2002-11-07 Thread Christoph Haller
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 d