summaryrefslogtreecommitdiffstats
path: root/tests/fixtures/optimizer/canonicalize.sql
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-04 12:14:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-04 12:14:40 +0000
commitd7f0758e21b5111b5327f3839c5c9f49a04d272b (patch)
treea425f4ebcc159d6bd9443fe4e0e2f9eb20151027 /tests/fixtures/optimizer/canonicalize.sql
parentAdding upstream version 18.7.0. (diff)
downloadsqlglot-d7f0758e21b5111b5327f3839c5c9f49a04d272b.tar.xz
sqlglot-d7f0758e21b5111b5327f3839c5c9f49a04d272b.zip
Adding upstream version 18.11.2.upstream/18.11.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/fixtures/optimizer/canonicalize.sql')
-rw-r--r--tests/fixtures/optimizer/canonicalize.sql12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/fixtures/optimizer/canonicalize.sql b/tests/fixtures/optimizer/canonicalize.sql
index e27b2d3..2ba762d 100644
--- a/tests/fixtures/optimizer/canonicalize.sql
+++ b/tests/fixtures/optimizer/canonicalize.sql
@@ -29,6 +29,12 @@ SELECT "x"."a" AS "a" FROM "x" AS "x" GROUP BY "x"."a" HAVING SUM("x"."b") <> 0
SELECT a FROM x WHERE 1;
SELECT "x"."a" AS "a" FROM "x" AS "x" WHERE 1 <> 0;
+SELECT a FROM x WHERE COALESCE(0, 1);
+SELECT "x"."a" AS "a" FROM "x" AS "x" WHERE COALESCE(0 <> 0, 1 <> 0);
+
+SELECT a FROM x WHERE CASE WHEN COALESCE(b, 1) THEN 1 ELSE 0 END;
+SELECT "x"."a" AS "a" FROM "x" AS "x" WHERE CASE WHEN COALESCE("x"."b" <> 0, 1 <> 0) THEN 1 ELSE 0 END <> 0;
+
--------------------------------------
-- Replace date functions
--------------------------------------
@@ -40,3 +46,9 @@ CAST('2023-01-01' AS TIMESTAMP);
TIMESTAMP('2023-01-01', '12:00:00');
TIMESTAMP('2023-01-01', '12:00:00');
+
+DATE_ADD(CAST("x" AS DATE), 1, 'YEAR');
+DATE_ADD(CAST("x" AS DATE), 1, 'YEAR');
+
+DATE_ADD('2023-01-01', 1, 'YEAR');
+DATE_ADD(CAST('2023-01-01' AS DATE), 1, 'YEAR');