Commit Graph

1833 Commits

Author SHA1 Message Date
63936cc1fa ddl: resolve the charset by the order: table->database->server (#9105) 2019-01-21 19:56:40 +08:00
818ec911c5 admin: fix admin check table err when add column not null, then add index on the column (#9108) 2019-01-20 22:44:10 +08:00
59c7b69187 ddl: disallow alter table on view (#8890) 2019-01-17 00:57:21 +08:00
f522de2e8f ddl: support "or replace" option when create view (#8856) 2019-01-16 19:54:22 +08:00
47ea05d017 executor,planner: adjust the result of 'admin show ddl' (#9020) 2019-01-16 18:02:55 +08:00
ec833bc4d2 *: fix some lints produced by golangci-lint (#8999) 2019-01-16 16:44:49 +08:00
365264cd21 ddl: add restore deleted table (#7937) 2019-01-16 15:37:33 +08:00
33b4c3e3c8 executor: fix csv parser (#9005) 2019-01-15 22:46:23 +08:00
3835bef7ae executor: support window func for aggregate without frame clause (#8899) 2019-01-15 15:23:17 +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
463d44c2bc executor: reset hasMatch flag for each outer row in merge join (#9046) 2019-01-14 21:29:31 +08:00
3c98f69266 *: support select partition for partition table (#8990) 2019-01-14 20:55:52 +08:00
82d2726300 planner, statistics: build new histogram using range information (#7921) 2019-01-14 20:33:36 +08:00
15b29dd71a executor: add column character sets when show create table (#8866) 2019-01-14 19:59:47 +08:00
f20c849857 types: support sql_mode ALLOW_INVALID_DATES (#9027) 2019-01-14 19:34:22 +08:00
4a901db388 plan/executor: handle optimizer hint properly for cartesian join (#9037) 2019-01-14 18:00:32 +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
00c4ff4fa9 *: refactor Executor.Next() to receive RecordBatch (#8994) 2019-01-14 15:04:36 +08:00
8ac79f3f6e executor: improve trace format='row' (#9029) 2019-01-13 16:34:58 +08:00
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