-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
We are using CloudSQL (PostgreSQL) as our database for sessions. Sometimes, when an error in an agent occurs (usually a MALFORMED FUNCTION and input containing JSON data), it causes an exception when inserting data into the DB.
This is the error
sqlalchemy.exc.ProgrammingError: (pg8000.dbapi.ProgrammingError) {'S': 'ERROR', 'V': 'ERROR', 'C': '22001', 'M': 'value too long for type character varying(1024)', 'F': 'varchar.c', 'L': '640', 'R': 'varchar'}
The issue is with the 'Events' table and the column/field 'error_message', which has a length of 1024.
| error_message: Mapped[str] = mapped_column(String(1024), nullable=True) |
The fix in the code (for initial table creation) would be to change the type of the error_message column to Text type.
For existing tables, this would also mean changing the column type on the database level.
I don't know if there would be other implications of this change.