Commit Graph

2212 Commits

Author SHA1 Message Date
b552bf8b98 Log duration using seconds instead of the default Duration.String(). It would help the log collector to parse the duration. (#9015) 2019-01-11 13:17:42 +08:00
a9de2093e5 util/codec, types: add new method to get comparable hash key from MyDecimal (#8930) 2019-01-11 11:01:15 +08:00
8b4c998815 executor: separate RadixHashJoinExec from HashJoinExec (#8979) 2019-01-10 20:11:43 +08:00
68ddb7f0e6 *: fix the lower bound when converting numbers less than 0 to unsigned integers (#8544) 2019-01-10 16:04:07 +08:00
858b200e9a variable: remove tidb_ddl_reorg_worker_cnt and tidb_ddl_reorg_batch_size session level. (#8941) 2019-01-10 15:12:22 +08:00
021f7538bb sessionctx/variable: fix select variable return wrong result when variable is only global scope variable (#8968) 2019-01-08 15:46:53 +08:00
a81e312fbc executor: support parallel building hash table for radixHashJoin (#8927) 2019-01-08 14:59:44 +08:00
884db0ab3d types: fix the incorrect behavior of "%y"/"%Y" for STR_TO_DATE() (#8517) 2019-01-08 12:37:30 +08:00
106bc7efc6 executor: return error if autoid overflows shard bits. (#8936) 2019-01-08 12:19:35 +08:00
39e1dfe4c2 parser: better error message #133 (#8950) 2019-01-07 12:14:46 +08:00
084aa5a030 config: add initChunkSize config item, make chunk start with 32 (#8480) 2019-01-07 11:14:47 +08:00
78a51a4626 executor: support "show columns from" for view (#8863) 2019-01-05 21:32:32 +08:00
0c75c43010 fix typo (#8943) 2019-01-05 09:05:52 +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
cef6e75be8 infoschema: add initial support for views (#8892) 2019-01-04 12:32:48 +08:00
e646276f4b planner,executor: basic support for DROP_VIEW (#8758) 2019-01-04 10:53:02 +08:00
243120c473 planner, executor: add post-process after physical plan optimization and move buildProjBelowAgg from executor to planner (#8828) 2019-01-03 16:26:59 +08:00
32cfaf1dcc builder: use empty db should return NoDB error (#8908) 2019-01-03 13:39:36 +08:00
18d75a30ae executor: support parallel partition for HashJoinExec (#7911) 2019-01-03 13:17:45 +08:00
386f8e3b7a planner: update generated column inside a transaction should return error (#8909) 2019-01-03 11:01:02 +08:00
b3698f6670 executor: fix panic and update error data when table has column in write only state (#8792) 2019-01-02 15:49:39 +08:00
e06c87d3c1 add an option for AddRecord and Create (#8884) 2019-01-02 11:30:53 +08:00
0e89c02ffb *: clean up code for insert/update statement (#8867) 2018-12-29 18:46:47 +08:00
7a966426ee metric: replace QueryDurationHistogram's "general" type to more detail stmt type (#8819) 2018-12-29 13:10:30 +08:00
e7301865a1 executor: show full tables support view (#8860) 2018-12-28 20:04:23 +08:00
71088815e7 executor: refine HashAgg.Close when unparallelExec (#8810) 2018-12-27 17:14:04 +08:00
ffd9ba6659 gc_worker: Remove timezone name from the times that are saved in mysql.tidb (#8745)
Signed-off-by: MyonKeminta <MyonKeminta@users.noreply.github.com>
2018-12-27 12:16:18 +08:00
93e91b6a37 executor/test: fix data race of executor unit tests (#8807) 2018-12-27 11:28:55 +08:00
123aba282c planner: support building data source from View (#8757) 2018-12-26 14:22:26 +08:00
7ffdbcad6c executor: add test case for execute prepare_stmt using binary protocol (#8825) 2018-12-26 13:49:03 +08:00
a1a4e8197d Revert "executor/show: show create table return utf8mb4 charset. (#8604) (#8782) 2018-12-26 09:54:50 +08:00
90b619a452 planner/core: add support for nested virtual generated columns (#8659) 2018-12-25 21:59:04 +08:00
3040788655 *: make errcheck work again (#8795) 2018-12-25 17:16:52 +08:00
bd69b15e79 *: add the error check (#8770) 2018-12-24 22:22:00 +08:00
98b96cc769 executor: speedup unit tests by spliting them into separate suites (#8618) 2018-12-24 21:37:12 +08:00
ef7082da1c ddl, executor: fix rename table compatibility (#8709) 2018-12-22 22:19:41 +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
a7907ede7a *: remove fail field from TxnState (#8712)
Originally, `fail` is added to simplify error handling, avoiding large changes on
the Txn() interface API. But it turns out that `fail` becomes the root of many bugs.
So this commit remove the `fail` and make an API refactory.
2018-12-20 16:36:12 +08:00
29c17a1eb9 planner/core: correct column name with unary plus sign (#8702) 2018-12-19 23:35:43 +08:00
1c4d2d9890 table: check non-BMP characters and return error when the charset is utf8 and sql mode is strict mode (#8738) 2018-12-19 17:52:47 +08:00
18b2a7884b admin: only check public index (#8748) 2018-12-19 17:05:07 +08:00
7528a059cf executor/server/session: add extra info message sent to mysql client (#8285) 2018-12-19 15:32:49 +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
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
4899ce5e92 ddl: add error check in ddlCtx.buildDescTableScan (#8726) 2018-12-18 14:47:23 +08:00
8a6b965a8b executor: accelerate unit test TestTSOFail (#8717) 2018-12-18 14:15:47 +08:00
2088cafaca types: restore the field length of a string typed parameter value to the original one (#8656) 2018-12-14 15:39:38 +08:00