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 CHARACTER VARYING syntax #465

Merged
merged 5 commits into from
Aug 13, 2019

Conversation

lauhg
Copy link
Contributor

@lauhg lauhg commented Aug 12, 2019

What problem does this PR solve?

Fix compatibility problem about CHARACTER VARYING syntax

Issue: #410

MySQL Syntax:

type:
...
  | CHAR_SYM field_length opt_charset_with_opt_binary
  | CHAR_SYM opt_charset_with_opt_binary
  | nchar field_length opt_bin_mod
  | nchar opt_bin_mod
  | varchar field_length opt_charset_with_opt_binary
  | nvarchar field_length opt_bin_mod

Bad SQL Case:

create table t (a character varying(1));
create table t (a character varying(255));
create table t (a char varying(255));
create table t (a character);

create table t (a nchar);
create table t (a nchar varchar(50));
create table t (a nchar varying(50));

create table t (a national character varying(50));
create table t (a national char varying(50));

Check List

Tests

  • Unit test

@CLAassistant
Copy link

CLAassistant commented Aug 12, 2019

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Aug 12, 2019

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #465   +/-   ##
=======================================
  Coverage   71.09%   71.09%           
=======================================
  Files          32       32           
  Lines        7534     7534           
=======================================
  Hits         5356     5356           
  Misses       1662     1662           
  Partials      516      516
Impacted Files Coverage Δ
parser.go 70.58% <ø> (ø) ⬆️
misc.go 96.42% <ø> (ø) ⬆️

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 1619718...641a193. Read the comment docs.

@codecov
Copy link

codecov bot commented Aug 12, 2019

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #465   +/-   ##
=======================================
  Coverage   71.09%   71.09%           
=======================================
  Files          32       32           
  Lines        7534     7534           
=======================================
  Hits         5356     5356           
  Misses       1662     1662           
  Partials      516      516
Impacted Files Coverage Δ
parser.go 70.58% <ø> (ø) ⬆️
misc.go 96.42% <ø> (ø) ⬆️

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 1619718...e37a50f. Read the comment docs.

@lauhg lauhg changed the title Character varying syntax parser: fix character varying syntax Aug 12, 2019
@lauhg lauhg changed the title parser: fix character varying syntax parser: fix CHARACTER VARYING syntax Aug 12, 2019
@zier-one
Copy link
Contributor

LGTM

@zier-one
Copy link
Contributor

@tangenta
PTAL

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.

@lauhg Thank you for your contribution! Please address the comments below.

parser.y Outdated Show resolved Hide resolved
parser_test.go Show resolved Hide resolved
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 added status/LGT2 LGT2 and removed status/LGT1 LGT1 labels Aug 13, 2019
@zier-one zier-one merged commit f5a55e3 into pingcap:master Aug 13, 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