Changeset: e302a4e84cc5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e302a4e84cc5
Added Files:
        sql/test/BugTracker-2026/Tests/7837-crash.test
Modified Files:
        sql/test/BugTracker-2026/Tests/All
Branch: Dec2025
Log Message:

Add test for #7837


diffs (201 lines):

diff --git a/sql/test/BugTracker-2026/Tests/7837-crash.test 
b/sql/test/BugTracker-2026/Tests/7837-crash.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2026/Tests/7837-crash.test
@@ -0,0 +1,188 @@
+statement ok
+CREATE SCHEMA test7837
+
+statement ok
+SET SCHEMA test7837
+
+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
+CREATE TABLE comments (
+    id          INT,
+    post_id     INT,
+    user_id     INT,
+    content     VARCHAR(1000),
+    is_spam     INT,
+    created_at  TIMESTAMP
+)
+
+statement ok
+CREATE TABLE orders (
+    id          INT,
+    user_id     INT,
+    amount      DOUBLE,
+    status      VARCHAR(20),
+    created_at  TIMESTAMP
+)
+
+statement ok
+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
+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)
+
+statement ok
+INSERT INTO comments VALUES
+(1, 1, 2, 'Nice post', 0, '2022-01-20 10:00:00'),
+(2, 1, 3, 'Spam here', 1,  '2022-01-21 11:00:00'),
+(3, 2, 1, 'Thanks',    0, '2022-01-22 12:00:00'),
+(4, 4, 5, NULL,        0, '2022-01-23 13:00:00')
+
+statement ok
+INSERT INTO orders VALUES
+(1, 1, 100.00, 'paid',    '2022-02-01 09:00:00'),
+(2, 1, 200.50, 'shipped', '2022-02-02 10:00:00'),
+(3, 2, NULL,   'failed',  '2022-02-03 11:00:00'),
+(4, 3, 50.00,  'paid',    '2022-02-04 12:00:00'),
+(5, 5, 999.99, 'paid',    '2022-02-05 13:00:00')
+
+query T
+select
+  nullif(subq_1.c0,
+    null) as c0
+from
+  posts as ref_0,
+  lateral (select
+        ref_2.title as c0,
+        ref_2.created_at as c1,
+        ref_0.rating as c2,
+        ref_2.rating as c3,
+        ref_1.content as c4,
+        subq_0.c0 as c5,
+        77 as c6,
+        case when EXISTS (
+            select
+                ref_9.user_id as c0,
+                ref_4.created_at as c1,
+                subq_0.c0 as c2,
+                ref_1.id as c3
+              from
+                orders as ref_9
+              where (select avg(id) from posts)
+                   >= 69.10) then ref_2.created_at else (select created_at 
from orders limit 1 offset 2)
+             end
+           as c7
+      from
+        posts as ref_1
+            inner join posts as ref_2
+                inner join comments as ref_3
+                on (ref_2.content is not NULL)
+              inner join comments as ref_4
+                inner join comments as ref_5
+                on (ref_5.post_id <> ref_5.id)
+              on (false)
+            on ((select created_at from comments limit 1 offset 3)
+                   is NULL)
+          inner join orders as ref_6
+          on (('c' <> 'tzD')
+              or ((true)
+                or (57 < (select id from orders limit 1 offset 5)
+                    ))),
+        lateral (select
+              ref_2.created_at as c0
+            from
+              orders as ref_7
+                inner join comments as ref_8
+                on (true)
+            where ref_0.likes < (select id from posts limit 1 offset 6)
+            limit 181) as subq_0
+      where 1.1111111 <= 1.1111111
+      limit 106) as subq_1
+where 99.97 = coalesce(case when coalesce(coalesce('L',
+            'm'),
+          'PLmA9') > coalesce('FYpEbd',
+          case when (true)
+              and (false) then 'Vy' else 'Zr' end
+            ) then abs(
+        case when true OR true then case when 'xVD' <> 'AiuU' then 12.38 else 
(select stddev_samp(id) from posts)
+               end
+             else 15.31 end
+          ) else log(
+        19.46) end
+      ,
+    (select var_samp(id) from comments)
+      )
+limit 140
+----
+
+query I
+select 1
+from posts ref_0,
+lateral (
+  select
+    case
+      when EXISTS ( select 1 from orders where (select avg(id) from posts) >= 
69.10)
+      then ref_1.created_at
+      else (select created_at from orders limit 1)
+    end as c7
+  from posts ref_1
+    inner join orders ref_6
+      on 57 < (select id from orders limit 1),
+  lateral (
+    select ref_1.created_at
+    from orders
+    where ref_0.likes < (select id from posts limit 1)
+    limit 1
+  ) subq_0
+) subq_1
+----
+
+statement ok
+DROP TABLE orders
+
+statement ok
+DROP TABLE comments
+
+statement ok
+DROP TABLE posts
+
+statement ok
+DROP TABLE users
+
+statement ok
+SET SCHEMA sys
+
+statement ok
+DROP SCHEMA test7837
+
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
@@ -40,3 +40,4 @@ KNOWNFAIL?7833-assertion-failure
 7834-BATsubcross-more-than-one-match
 7835-strcmp-NULL-crash
 7836-use-after-free
+7837-crash
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to