From 9eec56a13e6b9ce67c819d6e1047c97d4e84c217 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Tue, 20 Nov 2018 05:18:43 -0700 Subject: [PATCH 1/7] Change sql-mode to same as MySQL Change default to utf8mb4 --- sql/mysql-compatibility.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sql/mysql-compatibility.md b/sql/mysql-compatibility.md index 4fe996b1b0afe..f2d18a5e051ab 100644 --- a/sql/mysql-compatibility.md +++ b/sql/mysql-compatibility.md @@ -160,7 +160,7 @@ mysql> SHOW CREATE TABLE t1\G Table: t1 Create Table: CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin 1 row in set (0.00 sec) ``` @@ -173,12 +173,9 @@ The output of the query execution plan returned from the `EXPLAIN` command diffe ### Default differences - Default character set: - - The default value in TiDB is `utf8` which is equivalent to `utf8mb4` in MySQL. + - The default value in TiDB is `utf8mb4`. - The default value in MySQL 5.7 is `latin1`, but changes to `utf8mb4` in MySQL 8.0. - Default collation: `latin1_swedish_ci` in MySQL 5.7, while `binary` in TiDB. -- Default SQL mode: - - The default value in TiDB is `STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION`. - - The default value in MySQL 5.7 is `ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION`. - Default value of `lower_case_table_names`: - The default value in TiDB is 2 and currently TiDB only supports 2. - The default value in MySQL: From ba2300b834b0810ec5b4903c115586928900ba08 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Tue, 20 Nov 2018 05:20:11 -0700 Subject: [PATCH 2/7] Update mysql-compatibility.md --- sql/mysql-compatibility.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/mysql-compatibility.md b/sql/mysql-compatibility.md index f2d18a5e051ab..dabfde07d2ea8 100644 --- a/sql/mysql-compatibility.md +++ b/sql/mysql-compatibility.md @@ -22,7 +22,7 @@ However, in TiDB, the following MySQL features are not supported for the time be + `FOREIGN KEY` constraints + `FULLTEXT` functions and indexes + `SPATIAL` functions and indexes -+ Character sets other than `utf8` ++ Character sets other than `utf8mb4` + Collations other than `BINARY` + Add primary key + Drop primary key From 3699019dca731d56f1549e3d595c73ab4af563a5 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Tue, 20 Nov 2018 05:21:48 -0700 Subject: [PATCH 3/7] Update character-set-configuration.md --- sql/character-set-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/character-set-configuration.md b/sql/character-set-configuration.md index 46b86257d5232..2a5245e25c02a 100644 --- a/sql/character-set-configuration.md +++ b/sql/character-set-configuration.md @@ -6,6 +6,6 @@ category: user guide # Character Set Configuration -Currently, TiDB only supports the `utf8` character set, which is the equivalent to `utf8mb4` in MySQL. Since MySQL 5.7 defaults to `latin1`, this difference is documented under [default differences](../sql/mysql-compatibility.md#default-differences) between TiDB and MySQL. +Currently, TiDB only supports the `utf8mb4` character set, and its alias `utf8`. Since MySQL 5.7 defaults to `latin1`, this difference is documented under [default differences](../sql/mysql-compatibility.md#default-differences) between TiDB and MySQL. For more information, see [Character Set Configuration in MySQL](https://dev.mysql.com/doc/refman/5.7/en/charset-configuration.html). From 25a933a0cd91ac2e90b0acf906bf885116ea48ee Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Tue, 20 Nov 2018 05:27:41 -0700 Subject: [PATCH 4/7] Improve character set description --- sql/character-set-support.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/character-set-support.md b/sql/character-set-support.md index c557f5855e076..37fa55f768ef7 100644 --- a/sql/character-set-support.md +++ b/sql/character-set-support.md @@ -8,7 +8,7 @@ category: user guide A character set is a set of symbols and encodings. A collation is a set of rules for comparing characters in a character set. -Currently, TiDB supports the following character sets: +For **compatibility reasons** TiDB lists several character sets as available, but will always store data in the `utf8mb4` character set. ```sql mysql> SHOW CHARACTER SET; @@ -24,7 +24,7 @@ mysql> SHOW CHARACTER SET; 5 rows in set (0.00 sec) ``` -> **Note**: In TiDB, utf8 is treated as utf8mb4. +> **Note**: All character sets are currently treated as utf8mb4. Each character set has at least one collation. Most of the character sets have several collations. You can use the following statement to display the available character sets: From 0bea66b999dc6960570ffc833de4f05629e60d77 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Mon, 26 Nov 2018 06:28:56 -0700 Subject: [PATCH 5/7] Update mysql-compatibility.md --- sql/mysql-compatibility.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sql/mysql-compatibility.md b/sql/mysql-compatibility.md index dabfde07d2ea8..74d694ee70087 100644 --- a/sql/mysql-compatibility.md +++ b/sql/mysql-compatibility.md @@ -176,6 +176,9 @@ The output of the query execution plan returned from the `EXPLAIN` command diffe - The default value in TiDB is `utf8mb4`. - The default value in MySQL 5.7 is `latin1`, but changes to `utf8mb4` in MySQL 8.0. - Default collation: `latin1_swedish_ci` in MySQL 5.7, while `binary` in TiDB. +- Default value of `foreign_key_checks`: + - The default value in TiDB is `OFF` and currently TiDB only supports `OFF`. + - The default value in MySQL 5.7 is `ON`. - Default value of `lower_case_table_names`: - The default value in TiDB is 2 and currently TiDB only supports 2. - The default value in MySQL: From a5ce1a9f2dc2c0786c39d118fd4ef14d81adc367 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Mon, 26 Nov 2018 08:51:48 -0700 Subject: [PATCH 6/7] Update character-set-configuration.md --- sql/character-set-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/character-set-configuration.md b/sql/character-set-configuration.md index 2a5245e25c02a..05fcec1a53087 100644 --- a/sql/character-set-configuration.md +++ b/sql/character-set-configuration.md @@ -6,6 +6,6 @@ category: user guide # Character Set Configuration -Currently, TiDB only supports the `utf8mb4` character set, and its alias `utf8`. Since MySQL 5.7 defaults to `latin1`, this difference is documented under [default differences](../sql/mysql-compatibility.md#default-differences) between TiDB and MySQL. +Currently, TiDB only supports the `utf8mb4` character set. Since MySQL 5.7 defaults to `latin1`, this difference is documented under [default differences](../sql/mysql-compatibility.md#default-differences) between TiDB and MySQL. For more information, see [Character Set Configuration in MySQL](https://dev.mysql.com/doc/refman/5.7/en/charset-configuration.html). From de74ba9f4bdde9dfcd7553d3f8ccea5c5c993a83 Mon Sep 17 00:00:00 2001 From: Lilian Lee Date: Mon, 14 Jan 2019 08:19:36 -0700 Subject: [PATCH 7/7] Update sql/character-set-support.md Co-Authored-By: morgo --- sql/character-set-support.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/character-set-support.md b/sql/character-set-support.md index 37fa55f768ef7..3e1fee73b9c01 100644 --- a/sql/character-set-support.md +++ b/sql/character-set-support.md @@ -8,7 +8,7 @@ category: user guide A character set is a set of symbols and encodings. A collation is a set of rules for comparing characters in a character set. -For **compatibility reasons** TiDB lists several character sets as available, but will always store data in the `utf8mb4` character set. +For **compatibility reasons**, TiDB lists several character sets as available, but will always store data in the `utf8mb4` character set. ```sql mysql> SHOW CHARACTER SET;