Re: select (fn()).* executes function multiple times

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: select (fn()).* executes function multiple times
Дата
Msg-id CAKFQuwbq=7xHuav_z6ET6=SALxcwi2UBHAt1u6XfUAsPYUDo3A@mail.gmail.com
обсуждение исходный текст
Ответ на select (fn()).* executes function multiple times  (Andrey <parihaaraka@gmail.com>)
Список pgsql-bugs
On Fri, Nov 16, 2018 at 7:49 AM Andrey <parihaaraka@gmail.com> wrote:
> perform (fn_ret_test()).*;

Yes it does [execute fn_ret_rest multiple times]; its known behavior
that while surprising is unlikely to get fixed.  Its simple to work
around using the LATERAL construct (i.e., placing said function call
in the FROM clause).

The root problem is the use of ".*" - the rewriter turns it into:
SELECT fn_ret_test.f1(), fn_ret_test().f2, fn_ret_test().f3; which
when written this way become evident why it is executed multiple
times.

David J.


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

Предыдущее
От: Andrey
Дата:
Сообщение: select (fn()).* executes function multiple times
Следующее
От: Tom Lane
Дата:
Сообщение: Re: select (fn()).* executes function multiple times