Re: PLpgSQL FOR IN EXECUTE question

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: PLpgSQL FOR IN EXECUTE question
Дата
Msg-id 200211071613.21773.dev@archonet.com
обсуждение исходный текст
Ответ на PLpgSQL FOR IN EXECUTE question  (Christoph Haller <ch@rodos.fzk.de>)
Список 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


В списке pgsql-sql по дате отправления:

Предыдущее
От: kkennedy@kenzoid.com (Ken Kennedy)
Дата:
Сообщение: Re: how to get the source table & field name of a view field
Следующее
От: Jean-Luc Lachance
Дата:
Сообщение: Re: Copying a rowtype variable.