Seaquel
PostgreSQL error code

PostgreSQL error 2201W

2201W is the SQLSTATE PostgreSQL reports for invalid row count in limit clause, in class 22, Data Exception.

SQLSTATE2201W
Condition nameinvalid_row_count_in_limit_clause
Class22 — Data Exception

Reproduce it, then fix it

LIMIT can be zero or NULL but not negative. SQLite reads LIMIT -1 as “no limit”; in PostgreSQL write LIMIT ALL or leave the clause out. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.

SELECT name FROM products ORDER BY name LIMIT -1;
SELECT name FROM products ORDER BY name LIMIT ALL;

Source: PostgreSQL documentation, Appendix A