Seaquel
PostgreSQL error code

PostgreSQL error 22001

22001 is the SQLSTATE PostgreSQL reports for string data right truncation, in class 22, Data Exception.

SQLSTATE22001
Condition namestring_data_right_truncation
Class22 — Data Exception

Reproduce it, then fix it

country is varchar(2). PostgreSQL rejects a longer value instead of cutting it short, as MySQL does outside strict mode. Store the two-letter code, or widen the column. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.

UPDATE customers SET country = 'USA' WHERE id = 1 RETURNING *;
UPDATE customers SET country = 'US' WHERE id = 1 RETURNING *;

Source: PostgreSQL documentation, Appendix A