2200C
PostgreSQLERRORNotableData ExceptionHIGH confidence

invalid use of escape character

What this means

SQLSTATE 2200C is raised when an escape character is used in a context where it is not permitted — for example, using an escape clause in a pattern-matching operation that does not support it.

Why it happens
  1. 1Specifying an ESCAPE clause for a SIMILAR TO or other pattern operator that does not accept an escape character in the current context
How to reproduce

Invalid escape character usage in a pattern context.

expected output

ERROR:  invalid use of escape character

Fix

Remove the ESCAPE clause or use it with a supported operator

WHEN When combining ESCAPE with an operator that does not support it.

Why this works

ESCAPE is only valid with LIKE and in some uses of SIMILAR TO. Check the Postgres pattern matching documentation for supported combinations.

Sources
Official documentation ↗

Class 22 — Data Exception

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All PostgreSQL errors