Add tests for LEFT JOIN ON clauses preventing matches left/right.

pull/603/head
Andres Freund 2016-06-16 16:53:02 -07:00
parent 52bc209c37
commit 38f4722f6f
2 changed files with 37 additions and 0 deletions

View File

@ -120,6 +120,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

View File

@ -158,6 +158,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)