3174
MySQLWARNINGCriticalWindow FunctionsHIGH confidence

Window function ignores frame specification

Production Risk

Low — warning only; the frame is ignored and results are correct for these functions.

What this means

A window function that does not use a frame (such as ROW_NUMBER(), RANK(), DENSE_RANK(), LEAD(), LAG()) was given a frame clause (ROWS/RANGE BETWEEN). The frame is silently ignored and the function uses its built-in behaviour.

Why it happens
  1. 1Specifying ROWS BETWEEN or RANGE BETWEEN for a window function that is inherently frame-unaware.
How to reproduce
trigger — this will error
trigger — this will error
SELECT ROW_NUMBER() OVER (ORDER BY id ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) FROM t1;

expected output

Warning (Code 3174): Window function 'row_number' ignores the frame clause.

Fix

Remove the frame clause

Remove the frame clause
SELECT ROW_NUMBER() OVER (ORDER BY id) FROM t1;

Why this works

ROW_NUMBER and rank functions do not use frames; removing the clause clarifies intent and avoids the warning.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3174 ER_WINDOW_FUNCTION_IGNORES_FRAME

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

← All MySQL errors