mirror of
https://github.com/postgres/postgres.git
synced 2025-12-15 02:22:24 +03:00
IN clauses appearing at top level of WHERE can now be handled as joins.
There are two implementation techniques: the executor understands a new JOIN_IN jointype, which emits at most one matching row per left-hand row, or the result of the IN's sub-select can be fed through a DISTINCT filter and then joined as an ordinary relation. Along the way, some minor code cleanup in the optimizer; notably, break out most of the jointree-rearrangement preprocessing in planner.c and put it in a new file prep/prepjointree.c.
This commit is contained in:
@@ -58,10 +58,10 @@ SELECT '' AS six, f1 AS "Uncorrelated Field" FROM SUBSELECT_TBL
|
||||
six | Uncorrelated Field
|
||||
-----+--------------------
|
||||
| 1
|
||||
| 2
|
||||
| 3
|
||||
| 1
|
||||
| 2
|
||||
| 2
|
||||
| 3
|
||||
| 3
|
||||
(6 rows)
|
||||
|
||||
@@ -71,10 +71,10 @@ SELECT '' AS six, f1 AS "Uncorrelated Field" FROM SUBSELECT_TBL
|
||||
six | Uncorrelated Field
|
||||
-----+--------------------
|
||||
| 1
|
||||
| 2
|
||||
| 3
|
||||
| 1
|
||||
| 2
|
||||
| 2
|
||||
| 3
|
||||
| 3
|
||||
(6 rows)
|
||||
|
||||
@@ -134,10 +134,10 @@ SELECT '' AS five, f1 AS "Correlated Field"
|
||||
WHERE f3 IS NOT NULL);
|
||||
five | Correlated Field
|
||||
------+------------------
|
||||
| 2
|
||||
| 3
|
||||
| 1
|
||||
| 2
|
||||
| 2
|
||||
| 3
|
||||
| 3
|
||||
(5 rows)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user