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

*: add IF EXISTS and IF NOT EXISTS supported for MariaDB #337

Merged
merged 7 commits into from
Jun 13, 2019

Conversation

csuzhangxc
Copy link
Member

@csuzhangxc csuzhangxc commented May 23, 2019

What problem does this PR solve?

for MaraiDB 10.0.2+, ALTER TABLE support IF EXISTS and IF NOT EXISTS clauses for some statements, and CREATE INDEX also support IF NOT EXISTS.

see https://mariadb.com/kb/en/library/alter-table/ and https://mariadb.com/kb/en/library/create-index/

What is changed and how it works?

  1. add IF EXISTS for
    1. DROP COLUMN
    2. CHANGE COLUMN
    3. MODIFY COLUMN
    4. DROP INDEX
    5. DROP FOREIGN KEY
    6. DROP PARTITION
  2. add IF NOT EXISTS for
    1. ADD COLUMN
    2. ADD INDEX
    3. ADD FOREIGN KEY
    4. CREATE INDEX
    5. ADD PARTITION

Check List

Tests

  • Unit test

Corresponding TiDB PR: pingcap/tidb#10723

@CLAassistant
Copy link

CLAassistant commented May 23, 2019

CLA assistant check
All committers have signed the CLA.

@codecov

This comment has been minimized.

@codecov

This comment has been minimized.

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 the status/LGT1 LGT1 label May 29, 2019
@kennytm
Copy link
Contributor

kennytm commented May 29, 2019

@csuzhangxc Is there a corresponding TiDB PR? Otherwise supporting these in the parser level would be misleading.

@csuzhangxc
Copy link
Member Author

@csuzhangxc Is there a corresponding TiDB PR? Otherwise supporting these in the parser level would be misleading.

@kennytm not yet, but I'll open one.

@tiancaiamao
Copy link
Collaborator

LGTM @winkyao

@tiancaiamao tiancaiamao added status/LGT2 LGT2 and removed status/LGT1 LGT1 labels May 31, 2019
@csuzhangxc
Copy link
Member Author

@kennytm @tiancaiamao PTAL again

I also add:

  • IF NOT EXISTS for ADD PARTITION
  • IF EXISTS for DROP PARTITION

kennytm
kennytm previously approved these changes Jun 2, 2019
@winkyao
Copy link
Contributor

winkyao commented Jun 10, 2019

@csuzhangxc Just parse it and ignore it?

winkyao
winkyao previously approved these changes Jun 10, 2019
Copy link
Contributor

@winkyao winkyao left a comment

Choose a reason for hiding this comment

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

LGTM

@tiancaiamao
Copy link
Collaborator

Would you like to update parser.go, please? @csuzhangxc

…ists

# Conflicts:
#	ast/ddl.go
#	parser.go
#	parser.y
#	parser_test.go
@csuzhangxc csuzhangxc dismissed stale reviews from winkyao and kennytm via 1b79df9 June 12, 2019 07:30
@csuzhangxc
Copy link
Member Author

Would you like to update parser.go, please? @csuzhangxc

@tiancaiamao updated and resolved the conflicts.

@tiancaiamao tiancaiamao merged commit d2cf607 into pingcap:master Jun 13, 2019
@csuzhangxc csuzhangxc deleted the alter_if_exists branch June 13, 2019 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants