3185
MySQLERRORNotableWindow FunctionsHIGH confidence

Window frame specification is illegal (variant 2)

Production Risk

Low — parse-time error.

Why it happens
  1. 1Frame specification violates a secondary constraint not covered by ER_WINDOW_FRAME_ILLEGAL.
  2. 2Combining GROUPS framing with an incompatible option.
How to reproduce
trigger — this will error
trigger — this will error
SELECT SUM(val) OVER (ORDER BY id GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING EXCLUDE TIES) FROM t1;

expected output

ERROR 3185 (HY000): Window frame specification is illegal.

Fix

Remove incompatible EXCLUDE clause

Remove incompatible EXCLUDE clause
SELECT SUM(val) OVER (ORDER BY id GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM t1;

Why this works

Not all EXCLUDE options are valid in all frame types.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3185 ER_WINDOW_FRAME_ILLEGAL2

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MySQL errors