summaryrefslogtreecommitdiffstats
path: root/tests/fixtures/optimizer/optimizer.sql
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:02:12 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:02:12 +0000
commit07115fb6b7dc48595d30c3d1568fbeff0388d096 (patch)
treef8017ffa5da7c1a44443bbf5fc6c3937b243ac5e /tests/fixtures/optimizer/optimizer.sql
parentAdding upstream version 23.7.0. (diff)
downloadsqlglot-07115fb6b7dc48595d30c3d1568fbeff0388d096.tar.xz
sqlglot-07115fb6b7dc48595d30c3d1568fbeff0388d096.zip
Adding upstream version 23.10.0.upstream/23.10.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/fixtures/optimizer/optimizer.sql')
-rw-r--r--tests/fixtures/optimizer/optimizer.sql42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/fixtures/optimizer/optimizer.sql b/tests/fixtures/optimizer/optimizer.sql
index cc72e6d..37ef4fd 100644
--- a/tests/fixtures/optimizer/optimizer.sql
+++ b/tests/fixtures/optimizer/optimizer.sql
@@ -1388,3 +1388,45 @@ WHERE
ORDER BY
COUNT(DISTINCT `cs1`.`cs_order_number`)
LIMIT 100;
+
+# execute: false
+SELECT
+ *
+FROM event
+WHERE priority = 'High' AND tagname IN (
+ SELECT
+ tag_input AS tagname
+ FROM cascade
+ WHERE tag_input = 'XXX' OR tag_output = 'XXX'
+ UNION
+ SELECT
+ tag_output AS tagname
+ FROM cascade
+ WHERE tag_input = 'XXX' OR tag_output = 'XXX'
+);
+WITH "_u_0" AS (
+ SELECT
+ "cascade"."tag_input" AS "tagname"
+ FROM "cascade" AS "cascade"
+ WHERE
+ "cascade"."tag_input" = 'XXX' OR "cascade"."tag_output" = 'XXX'
+ UNION
+ SELECT
+ "cascade"."tag_output" AS "tagname"
+ FROM "cascade" AS "cascade"
+ WHERE
+ "cascade"."tag_input" = 'XXX' OR "cascade"."tag_output" = 'XXX'
+), "_u_1" AS (
+ SELECT
+ "cascade"."tag_input" AS "tagname"
+ FROM "_u_0" AS "_u_0"
+ GROUP BY
+ "cascade"."tag_input"
+)
+SELECT
+ *
+FROM "event" AS "event"
+LEFT JOIN "_u_1" AS "_u_1"
+ ON "_u_1"."tagname" = "event"."tagname"
+WHERE
+ "event"."priority" = 'High' AND NOT "_u_1"."tagname" IS NULL;