Commit Graph

1842 Commits

Author SHA1 Message Date
4ad4684da1 privilege,planner: handle View's security privilege check (#9194) 2019-02-12 10:35:18 +08:00
bcecc91362 ddl: fix default value precision problem for time types (#9249) 2019-02-11 12:15:09 +08:00
af99a0df5a types: fix processing of "0000" value for year type (#9250) 2019-02-11 11:20:22 +08:00
640aa65113 *: add some tests for writing-data corner cases (#9199) 2019-02-11 10:20:17 +08:00
3d614e0965 planner: enable function any_value in aggregation if ONLY_FULL_GROUP_BY is set (#9255) 2019-02-10 10:03:40 +08:00
09a5c8028e plan: derive col is not null from col op col conditions (#8603)
Check whether the `op` condition is null rejected, if yes, derive
`col is not null` for both sides of inner join, and for inner side
of outer join.

Also, remove duplicate conditions before pushing them down. Check
if the condition is mutable before removing duplicates.

For AntiSemiJoin, AntiLeftOuterSemiJoin and LeftOuterSemiJoin, do
not generate new `is not null` conditions.
2019-01-30 10:53:46 +08:00
c83a0ceb95 config: add a config item to control whether TiDB check the mb4 character in utf8 (#9175) 2019-01-25 14:39:30 +08:00
5c65128632 ddl: make the leak test stable (#9139) 2019-01-23 13:01:55 +08:00
36176be874 *: improve syntax error code & message compatibility (#9103) 2019-01-23 10:46:29 +08:00
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