-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
opt: normalize In with single-element list to Eq
This commit adds a rule that normalizes `a IN (b)` to `a = b` (and similarly `NOT IN` to `!=`). This query confirms the equivalency holds even when NULLs are involved: ``` WITH vals (v) AS (VALUES (1), (2), (NULL)) SELECT v1.v, v2.v, v1.v NOT IN (v2.v,) AS in, v1.v != v2.v AS eq FROM vals AS v1, vals AS v2 v | v | in | eq -------+------+-------+-------- 1 | 1 | false | false 1 | 2 | true | true 1 | NULL | NULL | NULL 2 | 1 | true | true 2 | 2 | false | false 2 | NULL | NULL | NULL NULL | 1 | NULL | NULL NULL | 2 | NULL | NULL NULL | NULL | NULL | NULL ``` Release note: None
- Loading branch information
1 parent
22e4d64
commit 4c6e54e
Showing
9 changed files
with
132 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters