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 IF NOT EXISTS support for MariaDB ADD PARTITION syntax #455

Merged
merged 2 commits into from
Aug 10, 2019

Conversation

spongedu
Copy link
Contributor

What problem does this PR solve?

#337 support IF NOT EXISTS option forADD PARTITION syntax in MaraiDB 10.0.2+, but not complete. the same support for ADD PARTITION PARTITIONS NUM syntax is missing.
For example, we have a table defined as follows:

 CREATE TABLE `t2` (
  `name` varchar(30) DEFAULT NULL,
  `started` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
PARTITION BY HASH( year(`started`) )
PARTITIONS 6 

in MaraiDB 10.0.2+, the following statement is ok :

MariaDB [test]> alter table t2 add partition if not exists partitions 2;
Query OK, 0 rows affected (0.11 sec)

while for now, this sql failed in parser:

tidb> alter table t2 add partition if not exists partitions 2;
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 li
ne 1 column 53 near "partitions 2" 

What is changed and how it works?

Add IfNotExists option for the corresponding branch for ADD PARTITION syntax in parser.y.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

Code changes

N/A

Side effects

N/A

@codecov
Copy link

codecov bot commented Aug 10, 2019

Codecov Report

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

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #455   +/-   ##
=====================================
  Coverage      71%    71%           
=====================================
  Files          32     32           
  Lines        7522   7522           
=====================================
  Hits         5341   5341           
  Misses       1665   1665           
  Partials      516    516
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 97f7d47...f6f56ed. Read the comment docs.

@spongedu
Copy link
Contributor Author

@csuzhangxc PTAL

Copy link
Member

@csuzhangxc csuzhangxc left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@kennytm kennytm left a comment

Choose a reason for hiding this comment

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

LGTM

@kennytm kennytm added status/LGT2 LGT2 and removed status/LGT1 LGT1 labels Aug 10, 2019
@kennytm kennytm merged commit c86da06 into pingcap:master Aug 10, 2019
tiancaiamao pushed a commit to tiancaiamao/parser that referenced this pull request Apr 27, 2021
pingcap#455)

* parser: fix  support for MariaDB  syntax

* ADD parser.go
lyonzhi pushed a commit to lyonzhi/parser that referenced this pull request Apr 25, 2024
pingcap#455)

* parser: fix  support for MariaDB  syntax

* ADD parser.go
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