Changeset: a866b69d6cfc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a866b69d6cfc
Added Files:
        sql/test/BugTracker-2026/Tests/7963-having-sum-or-exists-or-sum-bug.test
Modified Files:
        sql/test/BugTracker-2026/Tests/All
Branch: Dec2025
Log Message:

Add test for #7963


diffs (88 lines):

diff --git 
a/sql/test/BugTracker-2026/Tests/7963-having-sum-or-exists-or-sum-bug.test 
b/sql/test/BugTracker-2026/Tests/7963-having-sum-or-exists-or-sum-bug.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2026/Tests/7963-having-sum-or-exists-or-sum-bug.test
@@ -0,0 +1,75 @@
+statement ok
+CREATE TABLE rift_min_a (
+  g INT,
+  x INT
+)
+
+statement ok
+CREATE TABLE rift_min_b (
+  y INT
+)
+
+statement ok
+INSERT INTO rift_min_a VALUES
+  (1, 10),
+  (1, 20),
+  (2, 100)
+
+statement ok
+INSERT INTO rift_min_b VALUES
+  (1)
+
+-- Control query 1: succeeds.
+query II rowsort
+SELECT SUM(x) AS s, g
+FROM rift_min_a
+GROUP BY g
+HAVING EXISTS(SELECT 1 FROM rift_min_b) OR SUM(x) < 81
+----
+100
+2
+30
+1
+
+-- Control query 2: succeeds.
+query II rowsort
+SELECT SUM(x) AS s, g
+FROM rift_min_a
+GROUP BY g
+HAVING SUM(x) < 81 OR EXISTS(SELECT 1 FROM rift_min_b)
+----
+100
+2
+30
+1
+
+-- Control query 3: succeeds but returns 1 row less
+query II rowsort
+SELECT SUM(x) AS s, g
+FROM rift_min_a
+GROUP BY g
+HAVING SUM(x) < 81 OR SUM(x) < 81
+----
+100
+2
+30
+1
+
+-- Failing query: should also be valid, but MonetDB rejects it.
+query II rowsort
+SELECT SUM(x) AS s, g
+FROM rift_min_a
+GROUP BY g
+HAVING SUM(x) < 81 OR EXISTS(SELECT 1 FROM rift_min_b) OR SUM(x) < 81
+----
+100
+2
+30
+1
+
+statement ok
+DROP TABLE IF EXISTS rift_min_b
+
+statement ok
+DROP TABLE IF EXISTS rift_min_a
+
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
@@ -146,3 +146,4 @@ KNOWNFAIL?7957-tail_type-crash
 7959-double-function-destroy
 7960-isLikeOp-crash
 KNOWNFAIL?7961-list_empty-crash
+KNOWNFAIL?7963-having-sum-or-exists-or-sum-bug
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to