dolthub / dolthub/dolt

using hex string as bindvar for decimal type column in prepared statement causes panic

Closed
#4,989 0 comments 0 reactions 1 assignee Claimed by @zachmu View on GitHub
bug panic
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 8h
Merged PRs (30d)
120

Description

Repro enginetest:
```
{
Name: "simple decimal type insert",
SetUpScript: []string{
"CREATE TABLE test(id int primary key auto_increment, decimal_col DECIMAL(9,2))",
},
Assertions: []queries.ScriptTestAssertion{
{
Query: "INSERT INTO test(decimal_col) VALUES (?)",
Bindings: map[string]sql.Expression{
"v1": expression.NewLiteral([]byte("X'10'"), sql.MustCreateString(sqltypes.VarBinary, 4, sql.Collation_binary)),
},
Expected: []sql.Row{
{sql.OkResult{RowsAffected: 1, InsertID: 1}},
},
},
},
},
```

Using Literal of `X'10'` with `VarBinary` type is because most types are handled as `VarBinary` in https://github.com/dolthub/vitess/blob/main/go/mysql/query.go#L842 when we get parse the bindvars, so the hex string is handled the same way as any other string values.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.