Commit Graph

50 Commits

Author SHA1 Message Date
85c4553c4e planner: chose outer table based on cost when both tables are specified in TIDB_INLJ (#9579) 2019-03-08 13:25:44 +08:00
e7ff050a45 planner, executor: support SQL show pump/drainer status (#9456) 2019-03-04 15:39:54 +08:00
4f232e5c8d executor: add CREATE ROLE support (#9461) 2019-03-01 10:07:28 +08:00
45f9d6a00f statistics: compute and store column order correlation with handle (#9315) 2019-02-27 11:32:00 +08:00
aabd330d1e *: support "show create user" (#9240) 2019-02-21 13:58:19 +08:00
b845f2a4da executor, planner: support show create view (#9309) 2019-02-19 10:18:57 +08:00
d09e0e36b8 planner, privileges: add CreateViewPriv Support (#9153) 2019-02-15 17:11:40 +08:00
4ad4684da1 privilege,planner: handle View's security privilege check (#9194) 2019-02-12 10:35:18 +08:00
54b6de0880 planner: improve error messages for mysql compat (#9112)
SHOW CREATE TABLE
CREATE USER
DROP USER
2019-01-18 20:58:46 +08:00
572ad80e23 planner: set correct mysql error code (#9095) 2019-01-17 15:01:03 +08:00
47ea05d017 executor,planner: adjust the result of 'admin show ddl' (#9020) 2019-01-16 18:02:55 +08:00
365264cd21 ddl: add restore deleted table (#7937) 2019-01-16 15:37:33 +08:00
dca815c1c5 expression: return error when doing ResolveIndices (#8929) 2019-01-15 14:34:06 +08:00
e6a0eb9246 executor: support "show create table" for View (#8865) 2019-01-15 13:31:22 +08:00
4b98ad6f29 *: integrate plugin framework with TiDB (#9006) 2019-01-14 16:53:41 +08:00
9f346a3add planner, executor: return err when INSERT/UPDATE/ANALYZE/DELETE a view (#8848) 2019-01-14 15:47:48 +08:00
23c1946d21 planner/core: support named window (#8937) 2019-01-07 15:35:57 +08:00
081a2c5ccc planner, privilege: check user priv on SET GLOBAL (#8837)
* planner, privilege: check user priv on SET GLOBAL
2019-01-04 19:32:10 -07:00
7ee6811d97 planner: added support for error in visitInfo (#8855) 2019-01-04 15:15:18 +08:00
e0b30fe9ba planner,executor: support show create database if not exists syntax (#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-->

https://github.com/pingcap/parser/issues/147
https://github.com/pingcap/parser/pull/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 -->
2019-01-04 13:31:05 +08:00
91cdbf2f54 planner: support window function (#8630) 2019-01-03 16:56:06 +08:00
32cfaf1dcc builder: use empty db should return NoDB error (#8908) 2019-01-03 13:39:36 +08:00
fe01b1674e planner: privilege check ANALYZE TABLE stmt (#8486) 2018-12-28 11:10:35 +08:00
df55d3815d executor,planner: fix 'show master status' output (#8737) 2018-12-18 22:13:14 +08:00
4e8c424718 *: basic support for CREATE_VIEW (#8571) 2018-12-18 20:17:27 +08:00
6e2d6c7aa7 ddl: fix cancel drop index error (#8504) 2018-12-07 23:29:23 +08:00
3128e9b98a *: Hide "Mem" column from SHOW PROCESSSLIST (#8543) 2018-12-05 11:42:58 +08:00
3b68ee59a6 planner: for UNION statements, ORDER BY cannot use column references including a table name (#8389) 2018-11-29 12:40:08 +08:00
0ac0e154d9 planner, executor: fix PREPARE FROM @var_name (#8437) 2018-11-27 11:00:41 +08:00
7a88c33a67 executor,planner: Improve SET PASSWORD (#8426) 2018-11-26 22:19:51 +08:00
7ab61d85ce executor: improve SHOW commands compatibility (#8417) 2018-11-26 20:39:56 +08:00
6fb260f8a6 *: redesign trace statement with json output (#8357) 2018-11-21 13:50:18 +08:00
3e0e7d5a69 plan: support subquery in Do statement (#8343) 2018-11-20 14:10:24 +08:00
f3a9745e2c executor: support for "admin show next_row_id" (#8242) 2018-11-09 22:08:42 +08:00
29f14d4178 *: change default charset and collation from 'utf8 utf8_bin' to 'utf8mb4 utf8mb4_bin' (#7965) 2018-11-09 16:32:21 +08:00
32b1dbd8d5 *: rename "github.com/pkg/errors" to "github.com/pingcap/errors" (#8136)
We import "github.com/pkg/errors" in the code, and actually put
the "github.com/pingcap/errors" there in the vendor path.
That's a dirty hack, and prevent the introduce of Go module.
2018-11-01 16:09:07 +08:00
9ec7515743 *: Add few error checks in tests, clean error messages and fix a misspell (#8101) 2018-10-31 18:50:43 +08:00
a6123eaf62 *: Change privilege to use Auth* identity (#7954) 2018-10-29 20:01:31 +08:00
f370da0b43 planner: export init() to Init() (#8060) 2018-10-26 10:44:30 +08:00
89dda9d9a8 *: move parser to a separate repository (#8036) 2018-10-25 11:12:10 +08:00
cc1da16878 stats: support show stats for partition table (#8023) 2018-10-24 15:49:01 +08:00
1434fa9b89 admin: refine admin check decoder (#7862) 2018-10-23 17:55:58 +08:00
25118db843 *: move ast.NewValueExpr to standalone parser_driver package (#7952)
Make the ast package get rid of the dependency of types.Datum
2018-10-19 19:37:55 +08:00
458c0d1c27 executor: refine explain analyze (#7888) 2018-10-16 20:02:43 +08:00
de6b582729 plan: fix panic caused by empty schema of LogicalTableDual (#7906)
* fix drop view if exist error (#7833)
2018-10-16 19:14:55 +08:00
7229b32a25 *: support auto analyze partition table (#7789) 2018-10-12 20:57:59 +08:00
d21f294393 *: make explain support explain anaylze (#7827) 2018-10-12 20:01:19 +08:00
dbdd806c0e *: add session variable "tidb_enable_cascades_planner" (#7879) 2018-10-12 13:21:51 +08:00
081920da93 planner,executor: support admin show slow command (#7785) 2018-09-26 19:28:53 +08:00
e79bd946ed *: change package name from plan to planner (#7760) 2018-09-25 11:16:39 +08:00