Seaquel
PostgreSQL error code

PostgreSQL error 22008

22008 is the SQLSTATE PostgreSQL reports for datetime field overflow, in class 22, Data Exception.

SQLSTATE22008
Condition namedatetime_field_overflow
Class22 — Data Exception

Reproduce it, then fix it

February 2024 has 29 days. PostgreSQL rejects an impossible date instead of rolling it over into March, so compare against the first day of the next month. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.

SELECT id, created_at
FROM orders
WHERE created_at < '2024-02-30';
SELECT id, created_at
FROM orders
WHERE created_at < '2024-03-01';

Source: PostgreSQL documentation, Appendix A