diff --git a/src/test/regress/input/multi_outer_join.source b/src/test/regress/input/multi_outer_join.source index 5923a3c08..3c6eaa416 100644 --- a/src/test/regress/input/multi_outer_join.source +++ b/src/test/regress/input/multi_outer_join.source @@ -115,6 +115,19 @@ FROM multi_outer_join_left a LEFT JOIN multi_outer_join_right b ON (l_custkey = r_custkey AND r_custkey = 5); +-- Apply a filter before the join (no matches right) +SELECT + count(l_custkey), count(r_custkey) +FROM + multi_outer_join_left a LEFT JOIN multi_outer_join_right b + ON (l_custkey = r_custkey AND r_custkey = -1 /* nonexistant */); + +-- Apply a filter before the join (no matches left) +SELECT + count(l_custkey), count(r_custkey) +FROM + multi_outer_join_left a LEFT JOIN multi_outer_join_right b + ON (l_custkey = r_custkey AND l_custkey = -1 /* nonexistant */); -- Right join should be disallowed in this case SELECT diff --git a/src/test/regress/output/multi_outer_join.source b/src/test/regress/output/multi_outer_join.source index d086efcc6..fba6898ee 100644 --- a/src/test/regress/output/multi_outer_join.source +++ b/src/test/regress/output/multi_outer_join.source @@ -156,6 +156,30 @@ LOG: join order: [ "multi_outer_join_left" ][ broadcast join "multi_outer_join_ 20 | 1 (1 row) +-- Apply a filter before the join (no matches right) +SELECT + count(l_custkey), count(r_custkey) +FROM + multi_outer_join_left a LEFT JOIN multi_outer_join_right b + ON (l_custkey = r_custkey AND r_custkey = -1 /* nonexistant */); +LOG: join order: [ "multi_outer_join_left" ][ broadcast join "multi_outer_join_right" ] + count | count +-------+------- + 20 | 0 +(1 row) + +-- Apply a filter before the join (no matches left) +SELECT + count(l_custkey), count(r_custkey) +FROM + multi_outer_join_left a LEFT JOIN multi_outer_join_right b + ON (l_custkey = r_custkey AND l_custkey = -1 /* nonexistant */); +LOG: join order: [ "multi_outer_join_left" ][ broadcast join "multi_outer_join_right" ] + count | count +-------+------- + 20 | 0 +(1 row) + -- Right join should be disallowed in this case SELECT min(r_custkey), max(r_custkey)