From: | Vik Fearing <vik(at)2ndquadrant(dot)fr> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Merlin Moncure <mmoncure(at)gmail(dot)com>, David Fetter <david(at)fetter(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Changed SRF in targetlist handling |
Date: | 2016-06-06 16:40:05 |
Message-ID: | 5755A765.7050502@2ndquadrant.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 06/06/16 18:30, David G. Johnston wrote:
> To clarify, the present behavior is basically a combination of both of
> Robert's results.
>
> If the SRFs return the same number of rows the first (zippered) result
> is returned without an NULL padding.
>
> If the SRFs return a different number of rows the LCM behavior kicks in
> and you get Robert's second result.
No.
> SELECT generate_series(1, 4), generate_series(1, 4) ORDER BY 1, 2;
> is the same as
> SELECT * FROM ROWS FROM ( generate_series(1, 4), generate_series(1, 4) );
>
> BUT
>
> SELECT generate_series(1, 3), generate_series(1, 4) ORDER BY 1, 2;
> is the same as
> SELECT * FROM ROWS FROM generate_series(1, 3) a, LATERAL ROWS FROM
> generate_series(1, 4) b;
What would you do with:
SELECT generate_series(1, 3), generate_series(1, 6);
?
> Tom's 2.5 proposal basically says we make the former equivalence succeed
> and have the later one fail.
>
> The rewrite would be unaware of the cardinality of the SRF and so it
> cannot conditionally rewrite the query. One of the two must be chosen
> and the incompatible behavior turned into an error.
--
Vik Fearing +33 6 46 75 15 36
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-06-06 16:41:38 | Re: Changed SRF in targetlist handling |
Previous Message | Tom Lane | 2016-06-06 16:34:42 | Re: pg9.6 segfault using simple query (related to use fk for join estimates) |