3164
MariaDBERRORNotableWindow FunctionsHIGH confidence
Duplicate window name in WINDOW clause
Production Risk
Low — syntax error; easy to fix.
What this means
Two or more named windows in the WINDOW clause have the same name. All window names must be unique within a SELECT statement.
Why it happens
- 1Two WINDOW ... AS (...) definitions using the same window name.
How to reproduce
trigger — this will error
trigger — this will error
SELECT ROW_NUMBER() OVER w FROM t1 WINDOW w AS (ORDER BY id), w AS (PARTITION BY cat);
expected output
ERROR 3164 (42000): Duplicate window name 'w'.
Fix
Give each window a unique name
Give each window a unique name
SELECT ROW_NUMBER() OVER w1 FROM t1 WINDOW w1 AS (ORDER BY id), w2 AS (PARTITION BY cat);
Why this works
Unique names allow both windows to coexist in the WINDOW clause.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 3164 ER_WINDOW_DUPLICATE_NAME
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev