"David G. Johnston" <david.g.johnston@gmail.com> writes:
> I found it notable that you choose to introduce the OFFSET 0 hack instead
> of writing a LATERAL query in the "optimization failure" example.
> SELECT (m).* FROM (SELECT myfunc(x) AS m FROM some_table OFFSET 0) ss;
> instead of
> SELECT (m).* FROM some_table, LATERAL myfunc(some_table.x) m
Meh ... I'm not really sure that the latter is any less of a hack for this
purpose, or that we'd never optimize it into the unwanted form. LATERAL
is a good way to fix the weird semantics of set-returning functions in the
tlist, but this is not that case.
regards, tom lane