mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Get rid of the rather fuzzily defined FlattenedSubLink node type in favor of
making pull_up_sublinks() construct a full-blown JoinExpr tree representation of IN/EXISTS SubLinks that it is able to convert to semi or anti joins. This makes pull_up_sublinks() a shade more complex, but the gain in semantic clarity is worth it. I still have more to do in this area to address the previously-discussed problems, but this commit in itself fixes at least one bug in HEAD, as shown by added regression test case.
This commit is contained in:
@@ -495,3 +495,13 @@ select a.unique2, a.ten, b.tenthous, b.unique2, b.hundred
|
||||
from tenk1 a left join tenk1 b on a.unique2 = b.tenthous
|
||||
where a.unique1 = 42 and
|
||||
((b.unique2 is null and a.ten = 2) or b.hundred = 3);
|
||||
|
||||
--
|
||||
-- test proper positioning of one-time quals in EXISTS (8.4devel bug)
|
||||
--
|
||||
prepare foo(bool) as
|
||||
select count(*) from tenk1 a left join tenk1 b
|
||||
on (a.unique2 = b.unique1 and exists
|
||||
(select 1 from tenk1 c where c.thousand = b.unique2 and $1));
|
||||
execute foo(true);
|
||||
execute foo(false);
|
||||
|
||||
Reference in New Issue
Block a user