diff options
Diffstat (limited to '')
-rw-r--r-- | tests/fixtures/optimizer/simplify.sql | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/fixtures/optimizer/simplify.sql b/tests/fixtures/optimizer/simplify.sql index 87b42d1..1842e55 100644 --- a/tests/fixtures/optimizer/simplify.sql +++ b/tests/fixtures/optimizer/simplify.sql @@ -85,6 +85,27 @@ NULL; NULL = NULL; NULL; +1 AND 0; +FALSE; + +0 AND 1; +FALSE; + +0 OR 1; +TRUE; + +0 OR NULL; +NULL; + +NULL OR 0; +NULL; + +0 AND NULL; +FALSE; + +NULL AND 0; +FALSE; + -- Can't optimize this because different engines do different things -- mysql converts to 0 and 1 but tsql does true and false NULL <=> NULL; @@ -116,6 +137,12 @@ FALSE; TRUE AND TRUE OR TRUE AND FALSE; TRUE; +COALESCE(x, y) <> ALL (SELECT z FROM w); +COALESCE(x, y) <> ALL (SELECT z FROM w); + +SELECT NOT (2 <> ALL (SELECT 2 UNION ALL SELECT 3)); +SELECT 2 = ANY(SELECT 2 UNION ALL SELECT 3); + -------------------------------------- -- Absorption -------------------------------------- @@ -531,6 +558,9 @@ CAST('2023-01-01 22:00:00' AS DATETIME); DATE_ADD(x, 1, 'MONTH'); DATE_ADD(x, 1, 'MONTH'); +DATE_ADD(x, 1); +DATE_ADD(x, 1, 'DAY'); + -------------------------------------- -- Comparisons -------------------------------------- @@ -1047,6 +1077,9 @@ x < CAST('2021-01-02' AS DATE) AND x >= CAST('2021-01-01' AS DATE); TIMESTAMP_TRUNC(x, YEAR) = CAST(CAST('2021-01-01 01:02:03' AS DATE) AS DATETIME); x < CAST('2022-01-01 00:00:00' AS DATETIME) AND x >= CAST('2021-01-01 00:00:00' AS DATETIME); +DATE_TRUNC('day', CAST(x AS DATE)) <= CAST('2021-01-01 01:02:03' AS TIMESTAMP); +CAST(x AS DATE) < CAST('2021-01-02 01:02:03' AS TIMESTAMP); + -------------------------------------- -- EQUALITY -------------------------------------- |