cockroachdb / cockroachdb/cockroach
sql: include column name into the error when possible
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
Have a nice day, everyone!
I’ve encountered an error in a query that says the length of a string value exceeds the allowed length in a column.
```
sh-4.4# ./cockroach sql --insecure
root@localhost:26257/defaultdb> use test;
root@localhost:26257/test> update "LegalData" set "legalId"='1234567890123' where id=1;
ERROR: value too long for type STRING(12)
SQLSTATE: 22001
```
To determine the location of the error, I do not have enough information in the error text.
I tried to find a description of my problem in the documentation, but without success.
So, question. How to identify the problem column in the text of the error message? Is it possible to expand the description of the error?
I am working with CRDB version 22.2.3 inside a Docker container:
```
sh-4.4# ./cockroach --version
cockroach version details:
Build Tag: v22.2.3
Build Time: 2023/01/23 19:38:24
Distribution: CCL
Platform: linux arm64 (aarch64-unknown-linux-gnu)
Go Version: go1.19.1
C Compiler: gcc 6.5.0
Build Commit ID: 81a114c2bc2ef8ef76fe3809d0469319c7e82635
Build Type: release
```
Jira issue: CRDB-24548
Contributor guide
Research direction
Start by reproducing the reported UPDATE against a STRING(12) column and trace CockroachDB's SQL error handling for the value-too-long error. Done means the error identifies the column name when that information is available, while preserving the existing error and SQLSTATE behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100