Re: Computed table name in function

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Computed table name in function
Дата
Msg-id 470D1F54.6090200@archonet.com
обсуждение исходный текст
Ответ на Re: Computed table name in function  ("Ray Madigan" <ray@madigans.org>)
Список pgsql-sql
Ray Madigan wrote:
> I thought that the documentation said I couldn't use EXECUTE on a SELECT
> INTO?

"37.6.5. Executing Dynamic Commands

Oftentimes you will want to generate dynamic commands inside your
PL/pgSQL functions, that is, commands that will involve different tables
or different data types each time they are executed. PL/pgSQL's normal
attempts to cache plans for commands will not work in such scenarios. To
handle this sort of problem, the EXECUTE statement is provided:

EXECUTE command-string [ INTO [STRICT] target ];

where command-string is an expression yielding a string (of type text)
containing the command to be executed and target is a record variable,
row variable, or a comma-separated list of simple variables and
record/row fields.
"

There's also a FOR..IN EXECUTE loop too

--   Richard Huxton  Archonet Ltd


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

Предыдущее
От: Daniel Drotos
Дата:
Сообщение: Re: Computed table name in function
Следующее
От: Mike Adams
Дата:
Сообщение: Refactored queries needing validation of syntactic equivalence