3269
MariaDBERRORNotableWindow FunctionsHIGH confidence

RANGE frame is not compatible with this ORDER BY type

Production Risk

Low — query is rejected; restructure the window definition.

How to reproduce
trigger — this will error
trigger — this will error
SELECT SUM(amount) OVER (ORDER BY category RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING) FROM sales;

expected output

ERROR 3269 (HY000): Window 'w': RANGE frame is not applicable to column type.

Fix

Switch to ROWS frame

Switch to ROWS frame
SELECT SUM(amount) OVER (ORDER BY category ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) FROM sales;

Why this works

ROWS frames work with any ORDER BY type including strings and enums.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3269 ER_WINDOW_RANGE_FRAME_IMPOSSIBLE_ROWTYPE2

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

← All MariaDB errors