Seaquel
PostgreSQL error code

PostgreSQL error 22P02

22P02 is the SQLSTATE PostgreSQL reports for invalid text representation, in class 22, Data Exception.

SQLSTATE22P02
Condition nameinvalid_text_representation
Class22 — Data Exception

Reproduce it, then fix it

These are the queries from the guide below. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.

SELECT id, status, total_amount
FROM demo.orders
WHERE customer_id = 'alice@example.com';
SELECT o.id, o.status, o.total_amount
FROM demo.orders o
JOIN demo.customers c ON c.id = o.customer_id
WHERE c.email = 'alice@example.com';

How to fix it

In other databases

Source: PostgreSQL documentation, Appendix A