pingcap / parser

A MySQL Compatible SQL Parser
Apache License 2.0
1.41k stars 489 forks source link

parser: support 'binary' symbol in set statements #1335

Closed tangenta closed 3 years ago

tangenta commented 3 years ago

What problem does this PR solve?

Using BINARY in SET statements gets a syntax error because it is a keyword.

mysql> set @@character_set_results = binary;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 36 near ""

MySQL handled this problem by adding a rule:

https://github.com/mysql/mysql-server/blob/beb865a960b9a8a16cf999c323e46c5b0c67f21f/sql/sql_yacc.yy#L15902

What is changed and how it works?

Add a rule for SetExpr.

Check List

Tests

Code changes

NA

Side effects

NA

Related changes

NA

ti-chi-bot commented 3 years ago

[REVIEW NOTIFICATION]

This pull request has been approved by:

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment. After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review. Reviewer can cancel approval by submitting a request changes review.
xiongjiwei commented 3 years ago

/merge

ti-chi-bot commented 3 years ago

This pull request has been accepted and is ready to merge.

Commit hash: 039d8c58db8ea7b011037a06ab872142e8b0ff77