mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Repair bug #4926 "too few pathkeys for mergeclauses". This example shows
that the sanity checking I added to create_mergejoin_plan() in 8.3 was a few bricks shy of a load: the mergeclauses could reference pathkeys in a noncanonical order such as x,y,x, not only cases like x,x,y which is all that the code had allowed for. The odd cases only turn up when using redundant clauses in an outer join condition, which is why no one had noticed before.
This commit is contained in:
@@ -505,3 +505,20 @@ prepare foo(bool) as
|
||||
(select 1 from tenk1 c where c.thousand = b.unique2 and $1));
|
||||
execute foo(true);
|
||||
execute foo(false);
|
||||
|
||||
--
|
||||
-- test for sane behavior with noncanonical merge clauses, per bug #4926
|
||||
--
|
||||
|
||||
begin;
|
||||
|
||||
set enable_mergejoin = 1;
|
||||
set enable_hashjoin = 0;
|
||||
set enable_nestloop = 0;
|
||||
|
||||
create temp table a (i integer);
|
||||
create temp table b (x integer, y integer);
|
||||
|
||||
select * from a left join b on i = x and i = y and x = i;
|
||||
|
||||
rollback;
|
||||
|
||||
Reference in New Issue
Block a user