2200D
PostgreSQLERRORNotableData ExceptionHIGH confidence

invalid escape octet

What this means

SQLSTATE 2200D is raised when an escape sequence in a string literal or pattern contains an invalid octet (byte value) — for example, a backslash escape sequence referencing a byte value outside the valid range.

Why it happens
  1. 1An escape sequence in a pattern or string resolves to an invalid byte value for the current encoding
How to reproduce

Invalid octet in an escape sequence.

expected output

ERROR:  invalid escape octet

Fix

Use valid escape sequences for the target encoding

WHEN When embedding byte sequences in string literals.

Use valid escape sequences for the target encoding
SELECT E'\x41'; -- valid: 'A' in UTF-8

Why this works

Use escape sequences that produce valid byte values for the database encoding.

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