UPDATE incorrectly permits a windowed target-table subquery
Author: Yibo-DongCreated Aug 11, 2026Updated Sep 30, 2026
Labelsbugsqlgood reprocustomer issuecorrectness
What happened
Dolt exhibits this behavior: UPDATE incorrectly permits a target-table subquery containing a window expression.
Environment
Dolt main commit 59fb843bf6a4b653d7c8b6d997a603b10cf279d9 (dolt version 2.2.3).
How to reproduce
CREATE TABLE t(i INT PRIMARY KEY, j INT, k INT);
INSERT INTO t VALUES (1,2,3),(2,3,4);
UPDATE t
SET k = 30
WHERE i IN (SELECT FIRST_VALUE(i) OVER () FROM t WHERE j = 2);
SELECT i,j,k FROM t ORDER BY i;Expected result
MySQL 8.0.43 fresh run:
ERROR 1093 (HY000) at line 3: You can't specify target table 't' for update in FROM clauseMySQL rejects this statement with ERROR 1093 (HY000): You can't specify target table 't' for update in FROM clause; the target table is read directly by the windowed subquery.
Actual result
Dolt executes the update and returns:
i j k
1 2 30
2 3 4Source: dolthub/dolt