Commit Graph

143 Commits

Author SHA1 Message Date
168776dcfa * : support show session binding (#10285) 2019-04-28 13:20:13 +08:00
732f4307b8 ddl: add table option pre_split_regions for pre-split region when create table with shard_row_id_bits. (#10138) 2019-04-24 21:56:24 +08:00
a28d8779c1 *: support show analyze status (#10172) 2019-04-24 14:32:19 +08:00
b2910d7f04 executor, infoschema: SHOW COLLATIONS shows supported collations only (#10186) 2019-04-24 14:00:24 +08:00
58d1bb8cb3 privilege: support authentication with active roles (#10125) 2019-04-23 10:05:53 +08:00
7cc7323138 plan, privilege: add role support for SHOW GRANT (#10016) 2019-04-21 12:38:28 +08:00
5b13ff921c *: support "show global bind" (#10200) 2019-04-19 17:23:51 +08:00
e327f3510f *: Add support "show open tables" (#10166)
TiDB has no concept like mysql's "table cache" and "open table"
For simplicity, we just return an empty result with the same structure
as MySQL's SHOW OPEN TABLES
2019-04-18 21:23:16 -06:00
f723f0b143 table, infoschema, executor: fix Charset/Collation shown in column desc (#10007) 2019-04-09 20:00:13 +08:00
e31e8f1560 *: reduce runtime.growslice by preallocation (#9946) 2019-03-31 10:31:06 +08:00
94d15dbd59 ddl:show full columns for date, datetime, timestamp compatibility. (#9810) 2019-03-28 16:43:01 +08:00
e53b56baaa remove an unnecessary argument (#9857) 2019-03-22 14:31:48 +08:00
1da14b93a9 infoschema: fix panic in 'SELECT * FROM information_schema.processlist' (#9842) 2019-03-21 19:23:21 +08:00
09beefbe04 session,executor: performance improvement in SetProcessInfo (#9681) 2019-03-13 17:24:39 +08:00
e7ff050a45 planner, executor: support SQL show pump/drainer status (#9456) 2019-03-04 15:39:54 +08:00
266ff4b6f3 executor, ddl: get the correct result of "show create table" when adding the first index to the table (#9388) 2019-02-22 18:49:44 +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
94d21c57aa * fix timestamp default value bug in multiple time zones. (#9115) 2019-02-18 15:35:27 +08:00
3d4ad1fb80 executor: make the results of show create table more consistent with MySQL (#9229)
* Fix #9211: make  more consistent with MySQL
2019-02-15 11:26:11 +08:00
d96ca96941 executor:adjust 'show create table' for mysql compatibility (#9113)
* executor: adjust 'show create table'

show create table should not print the charset of the column
if it is the same with table charset( same with MySQL)

* update:change the test

* update: add test to improve CodeCov

* style: update the variable

* fix test

* Wait for change parser

* just need to test

* change go.mod

* fix invalid pointer access

* Revert "update:change the test"

This reverts commit 64b381b2e95f151a9756d67ba52b60f694573cf9.

* Revert "fix test"

This reverts commit 98e00954064c9f5a6aa4ae1d4fb529e27cfabf4e.

* Revert "update: add test to improve CodeCov"

This reverts commit a32d6e992ca239e893f0615cea988838f3952dd7.

* passed test(need change test data)

*  add judge when show create table

*  fix logic wrong

*  add test

* change variable name

* revert something because complex

* update go.mod

*  update go.mod
2019-02-14 15:49:38 +08:00
e6a0eb9246 executor: support "show create table" for View (#8865) 2019-01-15 13:31:22 +08:00
15b29dd71a executor: add column character sets when show create table (#8866) 2019-01-14 19:59:47 +08:00
4b98ad6f29 *: integrate plugin framework with TiDB (#9006) 2019-01-14 16:53:41 +08:00
00c4ff4fa9 *: refactor Executor.Next() to receive RecordBatch (#8994) 2019-01-14 15:04:36 +08:00
78a51a4626 executor: support "show columns from" for view (#8863) 2019-01-05 21:32:32 +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
e7301865a1 executor: show full tables support view (#8860) 2018-12-28 20:04:23 +08:00
a1a4e8197d Revert "executor/show: show create table return utf8mb4 charset. (#8604) (#8782) 2018-12-26 09:54:50 +08:00
d69490b77e executor/show: show create table return utf8mb4 charset. (#8604) 2018-12-11 19:14:37 +08:00
68a6291c05 executor: fix show create table for hash partition (#8477)
* executor: fix show create table for hash partition

* Update show.go

* Update show_test.go

* Update show.go
2018-12-06 10:24:30 +08:00
c137cada68 *: change golang.org/x/net/context to standard context (#8579) 2018-12-05 13:54:00 +08:00
3128e9b98a *: Hide "Mem" column from SHOW PROCESSSLIST (#8543) 2018-12-05 11:42:58 +08:00
7ab61d85ce executor: improve SHOW commands compatibility (#8417) 2018-11-26 20:39:56 +08:00
f88db4fb5e executor: properly escape backquotes in identifiers in SHOW CREATE TABLE (#8302) 2018-11-14 23:09:09 +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
a37417e72c executor: fix show columns panic (#8082) 2018-10-30 13:29:11 +08:00
89dda9d9a8 *: move parser to a separate repository (#8036) 2018-10-25 11:12:10 +08:00
e81f855549 executor: let information_schema be the first database in ShowDatabases (#7938) 2018-10-23 14:28:45 +08:00
38f2fe0b60 executor,infoschema: check privilege for 'show processlist' (#7858)
"show processlist" requires the PROCESS privilege.
Otherwise, the user can see only his own threads.
2018-10-10 17:50:37 +08:00
0d979a24e0 ddl: fix 'show create table' result not correct when the table with a compression option (#7793) 2018-09-27 18:39:13 +08:00
05b37de16e *: use chunk grow for simple executor (#7540) 2018-09-27 09:07:51 +08:00
cfd4544801 ddl:support show create table with compression (#7782) 2018-09-26 18:13:03 +08:00
1c5adf402f fix show processlist (#7765) 2018-09-21 14:59:21 +08:00
cb03f2bec1 move from juju/errors to pkg/errors (#7151) 2018-09-12 15:42:20 +08:00
8d1acc2407 Fix bit default value bug (#7249) 2018-08-31 10:43:02 +08:00
69d5e36ac4 *: bump go version to 1.11 (#7491) 2018-08-29 21:48:50 +08:00
fa7de823db ddl: support range partition in show table status (#7173) 2018-07-29 13:13:32 +08:00