Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parser: fix LOCK clause error message #516

Merged
merged 2 commits into from
Aug 23, 2019
Merged

Conversation

lauhg
Copy link
Contributor

@lauhg lauhg commented Aug 22, 2019

What problem does this PR solve?

Fix compatibility problem about LOCK syntax

Issue: #508

MySQL Syntax:

alter_lock_option:
          LOCK_SYM opt_equal alter_lock_option_value { $$= $3; }
        ;

alter_lock_option_value:
          DEFAULT_SYM
          {
            $$= Alter_info::ALTER_TABLE_LOCK_DEFAULT;
          }
        | ident
          {
            if (is_identifier($1, "NONE"))
              $$= Alter_info::ALTER_TABLE_LOCK_NONE;
            else if (is_identifier($1, "SHARED"))
              $$= Alter_info::ALTER_TABLE_LOCK_SHARED;
            else if (is_identifier($1, "EXCLUSIVE"))
              $$= Alter_info::ALTER_TABLE_LOCK_EXCLUSIVE;
            else
            {
              my_error(ER_UNKNOWN_ALTER_LOCK, MYF(0), $1.str);
              MYSQL_YYABORT;
            }
          }
        ;

Bad SQL Case:

alter table t lock = first
alter table t lock = start
alter table t lock = commit
alter table t lock = binlog

Check List

Tests

  • Unit test

@codecov
Copy link

codecov bot commented Aug 22, 2019

Codecov Report

Merging #516 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #516   +/-   ##
=======================================
  Coverage   71.61%   71.61%           
=======================================
  Files          32       32           
  Lines        7736     7736           
=======================================
  Hits         5540     5540           
  Misses       1671     1671           
  Partials      525      525
Impacted Files Coverage Δ
parser.go 70.58% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 641eaa1...56a137c. Read the comment docs.

@codecov
Copy link

codecov bot commented Aug 22, 2019

Codecov Report

Merging #516 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #516   +/-   ##
=======================================
  Coverage   71.59%   71.59%           
=======================================
  Files          32       32           
  Lines        7723     7723           
=======================================
  Hits         5529     5529           
  Misses       1670     1670           
  Partials      524      524
Impacted Files Coverage Δ
parser.go 70.58% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e2490d9...3e545f2. Read the comment docs.

parser.y Show resolved Hide resolved
@zier-one
Copy link
Contributor

LGTM

@zier-one zier-one added the status/LGT1 LGT1 label Aug 22, 2019
Copy link
Contributor

@tangenta tangenta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zier-one zier-one merged commit ccb5a46 into pingcap:master Aug 23, 2019
tiancaiamao pushed a commit to tiancaiamao/parser that referenced this pull request Apr 27, 2021
lyonzhi pushed a commit to lyonzhi/parser that referenced this pull request Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants