mirror of
https://github.com/postgres/postgres.git
synced 2026-01-05 23:38:41 +03:00
Remove the RTE_GROUP RTE if we drop the groupClause
For an EXISTS subquery, the only thing that matters is whether it returns zero or more than zero rows. Therefore, we remove certain SQL features that won't affect that, among them the GROUP BY clauses. After we drop the groupClause, we'd better remove the RTE_GROUP RTE and clear the hasGroupRTE flag, as they depend on the groupClause. Failing to do so could result in a bogus RTE_GROUP entry in the parent query, leading to an assertion failure on the hasGroupRTE flag. Reported-by: David Rowley Author: Richard Guo Discussion: https://postgr.es/m/CAApHDvp2_yht8uPLyWO-kVGWZhYvx5zjGfSrg4fBQ9fsC13V0g@mail.gmail.com
This commit is contained in:
@@ -818,6 +818,14 @@ explain (costs off)
|
||||
select a.* from tenk1 a left join tenk1 b on a.unique1 = b.unique2
|
||||
where b.unique2 is null;
|
||||
|
||||
--
|
||||
-- regression test for bogus RTE_GROUP entries
|
||||
--
|
||||
|
||||
explain (costs off)
|
||||
select a.* from tenk1 a
|
||||
where exists (select 1 from tenk1 b where a.unique1 = b.unique2 group by b.unique1);
|
||||
|
||||
--
|
||||
-- regression test for proper handling of outer joins within antijoins
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user