Re: BUG #13798: Unexpected multiple exection of user defined function with out parameters

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: BUG #13798: Unexpected multiple exection of user defined function with out parameters
Дата
Msg-id CAKFQuwax1S+kJ0X-h=Buu+iDhuXg6eh-Mgat2irrRhNUrmfGug@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #13798: Unexpected multiple exection of user defined function with out parameters  (mike.lang1010@gmail.com)
Список pgsql-bugs
On Fri, Dec 4, 2015 at 11:30 PM, <mike.lang1010@gmail.com> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      13798
> Logged by:          Michael Lang
> Email address:      mike.lang1010@gmail.com
> PostgreSQL version: 9.4.5
> Operating system:   Ubuntu 12.04
> Description:
>
> I've found that when a user defined function has
> out parameters, it is invoked once per out parameter if invoked with the
> syntax:
>
> `SELECT (udf()).*`
>
> Is this the expected behavior?


=E2=80=8BYes, it is.

Using the recently introduced "LATERAL" feature is the preferred method.

=E2=80=8B(i think...)=E2=80=8B
=E2=80=8BSELECT *=E2=80=8B
=E2=80=8BFROM src
LATERAL func_call(src.col);=E2=80=8B

If that is not possible you can use a CTE.

WITH func_cte AS (
SELECT function_call(...)  --do not expand this yet; pass it out as a
composite
)
SELECT (func_cte.function_call).*  --now we expand the composite; not the
unusual parens - they are required.
FROM func_cte;

David J.

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

Предыдущее
От: Kevin Grittner
Дата:
Сообщение: Re: BUG #13798: Unexpected multiple exection of user defined function with out parameters
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: BUG #13798: Unexpected multiple exection of user defined function with out parameters