Changeset: 586c7cbcd69f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/586c7cbcd69f Added Files: sql/test/BugTracker-2026/Tests/7919-correlated-count-distinct-bug.test Modified Files: sql/test/BugTracker-2026/Tests/All Branch: Dec2025 Log Message:
Add test for #7919 diffs (68 lines): diff --git a/sql/test/BugTracker-2026/Tests/7919-correlated-count-distinct-bug.test b/sql/test/BugTracker-2026/Tests/7919-correlated-count-distinct-bug.test new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2026/Tests/7919-correlated-count-distinct-bug.test @@ -0,0 +1,55 @@ +statement ok +CREATE TABLE t_bug9 ( + id INT, + p INT, + ot INT, + v INT, + PRIMARY KEY (id) +) + +statement ok rowcount 6 +INSERT INTO t_bug9 VALUES + (1, -9, 2500, 251), + (2, -9, 2500, -32768), + (3, -9, 2509, 960), + (4, -9, 2509, 975), + (5, -9, 2518, 413), + (7, -9, 2536, -182) + +-- original window query +query I nosort +SELECT v +FROM ( + SELECT v, DENSE_RANK() OVER (PARTITION BY p ORDER BY ot DESC) AS rn + FROM t_bug9 +) x +WHERE rn IN (1, 3, 4) +ORDER BY v +---- +-32768 +-182 +251 +960 +975 + +-- equivalent rewrite +query I nosort +SELECT t1.v +FROM t_bug9 AS t1 +WHERE ( + SELECT COUNT(DISTINCT t2.ot) + FROM t_bug9 AS t2 + WHERE t2.p = t1.p + AND t2.ot > t1.ot +) IN (0, 2, 3) +ORDER BY t1.v +---- +-32768 +-182 +251 +960 +975 + +statement ok +DROP TABLE t_bug9 + 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 @@ -103,3 +103,4 @@ KNOWNFAIL?7774-insert-into-renamed-table 7916-lateral-join-distinct-bug KNOWNFAIL?7917-correlated-count-query-bug KNOWNFAIL?7918-subquery-limit-offset-bug +KNOWNFAIL?7919-correlated-count-distinct-bug _______________________________________________ checkin-list mailing list -- [email protected] To unsubscribe send an email to [email protected]
