Changeset: b8a4e98b7c76 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b8a4e98b7c76
Added Files:
        sql/test/BugTracker-2026/Tests/7902-sum-case-and-bug.test
Modified Files:
        sql/test/BugTracker-2026/Tests/All
Branch: Dec2025
Log Message:

Add missing test for #7902


diffs (107 lines):

diff --git a/sql/test/BugTracker-2026/Tests/7902-sum-case-and-bug.test 
b/sql/test/BugTracker-2026/Tests/7902-sum-case-and-bug.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2026/Tests/7902-sum-case-and-bug.test
@@ -0,0 +1,91 @@
+statement ok
+CREATE SCHEMA s7902
+
+statement ok
+SET SCHEMA s7902
+
+statement ok
+CREATE TABLE users (
+    id           INT,
+    username     VARCHAR(100),
+    email        VARCHAR(255),
+    age          INT,
+    status       VARCHAR(20),
+    created_at   TIMESTAMP,
+    score        DOUBLE
+)
+
+statement ok
+CREATE TABLE posts (
+    id          INT,
+    user_id     INT,
+    title       VARCHAR(255),
+    content     VARCHAR(1000),
+    views       INT,
+    likes       INT,
+    created_at  TIMESTAMP,
+    rating      DOUBLE
+)
+
+statement ok rowcount 5
+INSERT INTO users VALUES
+(1, 'alice', '[email protected]', 20, 'active',  '2022-01-01 10:00:00', 88.5),
+(2, 'bob',   '[email protected]',   30, 'active',  '2022-01-02 11:00:00', 92.3),
+(3, 'carol', NULL,             NULL, 'banned','2022-01-03 12:00:00', NULL),
+(4, 'dave',  '[email protected]',  45, 'active',  '2022-01-04 13:00:00', 65.2),
+(5, NULL,    '[email protected]',  18, 'inactive','2022-01-05 14:00:00', 70.0)
+
+statement ok rowcount 5
+INSERT INTO posts VALUES
+(1, 1, 'Hello World', 'First post', 100, 10, '2022-01-10 10:00:00', 4.5),
+(2, 1, 'Another Post', NULL,        150, 20, '2022-01-11 11:00:00', 3.0),
+(3, 2, 'Bob Post',     'Content',   NULL,  5, '2022-01-12 12:00:00', NULL),
+(4, 3, NULL,           'Empty',     50,   2, '2022-01-13 13:00:00', 5.0),
+(5, 4, 'Last Post',    'Last',      300,  30,'2022-01-14 14:00:00', 4.9)
+
+-- RESULT: {0}
+query I
+select count(*)
+from
+  (select
+        ref_0.user_id as c0,
+        ref_1.status as c1,
+        ref_1.username as c2
+      from
+        posts as ref_0
+          inner join users as ref_1
+          on (52.47 > 27.26)
+      where true) as subq_0
+where ((4 >= ascii(rtrim('1ve')))
+  and (subq_0.c2 is not NULL))
+----
+0
+
+-- RESULT was: {20} wrong!
+query I
+select sum(case when ((4 >= ascii(rtrim('1ve')))
+  and (subq_0.c2 is not NULL)) then 1 else 0 end + 0)
+from
+  (select
+        ref_0.user_id as c0,
+        ref_1.status as c1,
+        ref_1.username as c2
+      from
+        posts as ref_0
+          inner join users as ref_1
+          on (true)
+      where true) as subq_0
+----
+0
+
+statement ok
+DROP TABLE users
+
+statement ok
+DROP TABLE posts
+
+statement ok
+SET SCHEMA sys
+
+statement ok
+DROP SCHEMA s7902
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
@@ -98,6 +98,7 @@ KNOWNFAIL?7774-insert-into-renamed-table
 7899-correlated-with-complex-and-or
 7900-semijoin-inconsistency-bug
 7901-sum-case-and-or-bug
+7902-sum-case-and-bug
 7903-query-without-result-bug
 7905-sum-case-subquery-bug
 7906-rel2bin_join-assertion-failure
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to