Re: Dynamic column names in plpgsql

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Dynamic column names in plpgsql
Дата
Msg-id 3525.1138718064@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Dynamic column names in plpgsql  ("Derrick Betts" <derrick@grifflink.com>)
Список pgsql-novice
"Derrick Betts" <derrick@grifflink.com> writes:
> I'm trying to write a function that uses dynamic column names to fetch
> the results within those columns.

The only way to do that in plpgsql is to construct a query string and
execute it with EXECUTE (or FOR ... IN EXECUTE).  Anything else falls
foul of plpgsql's desire to cache execution plans for its queries.

The other PL languages make this easier, mainly because (a) their semantics
for database queries are always like EXECUTE, and (b) they all have more
extensive string-pushing facilities than plpgsql.  So you should consider
plperl, pltcl, and/or plpython depending on which languages you know.

            regards, tom lane

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

Предыдущее
От: Andreas
Дата:
Сообщение: Re: Upgrade to PG 8 before starting major development?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: copy