From d6dd6db5060d5d7a4abbc132cb1240973e6f9487 Mon Sep 17 00:00:00 2001
From: Daniel Baumann <daniel.baumann@progress-linux.org>
Date: Thu, 22 Sep 2022 06:30:57 +0200
Subject: Adding upstream version 6.1.1.

Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
---
 tests/fixtures/optimizer/optimizer.sql | 57 ++++++++++++----------------------
 1 file changed, 19 insertions(+), 38 deletions(-)

(limited to 'tests/fixtures/optimizer/optimizer.sql')

diff --git a/tests/fixtures/optimizer/optimizer.sql b/tests/fixtures/optimizer/optimizer.sql
index f7bbdda..f1d0f7d 100644
--- a/tests/fixtures/optimizer/optimizer.sql
+++ b/tests/fixtures/optimizer/optimizer.sql
@@ -2,11 +2,7 @@ SELECT a, m FROM z LATERAL VIEW EXPLODE([1, 2]) q AS m;
 SELECT
   "z"."a" AS "a",
   "q"."m" AS "m"
-FROM (
-  SELECT
-    "z"."a" AS "a"
-  FROM "z" AS "z"
-) AS "z"
+FROM "z" AS "z"
 LATERAL VIEW
 EXPLODE(ARRAY(1, 2)) q AS "m";
 
@@ -91,41 +87,26 @@ FROM (
 WHERE (TRUE AND TRUE OR 'a' = 'b') AND a > 1
 GROUP BY a;
 SELECT
-  "d"."a" AS "a",
-  SUM("d"."b") AS "_col_1"
-FROM (
+  "x"."a" AS "a",
+  SUM("y"."b") AS "_col_1"
+FROM "x" AS "x"
+LEFT JOIN (
   SELECT
-    "x"."a" AS "a",
-    "y"."b" AS "b"
-  FROM (
-    SELECT
-      "x"."a" AS "a"
-    FROM "x" AS "x"
-    WHERE
-      "x"."a" > 1
-  ) AS "x"
-  LEFT JOIN (
-    SELECT
-      MAX("y"."b") AS "_col_0",
-      "y"."a" AS "_u_1"
-    FROM "y" AS "y"
-    GROUP BY
-      "y"."a"
-  ) AS "_u_0"
-    ON "x"."a" = "_u_0"."_u_1"
-  JOIN (
-    SELECT
-      "y"."a" AS "a",
-      "y"."b" AS "b"
-    FROM "y" AS "y"
-  ) AS "y"
-    ON "x"."a" = "y"."a"
-  WHERE
-    "_u_0"."_col_0" >= 0
-    AND NOT "_u_0"."_u_1" IS NULL
-) AS "d"
+    MAX("y"."b") AS "_col_0",
+    "y"."a" AS "_u_1"
+  FROM "y" AS "y"
+  GROUP BY
+    "y"."a"
+) AS "_u_0"
+  ON "x"."a" = "_u_0"."_u_1"
+JOIN "y" AS "y"
+  ON "x"."a" = "y"."a"
+WHERE
+  "_u_0"."_col_0" >= 0
+  AND "x"."a" > 1
+  AND NOT "_u_0"."_u_1" IS NULL
 GROUP BY
-  "d"."a";
+  "x"."a";
 
 (SELECT a FROM x) LIMIT 1;
 (
-- 
cgit v1.2.3

