Dolt merges two different window operands whose qualified-column strings collide
Author: Yibo-DongCreated Sep 15, 2026Updated Sep 16, 2026
Labelsbugsqlgood reprocustomer issuecorrectness
What happened
For a legal query containing two aggregate windows, Dolt treats two different resolved columns as the same window expression and returns the first sum twice.
Environment
Dolt main (commit 92baa5e78afd013b42a62d21b05da0481031e8d0). MySQL version 8.0.43.
How to reproduce
Run the corresponding SQL in a fresh Dolt repository.
CREATE TABLE t(id INT PRIMARY KEY, `a.b` INT);
CREATE TABLE u(id INT PRIMARY KEY, b INT);
INSERT INTO t VALUES (1,10),(2,20);
INSERT INTO u VALUES (1,100),(2,200);
SELECT t.id,
SUM(t.`a.b`) OVER () AS s1,
SUM(`t.a`.b) OVER () AS s2
FROM t
JOIN u AS `t.a` ON t.id = `t.a`.id
ORDER BY t.id;Expected Result
The exact SQL above was run against MySQL 8.0.43. MySQL returned:
1 30 300
2 30 300t.\a.b`and`t.a`.b` are different resolved columns, so their sums are independently 30 and 300.
Dolt actual
Dolt returned:
1 30 30
2 30 30Source: dolthub/dolt