-
Notifications
You must be signed in to change notification settings - Fork 490
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: support show create database if not exists
syntax
#148
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/run-all-tests |
winkyao
reviewed
Jan 3, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@crazycs520 PTAL |
crazycs520
approved these changes
Jan 3, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
lonng
added a commit
to pingcap/tidb
that referenced
this pull request
Jan 4, 2019
…#8926) <!-- Thank you for contributing to TiDB! Please read TiDB's [CONTRIBUTING](https://github.com/pingcap/tidb/blob/master/CONTRIBUTING.md) document **BEFORE** filing this PR. --> ### What problem does this PR solve? <!--add issue link with summary if exists--> pingcap/parser#147 pingcap/parser#148 MySQL compatibility: `show create database if not exists` syntax See: https://dev.mysql.com/doc/refman/5.7/en/show-create-database.html MySQL ``` MariaDB [(none)]> show create database b2; +----------+----------------------------------------------------------------+ | Database | Create Database | +----------+----------------------------------------------------------------+ | b2 | CREATE DATABASE `b2` /*!40100 DEFAULT CHARACTER SET utf8mb4 */ | +----------+----------------------------------------------------------------+ 1 row in set (0.002 sec) MariaDB [(none)]> show create database if not exists b2; +----------+-----------------------------------------------------------------------------------------+ | Database | Create Database | +----------+-----------------------------------------------------------------------------------------+ | b2 | CREATE DATABASE /*!32312 IF NOT EXISTS*/ `b2` /*!40100 DEFAULT CHARACTER SET utf8mb4 */ | +----------+-----------------------------------------------------------------------------------------+ 1 row in set (0.000 sec) ``` TiDB ``` MySQL [b1]> show create batabase b2; ERROR 1105 (HY000): line 1 column 20 near " b2" (total length 23) MySQL [b1]> show create database b2; +----------+-----------------------------------------------------------------+ | Database | Create Database | +----------+-----------------------------------------------------------------+ | b2 | CREATE DATABASE `b2` /* !40100 DEFAULT CHARACTER SET utf8mb4 */ | +----------+-----------------------------------------------------------------+ 1 row in set (0.000 sec) MySQL [b1]> show create database if not exists b2; ERROR 1105 (HY000): line 1 column 23 near " not exists b2" (total length 37) ``` ### What is changed and how it works? Insert `/*!32312 IF NOT EXISTS*/` before shema name when statement contains `if not exists` ### Check List <!--REMOVE the items that are not applicable--> Tests <!-- At least one of them must be included. --> - Unit test Code changes Side effects Related changes - Need to cherry-pick to the release branch <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/pingcap/tidb/8926) <!-- Reviewable:end -->
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Via: #147
See: https://dev.mysql.com/doc/refman/5.7/en/show-create-database.html