pingcap / pingcap/tidb

Correctly propagate error

Open
#64,183 1 comment 0 reactions 0 assignees View on GitHub
contribution first-time-contributor sig/sql-infra type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

The `pkg/parser/ast/dml.go` file has some functions where the returned error is not checked and the error is not bubbled up when calling "Restore()" method

There are 3 calls to `` where this happens:

https://github.com/pingcap/tidb/blob/master/pkg/parser/ast/dml.go#L3456
https://github.com/pingcap/tidb/blob/master/pkg/parser/ast/dml.go#L3463
https://github.com/pingcap/tidb/blob/master/pkg/parser/ast/dml.go#L3525

This was discovered when implementing custom types (Not using `parser_driver` or `test_driver`) and the Restore method implementation of either the ValueExpr or the ParamMarkerExpr was returning an error.
I this case, Restore was still returning `nil` and the generated string from Restore call was an invalid SQL query.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.