Changeset: cb29323a6ec6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/cb29323a6ec6
Added Files:
        sql/test/BugTracker-2026/Tests/8030-inner-join-group-by-bug.test
Modified Files:
        sql/test/BugTracker-2026/Tests/All
Branch: Dec2025
Log Message:

Add test for issue #8030


diffs (112 lines):

diff --git a/sql/test/BugTracker-2026/Tests/8030-inner-join-group-by-bug.test 
b/sql/test/BugTracker-2026/Tests/8030-inner-join-group-by-bug.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2026/Tests/8030-inner-join-group-by-bug.test
@@ -0,0 +1,99 @@
+statement ok
+CREATE TABLE t0(c0 INTEGER)
+
+statement ok
+CREATE TABLE t2(c0 INTEGER)
+
+statement ok rowcount 1
+INSERT INTO t0 VALUES (1)
+
+statement ok rowcount 1
+INSERT INTO t2 VALUES (2)
+
+-- INNER JOIN: all next INNER JOIN queries should return no rows
+
+query I rowsort
+SELECT t2.c0
+FROM t0 INNER JOIN t2 ON t0.c0 = t2.c0
+----
+
+query I rowsort
+SELECT t2.c0
+FROM t0 INNER JOIN t2 ON t0.c0 = t2.c0
+GROUP BY t2.c0
+----
+
+-- Q1  DQR base: issue: HAVING keeps the phantom NULL group
+query I rowsort
+SELECT t2.c0
+FROM t0 INNER JOIN t2 ON t0.c0 = t2.c0
+GROUP BY t2.c0
+HAVING MIN(t2.c0) IS NOT NULL
+----
+
+-- Q2  DQR moved: same boolean as ref1
+query I rowsort
+SELECT ref0 FROM (
+  SELECT t2.c0 AS ref0, (MIN(t2.c0) IS NOT NULL) AS ref1
+  FROM t0 INNER JOIN t2 ON t0.c0 = t2.c0
+  GROUP BY t2.c0
+) AS s WHERE ref1
+----
+
+statement ok
+DROP TABLE t0
+
+statement ok
+DROP TABLE t2
+
+-- LEFT JOIN variant:
+
+statement ok
+CREATE TABLE t0(c0 INTEGER)
+
+statement ok
+CREATE TABLE t3(c0 INTEGER)
+
+statement ok rowcount 1
+INSERT INTO t0 VALUES (1)
+
+query I rowsort
+SELECT t3.c0
+FROM t0 LEFT JOIN t3 ON t0.c0 = t3.c0
+WHERE t3.c0 IS NULL
+----
+NULL
+
+query I rowsort
+SELECT t3.c0
+FROM t0 LEFT JOIN t3 ON t0.c0 = t3.c0
+WHERE t3.c0 IS NULL
+GROUP BY t3.c0
+----
+NULL
+
+-- next 2 queries should return no rows
+-- Q1  DQR base
+query I rowsort
+SELECT t3.c0
+FROM t0 LEFT JOIN t3 ON t0.c0 = t3.c0
+WHERE t3.c0 IS NULL
+GROUP BY t3.c0
+HAVING t3.c0 IS NOT NULL
+----
+
+-- Q2  DQR moved
+query I rowsort
+SELECT ref0 FROM (
+  SELECT t3.c0 AS ref0, (t3.c0 IS NOT NULL) AS ref1
+  FROM t0 LEFT JOIN t3 ON t0.c0 = t3.c0
+  WHERE t3.c0 IS NULL
+  GROUP BY t3.c0
+) AS s WHERE ref1
+----
+
+statement ok
+DROP TABLE t0
+
+statement ok
+DROP TABLE t3
diff --git a/sql/test/BugTracker-2026/Tests/All 
b/sql/test/BugTracker-2026/Tests/All
--- a/sql/test/BugTracker-2026/Tests/All
+++ b/sql/test/BugTracker-2026/Tests/All
@@ -203,3 +203,4 @@ KNOWNFAIL?8025-having-count-bug
 KNOWNFAIL?8026-having-expression-bug
 8027-having-expression-issue
 KNOWNFAIL?8028-coalesce-groupby-rollup-having-bug
+KNOWNFAIL?8030-inner-join-group-by-bug
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to