awslabs / awslabs/amazon-redshift-utils
SystemTablePersistence - Value too long for character type error
- Dominant language
- Python
- Stars
- 2.8k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Hello team,
I'm getting the following error when I execute the SystemTablePersistence lambda utility:
ERROR] ProgrammingError: {'S': 'ERROR', 'C': 'XX000', 'M': 'Value too long for character type', 'D': '\n -----------------------------------------------\n error: Value too long for character type\n code: 8001\n context: Value too long for type character(30)\n query: 213818\n location: string.cpp:213\n process: query0_113_213818 [pid=25354]\n -----------------------------------------------\n', 'F': '../src/sys/xen_execute.cpp', 'L': '12414', 'R': 'pg_throw'}
Traceback (most recent call last):
File "/var/task/lambda_function.py", line 148, in event_handler
snapshot_system_stats.snapshot([config, os.environ])
File "/var/task/lib/SystemTablePersistence/snapshot_system_stats.py", line 247, in snapshot
insert_rowcounts = snapshot_system_tables(cursor, conn, table_config)
File "/var/task/lib/SystemTablePersistence/snapshot_system_stats.py", line 98, in snapshot_system_tables
cursor.execute(stmt)
File "/var/task/lib/redshift_connector/cursor.py", line 231, in execute
self._c.execute(self, operation, args)
File "/var/task/lib/redshift_connector/core.py", line 1800, in execute
self.handle_messages(cursor)
File "/var/task/lib/redshift_connector/core.py", line 1986, in handle_messages
raise self.error
**Solution:**
And the solution is to increase the size of the field "label" in [here ](https://github.com/awslabs/amazon-redshift-utils/blob/8085eeb48036ad236325adfe40c63425dd3cf2f1/src/SystemTablePersistence/lib/history_table_creation.sql#L14)
In my case the values were between 30 to 50 but I made it CHAR(100) for the moment.
Contributor guide
Research direction
Start with src/SystemTablePersistence/lib/history_table_creation.sql at the label field referenced in the report, then trace its use from lib/SystemTablePersistence/snapshot_system_stats.py. Reproduce the SystemTablePersistence snapshot if possible and verify that label values in the reported range are stored without the character-length error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100