PostgreSQL 22001: Value Too Long for Column Type
Writing a longer description ends with a 22001 error instead of creating a record. The varchar(n) column has a length limit which may be less than the actual content of the form.
How to determine the source of the error
Compare the length of the sent value with the column definition in the database scheme.
Check that the API does not add an additional prefix or JSON to the short text field.
What to do step by step
1. If the field stores a full description, consider the text type and validation of the business limit at application level.
2 . If the limit is intentional, show the character counter in the form and validate the length on the server side.
How to check the score
Longer, acceptable text is saved, and the superlimit gets a clear validation message.
What to do
Do not cut customer data quietly without informing the user.