Correctly propagate error

Open Beginner friendly
#64,183 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
go
Domain
databases

Research direction

Start in pkg/parser/ast/dml.go at the Restore calls around lines 3456, 3463, and 3525. Inspect how errors from ValueExpr or ParamMarkerExpr Restore implementations are handled, then verify that those errors are returned instead of producing a successful result with invalid SQL. Run the relevant parser AST tests if available.

Written by the indexing model from the issue text.

Description

contribution first-time-contributor sig/sql-infra type/bug

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.

Dominant language
Go
Stars
40.6k
Forks
6.2k
Avg merge
3d 3h
Merged PRs (30d)
168

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pingcap/tidb

All issues in pingcap/tidb

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.