Error
Error Code:
3588
MySQL Error 3588: Window RANGE Frame Temporal ORDER BY
Description
This error occurs in MySQL window functions when a `RANGE` frame clause is used, and the `ORDER BY` expression within the window definition is of a `DATETIME`, `TIMESTAMP`, or `DATE` type. MySQL requires `INTERVAL` expressions for the frame bounds (e.g., `INTERVAL '5' MINUTE PRECEDING`) when `ORDER BY` is a temporal type for `RANGE` frames, and detects non-compliant bound values.
Error Message
Window '%s' with RANGE frame has ORDER BY expression of datetime type. Only INTERVAL bound value allowed.
Known Causes
3 known causesTemporal ORDER BY with RANGE Frame
Using a `DATETIME`, `TIMESTAMP`, or `DATE` column in the `ORDER BY` clause of a window function that also employs a `RANGE` frame.
Non-INTERVAL Frame Bound
Specifying a non-`INTERVAL` expression (e.g., a numeric literal or column reference) for the frame bounds of a `RANGE` clause when the `ORDER BY` column is a temporal type.
Incorrect Frame Type Selection
Choosing a `RANGE` frame where a `ROWS` frame or a different approach would be more suitable for the desired windowing logic, especially with temporal ordering.
Solutions
Coming SoonGeneral Troubleshooting Tips
- Check the error message carefully for specific details
- Review recent changes that might have caused the error
- Search for the exact error code in the official documentation
- Check log files for additional context
- Try restarting the application or service