{"action":"created","issue":{"url":"https://api.github.com/repos/pingcap/tidb/issues/8926","repository_url":"https://api.github.com/repos/pingcap/tidb","labels_url":"https://api.github.com/repos/pingcap/tidb/issues/8926/labels{/name}","comments_url":"https://api.github.com/repos/pingcap/tidb/issues/8926/comments","events_url":"https://api.github.com/repos/pingcap/tidb/issues/8926/events","html_url":"https://github.com/pingcap/tidb/pull/8926","id":395517282,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQxOTUxNDI1","number":8926,"title":"planner,executor: support `show create database if not exists` syntax","user":{"login":"lonng","id":1638682,"node_id":"MDQ6VXNlcjE2Mzg2ODI=","avatar_url":"https://avatars3.githubusercontent.com/u/1638682?v=4","gravatar_id":"","url":"https://api.github.com/users/lonng","html_url":"https://github.com/lonng","followers_url":"https://api.github.com/users/lonng/followers","following_url":"https://api.github.com/users/lonng/following{/other_user}","gists_url":"https://api.github.com/users/lonng/gists{/gist_id}","starred_url":"https://api.github.com/users/lonng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lonng/subscriptions","organizations_url":"https://api.github.com/users/lonng/orgs","repos_url":"https://api.github.com/users/lonng/repos","events_url":"https://api.github.com/users/lonng/events{/privacy}","received_events_url":"https://api.github.com/users/lonng/received_events","type":"User","site_admin":false},"labels":[{"id":970807266,"node_id":"MDU6TGFiZWw5NzA4MDcyNjY=","url":"https://api.github.com/repos/pingcap/tidb/labels/component/executor","name":"component/executor","color":"000000","default":false},{"id":667671533,"node_id":"MDU6TGFiZWw2Njc2NzE1MzM=","url":"https://api.github.com/repos/pingcap/tidb/labels/component/planner","name":"component/planner","color":"1d76db","default":false},{"id":564600738,"node_id":"MDU6TGFiZWw1NjQ2MDA3Mzg=","url":"https://api.github.com/repos/pingcap/tidb/labels/status/LGT2","name":"status/LGT2","color":"5319e7","default":false},{"id":541179553,"node_id":"MDU6TGFiZWw1NDExNzk1NTM=","url":"https://api.github.com/repos/pingcap/tidb/labels/type/compatibility","name":"type/compatibility","color":"e99695","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2019-01-03T10:11:49Z","updated_at":"2019-01-04T04:53:40Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/pingcap/tidb/pulls/8926","html_url":"https://github.com/pingcap/tidb/pull/8926","diff_url":"https://github.com/pingcap/tidb/pull/8926.diff","patch_url":"https://github.com/pingcap/tidb/pull/8926.patch"},"body":"<!--\r\nThank you for contributing to TiDB! Please read TiDB's [CONTRIBUTING](https://github.com/pingcap/tidb/blob/master/CONTRIBUTING.md) document **BEFORE** filing this PR.\r\n-->\r\n\r\n### What problem does this PR solve? <!--add issue link with summary if exists-->\r\n\r\nhttps://github.com/pingcap/parser/issues/147\r\nhttps://github.com/pingcap/parser/pull/148\r\n\r\nMySQL compatibility: `show create database if not exists` syntax\r\n\r\nSee: https://dev.mysql.com/doc/refman/5.7/en/show-create-database.html\r\n\r\nMySQL\r\n\r\n```\r\nMariaDB [(none)]> show create database b2;\r\n+----------+----------------------------------------------------------------+\r\n| Database | Create Database                                                |\r\n+----------+----------------------------------------------------------------+\r\n| b2       | CREATE DATABASE `b2` /*!40100 DEFAULT CHARACTER SET utf8mb4 */ |\r\n+----------+----------------------------------------------------------------+\r\n1 row in set (0.002 sec)\r\n\r\nMariaDB [(none)]> show create database if not exists b2;\r\n+----------+-----------------------------------------------------------------------------------------+\r\n| Database | Create Database                                                                         |\r\n+----------+-----------------------------------------------------------------------------------------+\r\n| b2       | CREATE DATABASE /*!32312 IF NOT EXISTS*/ `b2` /*!40100 DEFAULT CHARACTER SET utf8mb4 */ |\r\n+----------+-----------------------------------------------------------------------------------------+\r\n1 row in set (0.000 sec)\r\n```\r\n\r\nTiDB\r\n```\r\nMySQL [b1]> show create batabase b2;\r\nERROR 1105 (HY000): line 1 column 20 near \" b2\" (total length 23)\r\nMySQL [b1]> show create database b2;\r\n+----------+-----------------------------------------------------------------+\r\n| Database | Create Database                                                 |\r\n+----------+-----------------------------------------------------------------+\r\n| b2       | CREATE DATABASE `b2` /* !40100 DEFAULT CHARACTER SET utf8mb4 */ |\r\n+----------+-----------------------------------------------------------------+\r\n1 row in set (0.000 sec)\r\n\r\nMySQL [b1]> show create database if not exists b2;\r\nERROR 1105 (HY000): line 1 column 23 near \" not exists b2\" (total length 37)\r\n```\r\n\r\n### What is changed and how it works?\r\n\r\nInsert `/*!32312 IF NOT EXISTS*/` before shema name when statement contains `if not exists`\r\n\r\n### Check List <!--REMOVE the items that are not applicable-->\r\n\r\nTests <!-- At least one of them must be included. -->\r\n\r\n - Unit test\r\n\r\nCode changes\r\n\r\nSide effects\r\n\r\nRelated changes\r\n\r\n - Need to cherry-pick to the release branch\r\n\r\n<!-- Reviewable:start -->\r\n---\r\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/pingcap/tidb/8926)\r\n<!-- Reviewable:end -->\r\n"},"comment":{"url":"https://api.github.com/repos/pingcap/tidb/issues/comments/451353317","html_url":"https://github.com/pingcap/tidb/pull/8926#issuecomment-451353317","issue_url":"https://api.github.com/repos/pingcap/tidb/issues/8926","id":451353317,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MTM1MzMxNw==","user":{"login":"codecov-io","id":8655789,"node_id":"MDQ6VXNlcjg2NTU3ODk=","avatar_url":"https://avatars0.githubusercontent.com/u/8655789?v=4","gravatar_id":"","url":"https://api.github.com/users/codecov-io","html_url":"https://github.com/codecov-io","followers_url":"https://api.github.com/users/codecov-io/followers","following_url":"https://api.github.com/users/codecov-io/following{/other_user}","gists_url":"https://api.github.com/users/codecov-io/gists{/gist_id}","starred_url":"https://api.github.com/users/codecov-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codecov-io/subscriptions","organizations_url":"https://api.github.com/users/codecov-io/orgs","repos_url":"https://api.github.com/users/codecov-io/repos","events_url":"https://api.github.com/users/codecov-io/events{/privacy}","received_events_url":"https://api.github.com/users/codecov-io/received_events","type":"User","site_admin":false},"created_at":"2019-01-04T04:53:40Z","updated_at":"2019-01-04T04:53:40Z","author_association":"NONE","body":"# [Codecov](https://codecov.io/gh/pingcap/tidb/pull/8926?src=pr&el=h1) Report\n> Merging [#8926](https://codecov.io/gh/pingcap/tidb/pull/8926?src=pr&el=desc) into [master](https://codecov.io/gh/pingcap/tidb/commit/6d098d4ff6ca83e86c718ab95fdfe9b7837f0d47?src=pr&el=desc) will **increase** coverage by `0.01%`.\n> The diff coverage is `28.57%`.\n\n[![Impacted file tree graph](https://codecov.io/gh/pingcap/tidb/pull/8926/graphs/tree.svg?width=650&token=dxdS5cZfmW&height=150&src=pr)](https://codecov.io/gh/pingcap/tidb/pull/8926?src=pr&el=tree)\n\n```diff\n@@            Coverage Diff             @@\n##           master    #8926      +/-   ##\n==========================================\n+ Coverage   67.52%   67.54%   +0.01%     \n==========================================\n  Files         363      363              \n  Lines       74928    74989      +61     \n==========================================\n+ Hits        50593    50649      +56     \n- Misses      19877    19880       +3     \n- Partials     4458     4460       +2\n```\n\n\n| [Impacted Files](https://codecov.io/gh/pingcap/tidb/pull/8926?src=pr&el=tree) | Coverage Δ | |\n|---|---|---|\n| [planner/core/common\\_plans.go](https://codecov.io/gh/pingcap/tidb/pull/8926/diff?src=pr&el=tree#diff-cGxhbm5lci9jb3JlL2NvbW1vbl9wbGFucy5nbw==) | `60.98% <ø> (ø)` | :arrow_up: |\n| [executor/show.go](https://codecov.io/gh/pingcap/tidb/pull/8926/diff?src=pr&el=tree#diff-ZXhlY3V0b3Ivc2hvdy5nbw==) | `40.85% <0%> (-0.2%)` | :arrow_down: |\n| [planner/core/planbuilder.go](https://codecov.io/gh/pingcap/tidb/pull/8926/diff?src=pr&el=tree#diff-cGxhbm5lci9jb3JlL3BsYW5idWlsZGVyLmdv) | `48.68% <100%> (+0.04%)` | :arrow_up: |\n| [executor/builder.go](https://codecov.io/gh/pingcap/tidb/pull/8926/diff?src=pr&el=tree#diff-ZXhlY3V0b3IvYnVpbGRlci5nbw==) | `82.77% <100%> (+0.01%)` | :arrow_up: |\n| [util/systimemon/systime\\_mon.go](https://codecov.io/gh/pingcap/tidb/pull/8926/diff?src=pr&el=tree#diff-dXRpbC9zeXN0aW1lbW9uL3N5c3RpbWVfbW9uLmdv) | `80% <0%> (-20%)` | :arrow_down: |\n| [ddl/delete\\_range.go](https://codecov.io/gh/pingcap/tidb/pull/8926/diff?src=pr&el=tree#diff-ZGRsL2RlbGV0ZV9yYW5nZS5nbw==) | `74.28% <0%> (-4.58%)` | :arrow_down: |\n| [infoschema/builder.go](https://codecov.io/gh/pingcap/tidb/pull/8926/diff?src=pr&el=tree#diff-aW5mb3NjaGVtYS9idWlsZGVyLmdv) | `75.74% <0%> (+0.99%)` | :arrow_up: |\n| [executor/join.go](https://codecov.io/gh/pingcap/tidb/pull/8926/diff?src=pr&el=tree#diff-ZXhlY3V0b3Ivam9pbi5nbw==) | `78.6% <0%> (+1.27%)` | :arrow_up: |\n| [infoschema/infoschema.go](https://codecov.io/gh/pingcap/tidb/pull/8926/diff?src=pr&el=tree#diff-aW5mb3NjaGVtYS9pbmZvc2NoZW1hLmdv) | `79.57% <0%> (+1.4%)` | :arrow_up: |\n| [infoschema/tables.go](https://codecov.io/gh/pingcap/tidb/pull/8926/diff?src=pr&el=tree#diff-aW5mb3NjaGVtYS90YWJsZXMuZ28=) | `52.32% <0%> (+3.8%)` | :arrow_up: |\n\n------\n\n[Continue to review full report at Codecov](https://codecov.io/gh/pingcap/tidb/pull/8926?src=pr&el=continue).\n> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)\n> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`\n> Powered by [Codecov](https://codecov.io/gh/pingcap/tidb/pull/8926?src=pr&el=footer). Last update [6d098d4...18ffe2e](https://codecov.io/gh/pingcap/tidb/pull/8926?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).\n"}}
{"actor":{"display_login":"codecov-io"}}