Changeset: 45633a1afc68 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/45633a1afc68
Added Files:
        sql/test/BugTracker-2026/Tests/7850-assertion-failure.test
Modified Files:
        sql/test/BugTracker-2026/Tests/All
Branch: Dec2025
Log Message:

Add test for #7850


diffs (165 lines):

diff --git a/sql/test/BugTracker-2026/Tests/7850-assertion-failure.test 
b/sql/test/BugTracker-2026/Tests/7850-assertion-failure.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2026/Tests/7850-assertion-failure.test
@@ -0,0 +1,152 @@
+statement ok
+CREATE SCHEMA test7850
+
+statement ok
+SET SCHEMA test7850
+
+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 triggers assertion failure in rel2bin_select (be=0x7f58581a61b0, 
rel=0x7f5858272d80, refs=0x7f58582832d0) at sql/backends/monet5/rel_bin.c:4959
+query I rowsort
+SELECT 1
+FROM
+    comments AS ref_0,
+    LATERAL (
+        SELECT
+            ref_0.post_id AS c0,
+            CASE WHEN '832O' <= '0Le' THEN ref_5.age ELSE (SELECT id FROM 
orders LIMIT 1 OFFSET 4) END AS c3,
+            ref_6.likes AS c4,
+            ref_7.email AS c7
+        FROM
+            users AS ref_1
+            RIGHT JOIN orders AS ref_3
+                ON true
+            INNER JOIN users AS ref_5
+            INNER JOIN posts AS ref_6
+                ON true
+            LEFT JOIN users AS ref_7
+                ON true
+                ON true
+        WHERE
+            (SELECT created_at FROM comments LIMIT 1 OFFSET 2) IS NOT NULL
+    ) AS subq_0
+WHERE
+    (subq_0.c0 >= subq_0.c3)
+    OR
+    (
+        0
+        >=
+        CASE
+            WHEN ref_0.id IS NOT NULL
+            THEN
+                CASE
+                    WHEN (53.54 < (SELECT avg(id) FROM posts))
+                    THEN CASE WHEN true AND false THEN lpad('NwVKf', 
ref_0.post_id) ELSE '0' END
+                    ELSE coalesce(
+                            CASE
+                                WHEN (subq_0.c4 < ref_0.id)
+                                     OR EXISTS (
+                                            SELECT 1
+                                            FROM users AS ref_8
+                                            WHERE subq_0.c7 IS NOT NULL
+                                        )
+                                THEN 'U'
+                                ELSE 'Qo5zf7'
+                            END,
+                            'jl'
+                         )
+                END
+            ELSE '8wf'
+        END
+    )
+----
+
+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 test7850
+
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
@@ -52,3 +52,4 @@ KNOWNFAIL?7846-do_covariance_and_correla
 KNOWNFAIL?7847-assertion-failure
 KNOWNFAIL?7848-assertion-failure
 KNOWNFAIL?7849-assertion-failure
+KNOWNFAIL?7850-assertion-failure
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to