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

lexer: support more syntaxes regarding 'SET Syntax' #7020

Merged
merged 7 commits into from
Jul 10, 2018

Conversation

qazbnm456
Copy link
Contributor

What have you changed? (mandatory)

I've changed lines of the code of lexer.go in order to support more syntaxes regarding 'SET Syntax', which also fixes #6990.

What are the type of the changes (mandatory)?

Improvement.

How has this PR been tested (mandatory)?

Manual test.

Does this PR affect documentation (docs/docs-cn) update? (optional)

No.

Refer to a related PR or issue link (optional)

#6990

@sre-bot
Copy link
Contributor

sre-bot commented Jul 9, 2018

Hi contributor, thanks for your PR.

This patch needs to be approved by someone of admins. They should reply with "/ok-to-test" to accept this PR for running test automatically.

@jackysp jackysp added the contribution This PR is from a community contributor. label Jul 9, 2018
@shenli
Copy link
Member

shenli commented Jul 9, 2018

@qazbnm456 Thanks!

@shenli
Copy link
Member

shenli commented Jul 9, 2018

/ok-to-test

1 similar comment
@shenli
Copy link
Member

shenli commented Jul 9, 2018

/ok-to-test

@shenli
Copy link
Member

shenli commented Jul 9, 2018

/run-all-tests

@tiancaiamao
Copy link
Contributor

Is there a MySQL document link about it? @qazbnm456

@qazbnm456
Copy link
Contributor Author

qazbnm456 commented Jul 9, 2018

@shenli
Copy link
Member

shenli commented Jul 10, 2018

/run-all-tests

Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

@qazbnm456 thank you for your contribution! Please add some test cases in

func (s *testParserSuite) TestDBAStmt(c *C) {

@qazbnm456
Copy link
Contributor Author

@JackDrogon Added! Thanks.

@tiancaiamao
Copy link
Contributor

tiancaiamao commented Jul 10, 2018

Are they all equal?
@
@''
@""

@``

How about this:

set @ = 3;
select @'';

@qazbnm456

@qazbnm456
Copy link
Contributor Author

qazbnm456 commented Jul 10, 2018

@tiancaiamao

Yes, they're the same in MySQL. Example: http://sqlfiddle.com/#!9/9eecb/46076.
After applying this patch to the master branch of TiDB, it works the same:
image

@tiancaiamao
Copy link
Contributor

I mean, could this PR handle the case, in TiDB

@qazbnm456
Copy link
Contributor Author

@tiancaiamao I just updated my comment with a picture showing that the case would be handled correctly in TiDB.

@tiancaiamao
Copy link
Contributor

LGTM

@tiancaiamao tiancaiamao added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 10, 2018
Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

LGTM

@jackysp
Copy link
Member

jackysp commented Jul 10, 2018

/run-all-tests

@jackysp jackysp added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jul 10, 2018
@jackysp jackysp merged commit fd37061 into pingcap:master Jul 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unsupport single '@' syntax in select statement
6 participants