PostgreSQL error code
PostgreSQL error 22025
22025 is the SQLSTATE PostgreSQL reports for invalid escape sequence, in class 22, Data Exception.
| SQLSTATE | 22025 |
|---|---|
| Condition name | invalid_escape_sequence |
| Class | 22 — Data Exception |
Reproduce it, then fix it
In a LIKE pattern a backslash escapes the next character, so a pattern can’t end with one. Double it to match a literal backslash, or choose another escape character with ESCAPE. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.
SELECT 'C:\' LIKE 'C:\';
SELECT 'C:\' LIKE 'C:\\';