PostgreSQL error code
PostgreSQL error 42P22
42P22 is the SQLSTATE PostgreSQL reports for indeterminate collation, in class 42, Syntax Error or Access Rule Violation.
| SQLSTATE | 42P22 |
|---|---|
| Condition name | indeterminate_collation |
| Class | 42 — Syntax Error or Access Rule Violation |
Reproduce it, then fix it
The two columns were declared with different collations, and nothing in the query says which to compare with. Add COLLATE to settle it. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.
SELECT a < b FROM labels;
SELECT a < b COLLATE "C" FROM labels;