Commit Graph

67 Commits

Author SHA1 Message Date
612dd14fd4 planner/core: fix unexpected error of window function (#9567) 2019-03-11 21:10:23 +08:00
9891b3d546 executor, types: update tests for the description format of type year (#9253) 2019-03-11 15:56:58 +08:00
d672477ef5 *: upgrade to go 1.12 (#9299) 2019-03-09 15:37:37 +08:00
4188ae19c0 log,server: add contextual log util & test it in conn.go (#9548) 2019-03-09 11:23:45 +08:00
3910a720df *: add assertion in kvproto to check data consistency (#9180) 2019-03-08 16:49:31 +08:00
a9caa792b1 ddl_test: fix the wrong test (#9610) 2019-03-08 10:45:47 +08:00
b3ccefcec2 docs: change all the MySQL version from 5.7.10 to 5.7.25 (#9553) 2019-03-07 21:27:43 +08:00
c00846001d *: update go-proxyprotocol version (#9583) 2019-03-07 19:07:01 +08:00
4f232e5c8d executor: add CREATE ROLE support (#9461) 2019-03-01 10:07:28 +08:00
d60b3ff512 ddl: don't modify a column charset when the table's version is TableInfoVersion1 (#9480) 2019-02-27 16:29:27 +08:00
0ee8899a6d session,privilege: upgrade TiDB, prepare data for RBAC (#9377)
RBAC(role based access control) needs the following data:
* Add account_locked column to mysql.user
* Add mysql.role_edges table
* Add mysql.default_roles table
* Add Create_role_priv and Drop_role_priv privilege
2019-02-22 18:00:01 +08:00
dec3ab6358 ddl: support alter algorithm INPLACE/INSTANT (#8811) 2019-02-20 10:22:26 +08:00
f7dc9157e2 Push down condition check to TiKV for prewrite request (#9127) 2019-02-19 19:45:41 +08:00
40fa006cac *: collect coprocessor runtime stats for explain analyze (#9057) 2019-02-19 16:22:00 +08:00
84d1513b09 plugin: support flush tidb plugin {name} in tidb-server (#9320) 2019-02-18 13:48:43 +08:00
6136ab14cf *: start replacing logger with zap logger (#9279) 2019-02-15 16:43:47 +08:00
de56ea67e4 store/tikv/region_cache: Backoff when region epoch is ahead of TiKV (#9181)
Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
2019-02-14 15:02:30 +08:00
c190de3d04 server: add test for OPTIONALLY keyword (#9200) 2019-02-12 15:37:44 +08:00
469fa877d6 util/hack: define a MutableString type for function hack.String (#9230) 2019-02-12 12:30:40 +08:00
c8727a97cd binlog: update pumps client && open log (#9163) 2019-01-24 14:33:47 +08:00
36176be874 *: improve syntax error code & message compatibility (#9103) 2019-01-23 10:46:29 +08:00
0fdc526b42 planner: support window function frame clause (#9004) 2019-01-18 16:46:54 +08:00
b339c02831 planner,expression: use constraint propagation in partition pruning (#8885) 2019-01-17 11:09:41 +08:00
365264cd21 ddl: add restore deleted table (#7937) 2019-01-16 15:37:33 +08:00
3c98f69266 *: support select partition for partition table (#8990) 2019-01-14 20:55:52 +08:00
f20c849857 types: support sql_mode ALLOW_INVALID_DATES (#9027) 2019-01-14 19:34:22 +08:00
319656c407 tikvclient: support to batch grpc message to TiKVs (#8986) 2019-01-14 13:59:15 +08:00
e1381b41e8 plugin: introduce plugin framework (#8788) 2019-01-14 10:08:50 +08:00
bb2d56ab73 parser: add SHOW CREATE USER syntax (#8970) 2019-01-09 11:21:30 +08:00
c68ee73183 gomod: update tidb-tools version (#8945) 2019-01-08 20:33:36 +08:00
971629b947 parser: update parser version (#8973) 2019-01-08 13:39:34 +08:00
39e1dfe4c2 parser: better error message #133 (#8950) 2019-01-07 12:14:46 +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
b8b3a7fc78 ddl: fix can't cancel a job when add index meets panic (#8621) 2019-01-02 17:38:44 +08:00
c385cbdcca parser: fix subquery hint panic (#8781) 2018-12-25 14:27:13 +08:00
eeab17d612 *: update the package of check (#8778) 2018-12-24 21:25:46 +08:00
0021af671f *: remove retool from Makefile (#8769) 2018-12-24 20:28:45 +08:00
20a468d558 store/tikv: Add endKey support for RawScan (#8602)
Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
2018-12-21 19:27:58 +08:00
94df8d1e30 *: ignore unknown hint and return warning instead of return a parser error (#8685) 2018-12-21 13:44:54 +08:00
44f2c2c381 Makefile: make 'make check' faster (#8755)
* remove vet check
* make lint check on $(FILES)
2018-12-21 11:12:18 +08:00
2f54639f14 add binlog socket config for compatible with kafka version pump (#8732) 2018-12-19 13:23:14 +08:00
9c087d13ee *: replace github.com/etcd-io/gofail with the forked one (#8693)
With the adoption of Go module, GOPATH is not need any more
But github.com/etcd-io/gofail doesn't support packages outside the GOPATH
To overcome the drawback, this commit replace it with our forked one
2018-12-19 11:30:48 +08:00
7056bb0d32 executor, session: refine insert unsigned bigint autoIncreID (#8181) 2018-12-18 23:01:10 +08:00
096bb68e6b types: implement new Restore func of ValueExpr (#8679) 2018-12-17 15:07:41 +08:00
db2127a0dd ddl: split tests to speed up tests (#8612)
* ddl: add the db_partition_test
2018-12-13 15:06:04 +08:00
64cd9b246f planner,types: refactor the PR #8619 by using parser/types/FieldType.Clone() (#8641) 2018-12-12 10:23:57 +08:00
e03ef6099c ddl: support alter table .. truncate partition (#8624) 2018-12-11 13:52:57 +08:00
f597d1884d go mod: update the parser version (#8632) 2018-12-10 16:11:58 +08:00
1d7d01cfe8 ddl: support altering the other charset to utf8 or utf8mb4 (#8037) 2018-12-10 12:58:18 +08:00