cockroachdb / cockroachdb/cockroach
sql/sem/tree: tuple pretty print generates invalid sql if tuple only has one element
Open
branch-master
branch-release-24.3
C-bug
O-community
T-sql-foundations
X-blathers-triaged
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
When using the tree package to generate SQL for tests using tuples, they generate incorrect SQL statements if the tuple only has one element.
As an example, the following
```go
&tree.Tuple{
Exprs: []tree.Expr{
tree.NewStrVal("val1"),
},
}
```
Is incorrectly mapped to `('val1',)` instead of `('val1')`.
Because of the extra `,`, sql parsers fail to parse the input.
Jira issue: CRDB-44797
Epic CRDB-60820
Contributor guide
Assessment
This issue has not been assessed yet.