Skip to content

Correctly propagate error #64183

@jfrabaute-arista

Description

@jfrabaute-arista

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    contributionThis PR is from a community contributor.first-time-contributorIndicates that the PR was contributed by an external member and is a first-time contributor.type/bugThe issue is confirmed as a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions