Re: Changed SRF in targetlist handling
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: "David G. Johnston" <david.g.johnston@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Merlin Moncure <mmoncure@gmail.com>,
David Fetter <david@fetter.org>, Andres Freund <andres@anarazel.de>,
PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2016-06-06T16:41:38Z
Lists: pgsql-hackers
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> If the SRFs return a different number of rows the LCM behavior kicks in and
> you get Robert's second result.
Only if the periods of the SRFs are relatively prime. That is, neither of
his examples demonstrate the full weirdness of the current behavior; for
that, you need periods that are multiples of each other. For instance:
SELECT generate_series(1, 2), generate_series(1, 4);
generate_series | generate_series
-----------------+-----------------
1 | 1
2 | 2
1 | 3
2 | 4
(4 rows)
That doesn't comport with any behavior available from LATERAL.
regards, tom lane
Commits
-
Remove obsoleted code relating to targetlist SRF evaluation.
- ea15e18677fc 10.0 landed
-
Doc: improve documentation of new SRF-in-tlist behavior.
- f13a1277aa2d 10.0 landed
-
Move targetlist SRF handling from expression evaluation to new executor node.
- 69f4b9c85f16 10.0 landed
-
Don't split up SRFs when choosing to postpone SELECT output expressions.
- d543170f2fdd 9.6.0 cited