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.