diff --git a/DEPS.bzl b/DEPS.bzl index c6ff78e509ea0..851f55e3ec5d6 100644 --- a/DEPS.bzl +++ b/DEPS.bzl @@ -1163,8 +1163,8 @@ def go_deps(): name = "com_github_go_sql_driver_mysql", build_file_proto_mode = "disable_global", importpath = "github.com/go-sql-driver/mysql", - sum = "h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=", - version = "v1.6.0", + sum = "h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=", + version = "v1.7.0", ) go_repository( name = "com_github_go_stack_stack", diff --git a/cmd/explaintest/r/collation_agg_func_disabled.result b/cmd/explaintest/r/collation_agg_func_disabled.result index 4b4a9d1074af8..b5075b3c82f83 100644 --- a/cmd/explaintest/r/collation_agg_func_disabled.result +++ b/cmd/explaintest/r/collation_agg_func_disabled.result @@ -133,13 +133,13 @@ approx_count_distinct(value collate utf8mb4_bin, value1) create table tt(a char(10), b enum('a', 'B', 'c'), c set('a', 'B', 'c'), d json) collate utf8mb4_general_ci; insert into tt values ("a", "a", "a", JSON_OBJECT("a", "a")); insert into tt values ("A", "A", "A", JSON_OBJECT("A", "A")); -Error 1265: Data truncated for column 'b' at row 1 +Error 1265 (01000): Data truncated for column 'b' at row 1 insert into tt values ("b", "b", "b", JSON_OBJECT("b", "b")); -Error 1265: Data truncated for column 'b' at row 1 +Error 1265 (01000): Data truncated for column 'b' at row 1 insert into tt values ("B", "B", "B", JSON_OBJECT("B", "B")); insert into tt values ("c", "c", "c", JSON_OBJECT("c", "c")); insert into tt values ("C", "C", "C", JSON_OBJECT("C", "C")); -Error 1265: Data truncated for column 'b' at row 1 +Error 1265 (01000): Data truncated for column 'b' at row 1 split table tt by (0), (1), (2), (3), (4), (5); desc format='brief' select min(a) from tt; id estRows task access object operator info @@ -210,9 +210,9 @@ select min(b) from tt; min(b) B desc format='brief' select min(b collate utf8mb4_bin) from tt; -Error 1235: This version of TiDB doesn't yet support 'use collate clause for enum or set' +Error 1235 (42000): This version of TiDB doesn't yet support 'use collate clause for enum or set' select min(b collate utf8mb4_bin) from tt; -Error 1235: This version of TiDB doesn't yet support 'use collate clause for enum or set' +Error 1235 (42000): This version of TiDB doesn't yet support 'use collate clause for enum or set' desc format='brief' select max(b) from tt; id estRows task access object operator info StreamAgg 1.00 root funcs:max(Column#8)->Column#6 @@ -223,9 +223,9 @@ select max(b) from tt; max(b) c desc format='brief' select max(b collate utf8mb4_bin) from tt; -Error 1235: This version of TiDB doesn't yet support 'use collate clause for enum or set' +Error 1235 (42000): This version of TiDB doesn't yet support 'use collate clause for enum or set' select max(b collate utf8mb4_bin) from tt; -Error 1235: This version of TiDB doesn't yet support 'use collate clause for enum or set' +Error 1235 (42000): This version of TiDB doesn't yet support 'use collate clause for enum or set' desc format='brief' select min(c) from tt; id estRows task access object operator info HashAgg 1.00 root funcs:min(collation_agg_func.tt.c)->Column#6 @@ -235,9 +235,9 @@ select min(c) from tt; min(c) B desc format='brief' select min(c collate utf8mb4_bin) from tt; -Error 1235: This version of TiDB doesn't yet support 'use collate clause for enum or set' +Error 1235 (42000): This version of TiDB doesn't yet support 'use collate clause for enum or set' select min(c collate utf8mb4_bin) from tt; -Error 1235: This version of TiDB doesn't yet support 'use collate clause for enum or set' +Error 1235 (42000): This version of TiDB doesn't yet support 'use collate clause for enum or set' desc format='brief' select max(c) from tt; id estRows task access object operator info HashAgg 1.00 root funcs:max(collation_agg_func.tt.c)->Column#6 @@ -247,9 +247,9 @@ select max(c) from tt; max(c) c desc format='brief' select max(c collate utf8mb4_bin) from tt; -Error 1235: This version of TiDB doesn't yet support 'use collate clause for enum or set' +Error 1235 (42000): This version of TiDB doesn't yet support 'use collate clause for enum or set' select max(c collate utf8mb4_bin) from tt; -Error 1235: This version of TiDB doesn't yet support 'use collate clause for enum or set' +Error 1235 (42000): This version of TiDB doesn't yet support 'use collate clause for enum or set' desc format='brief' select min(d) from tt; id estRows task access object operator info StreamAgg 1.00 root funcs:min(collation_agg_func.tt.d)->Column#6 diff --git a/cmd/explaintest/r/collation_agg_func_enabled.result b/cmd/explaintest/r/collation_agg_func_enabled.result index ea345c13ede58..5b587ff02d279 100644 --- a/cmd/explaintest/r/collation_agg_func_enabled.result +++ b/cmd/explaintest/r/collation_agg_func_enabled.result @@ -207,9 +207,9 @@ select min(b) from tt; min(b) a desc format='brief' select min(b collate utf8mb4_bin) from tt; -Error 1235: This version of TiDB doesn't yet support 'use collate clause for enum or set' +Error 1235 (42000): This version of TiDB doesn't yet support 'use collate clause for enum or set' select min(b collate utf8mb4_bin) from tt; -Error 1235: This version of TiDB doesn't yet support 'use collate clause for enum or set' +Error 1235 (42000): This version of TiDB doesn't yet support 'use collate clause for enum or set' desc format='brief' select max(b) from tt; id estRows task access object operator info StreamAgg 1.00 root funcs:max(Column#8)->Column#6 @@ -220,9 +220,9 @@ select max(b) from tt; max(b) c desc format='brief' select max(b collate utf8mb4_bin) from tt; -Error 1235: This version of TiDB doesn't yet support 'use collate clause for enum or set' +Error 1235 (42000): This version of TiDB doesn't yet support 'use collate clause for enum or set' select max(b collate utf8mb4_bin) from tt; -Error 1235: This version of TiDB doesn't yet support 'use collate clause for enum or set' +Error 1235 (42000): This version of TiDB doesn't yet support 'use collate clause for enum or set' desc format='brief' select min(c) from tt; id estRows task access object operator info HashAgg 1.00 root funcs:min(collation_agg_func.tt.c)->Column#6 @@ -232,9 +232,9 @@ select min(c) from tt; min(c) a desc format='brief' select min(c collate utf8mb4_bin) from tt; -Error 1235: This version of TiDB doesn't yet support 'use collate clause for enum or set' +Error 1235 (42000): This version of TiDB doesn't yet support 'use collate clause for enum or set' select min(c collate utf8mb4_bin) from tt; -Error 1235: This version of TiDB doesn't yet support 'use collate clause for enum or set' +Error 1235 (42000): This version of TiDB doesn't yet support 'use collate clause for enum or set' desc format='brief' select max(c) from tt; id estRows task access object operator info HashAgg 1.00 root funcs:max(collation_agg_func.tt.c)->Column#6 @@ -244,9 +244,9 @@ select max(c) from tt; max(c) c desc format='brief' select max(c collate utf8mb4_bin) from tt; -Error 1235: This version of TiDB doesn't yet support 'use collate clause for enum or set' +Error 1235 (42000): This version of TiDB doesn't yet support 'use collate clause for enum or set' select max(c collate utf8mb4_bin) from tt; -Error 1235: This version of TiDB doesn't yet support 'use collate clause for enum or set' +Error 1235 (42000): This version of TiDB doesn't yet support 'use collate clause for enum or set' desc format='brief' select min(d) from tt; id estRows task access object operator info StreamAgg 1.00 root funcs:min(collation_agg_func.tt.d)->Column#6 diff --git a/cmd/explaintest/r/collation_check_use_collation_disabled.result b/cmd/explaintest/r/collation_check_use_collation_disabled.result index 493b26812bfbb..2c0bd306f445b 100644 --- a/cmd/explaintest/r/collation_check_use_collation_disabled.result +++ b/cmd/explaintest/r/collation_check_use_collation_disabled.result @@ -32,7 +32,7 @@ drop table if exists t; create table t(a enum('a', 'b') charset utf8mb4 collate utf8mb4_general_ci, b varchar(20)); insert into t values ("b", "c"); insert into t values ("B", "b"); -Error 1265: Data truncated for column 'a' at row 1 +Error 1265 (01000): Data truncated for column 'a' at row 1 select * from t where 'B' collate utf8mb4_general_ci in (a); a b select * from t where 'B' collate utf8mb4_bin in (a); @@ -82,7 +82,7 @@ drop table if exists t; create table t(a set('a', 'b') charset utf8mb4 collate utf8mb4_general_ci, b varchar(20)); insert into t values ("b", "c"); insert into t values ("B", "b"); -Error 1265: Data truncated for column 'a' at row 1 +Error 1265 (01000): Data truncated for column 'a' at row 1 select * from t where 'B' collate utf8mb4_general_ci in (a); a b select * from t where 'B' collate utf8mb4_bin in (a); diff --git a/cmd/explaintest/r/collation_misc_disabled.result b/cmd/explaintest/r/collation_misc_disabled.result index eff046aa33009..a66f63ead2db9 100644 --- a/cmd/explaintest/r/collation_misc_disabled.result +++ b/cmd/explaintest/r/collation_misc_disabled.result @@ -15,7 +15,7 @@ select * from t; a t_value alter table t modify column a varchar(20) charset utf8; -Error 8200: Unsupported modify charset from latin1 to utf8 +Error 8200 (HY000): Unsupported modify charset from latin1 to utf8 drop table t; create table t(a varchar(20) charset latin1); insert into t values ("t_value"); @@ -38,13 +38,13 @@ drop table t; create table t(a varchar(20) charset latin1); insert into t values ("t_value"); alter table t modify column a varchar(20) charset utf8 collate utf8_bin; -Error 8200: Unsupported modify charset from latin1 to utf8 +Error 8200 (HY000): Unsupported modify charset from latin1 to utf8 alter table t modify column a varchar(20) charset utf8mb4 collate utf8bin; [ddl:1273]Unknown collation: 'utf8bin' alter table t collate LATIN1_GENERAL_CI charset utf8 collate utf8_bin; -Error 1302: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8' +Error 1302 (HY000): Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8' alter table t collate LATIN1_GENERAL_CI collate UTF8MB4_UNICODE_ci collate utf8_bin; -Error 1253: COLLATION 'utf8mb4_unicode_ci' is not valid for CHARACTER SET 'latin1' +Error 1253 (42000): COLLATION 'utf8mb4_unicode_ci' is not valid for CHARACTER SET 'latin1' drop table t; create table t(a varchar(20) charset latin1); insert into t values ("t_value"); diff --git a/cmd/explaintest/r/collation_misc_enabled.result b/cmd/explaintest/r/collation_misc_enabled.result index 235d5896380ee..a088ddb0b2c9d 100644 --- a/cmd/explaintest/r/collation_misc_enabled.result +++ b/cmd/explaintest/r/collation_misc_enabled.result @@ -15,7 +15,7 @@ select * from t; a t_value alter table t modify column a varchar(20) charset utf8; -Error 8200: Unsupported modify charset from latin1 to utf8 +Error 8200 (HY000): Unsupported modify charset from latin1 to utf8 drop table t; create table t(a varchar(20) charset latin1); insert into t values ("t_value"); @@ -38,13 +38,13 @@ drop table t; create table t(a varchar(20) charset latin1); insert into t values ("t_value"); alter table t modify column a varchar(20) charset utf8 collate utf8_bin; -Error 8200: Unsupported modify charset from latin1 to utf8 +Error 8200 (HY000): Unsupported modify charset from latin1 to utf8 alter table t modify column a varchar(20) charset utf8mb4 collate utf8bin; [ddl:1273]Unknown collation: 'utf8bin' alter table t collate LATIN1_GENERAL_CI charset utf8 collate utf8_bin; -Error 1273: Unsupported collation when new collation is enabled: 'latin1_general_ci' +Error 1273 (HY000): Unsupported collation when new collation is enabled: 'latin1_general_ci' alter table t collate LATIN1_GENERAL_CI collate UTF8MB4_UNICODE_ci collate utf8_bin; -Error 1273: Unsupported collation when new collation is enabled: 'latin1_general_ci' +Error 1273 (HY000): Unsupported collation when new collation is enabled: 'latin1_general_ci' drop table t; create table t(a varchar(20) charset latin1); insert into t values ("t_value"); @@ -56,7 +56,7 @@ a t_value create database if not exists cd_test_utf8 CHARACTER SET utf8 COLLATE utf8_bin; create database if not exists cd_test_latin1 CHARACTER SET latin1 COLLATE latin1_swedish_ci; -Error 1273: Unsupported collation when new collation is enabled: 'latin1_swedish_ci' +Error 1273 (HY000): Unsupported collation when new collation is enabled: 'latin1_swedish_ci' use cd_test_utf8; select @@character_set_database; @@character_set_database @@ -65,7 +65,7 @@ select @@collation_database; @@collation_database utf8_bin use cd_test_latin1; -Error 1049: Unknown database 'cd_test_latin1' +Error 1049 (42000): Unknown database 'cd_test_latin1' select @@character_set_database; @@character_set_database utf8 @@ -73,7 +73,7 @@ select @@collation_database; @@collation_database utf8_bin create database if not exists test_db CHARACTER SET latin1 COLLATE latin1_swedish_ci; -Error 1273: Unsupported collation when new collation is enabled: 'latin1_swedish_ci' +Error 1273 (HY000): Unsupported collation when new collation is enabled: 'latin1_swedish_ci' with cte as (select cast('2010-09-09' as date) a union select '2010-09-09 ') select count(*) from cte; count(*) 1 diff --git a/cmd/explaintest/r/collation_pointget_disabled.result b/cmd/explaintest/r/collation_pointget_disabled.result index a763c54c96344..db7b0a9ab630f 100644 --- a/cmd/explaintest/r/collation_pointget_disabled.result +++ b/cmd/explaintest/r/collation_pointget_disabled.result @@ -111,15 +111,15 @@ select *, a, b from t tmp where tmp.a = "aa"; a b a b aa bb aa bb select a from t where xxxxx.a = "aa"; -Error 1054: Unknown column 'xxxxx.a' in 'where clause' +Error 1054 (42S22): Unknown column 'xxxxx.a' in 'where clause' select xxxxx.a from t where a = "aa"; -Error 1054: Unknown column 'xxxxx.a' in 'field list' +Error 1054 (42S22): Unknown column 'xxxxx.a' in 'field list' select a from t tmp where t.a = "aa"; -Error 1054: Unknown column 't.a' in 'where clause' +Error 1054 (42S22): Unknown column 't.a' in 'where clause' select t.a from t tmp where a = "aa"; -Error 1054: Unknown column 't.a' in 'field list' +Error 1054 (42S22): Unknown column 't.a' in 'field list' select t.* from t tmp where a = "aa"; -Error 1051: Unknown table 't' +Error 1051 (42S02): Unknown table 't' drop table if exists t; create table t(a char(4) primary key, b char(4)); insert into t values("aa", "bb"); diff --git a/cmd/explaintest/r/collation_pointget_enabled.result b/cmd/explaintest/r/collation_pointget_enabled.result index 156e4d87f931c..7c404177ce587 100644 --- a/cmd/explaintest/r/collation_pointget_enabled.result +++ b/cmd/explaintest/r/collation_pointget_enabled.result @@ -124,15 +124,15 @@ select *, a, b from t tmp where tmp.a = "aa"; a b a b aa bb aa bb select a from t where xxxxx.a = "aa"; -Error 1054: Unknown column 'xxxxx.a' in 'where clause' +Error 1054 (42S22): Unknown column 'xxxxx.a' in 'where clause' select xxxxx.a from t where a = "aa"; -Error 1054: Unknown column 'xxxxx.a' in 'field list' +Error 1054 (42S22): Unknown column 'xxxxx.a' in 'field list' select a from t tmp where t.a = "aa"; -Error 1054: Unknown column 't.a' in 'where clause' +Error 1054 (42S22): Unknown column 't.a' in 'where clause' select t.a from t tmp where a = "aa"; -Error 1054: Unknown column 't.a' in 'field list' +Error 1054 (42S22): Unknown column 't.a' in 'field list' select t.* from t tmp where a = "aa"; -Error 1051: Unknown table 't' +Error 1051 (42S02): Unknown table 't' drop table if exists t; create table t(a char(4) primary key, b char(4)); insert into t values("aa", "bb"); diff --git a/cmd/explaintest/r/cte.result b/cmd/explaintest/r/cte.result index 7a8677c848294..6f277815bb566 100644 --- a/cmd/explaintest/r/cte.result +++ b/cmd/explaintest/r/cte.result @@ -91,7 +91,7 @@ c1 c2 1 1 1 2 with recursive tbl_0 (col_943,col_944,col_945,col_946,col_947) AS ( with recursive tbl_0 (col_948,col_949,col_950,col_951,col_952) AS ( select 1, 2,3,4,5 UNION ALL select col_948 + 1,col_949 + 1,col_950 + 1,col_951 + 1,col_952 + 1 from tbl_0 where col_948 < 5 ) select col_948,col_949,col_951,col_950,col_952 from tbl_0 UNION ALL select col_943 + 1,col_944 + 1,col_945 + 1,col_946 + 1,col_947 + 1 from tbl_0 where col_943 < 5 ) select * from tbl_0; -Error 1054: Unknown column 'col_943' in 'where clause' +Error 1054 (42S22): Unknown column 'col_943' in 'where clause' with recursive cte1 (c1, c2) as (select 1, '1' union select concat(c1, 1), c2 + 1 from cte1 where c1 < 100) select * from cte1; c1 c2 1 1 @@ -283,15 +283,15 @@ union all select 3, 0 from qn ) select * from qn; -Error 1222: The used SELECT statements have a different number of columns +Error 1222 (21000): The used SELECT statements have a different number of columns with recursive cte1 as (select 1 union all (select 1 from cte1 limit 10)) select * from cte1; -Error 1235: This version of TiDB doesn't yet support 'ORDER BY / LIMIT / SELECT DISTINCT in recursive query block of Common Table Expression' +Error 1235 (42000): This version of TiDB doesn't yet support 'ORDER BY / LIMIT / SELECT DISTINCT in recursive query block of Common Table Expression' with recursive qn as (select 123 as a union all select null from qn where a is not null) select * from qn; a 123 NULL with recursive q (b) as (select 1, 1 union all select 1, 1 from q) select b from q; -Error 1353: In definition of view, derived table or common table expression, SELECT list and column names list have different column counts +Error 1353 (HY000): In definition of view, derived table or common table expression, SELECT list and column names list have different column counts drop table if exists t1; create table t1(a int); insert into t1 values(1); @@ -356,7 +356,7 @@ drop table if exists t1; create table t1(c1 bigint unsigned); insert into t1 values(0); with recursive cte1 as (select c1 - 1 c1 from t1 union all select c1 - 1 c1 from cte1 where c1 != 0) select * from cte1 dt1, cte1 dt2; -Error 1690: BIGINT UNSIGNED value is out of range in '(test.t1.c1 - 1)' +Error 1690 (22003): BIGINT UNSIGNED value is out of range in '(test.t1.c1 - 1)' drop table if exists t; create table t(a int, b int, key (b)); desc with cte as (select * from t) select * from cte; diff --git a/cmd/explaintest/r/new_character_set_builtin.result b/cmd/explaintest/r/new_character_set_builtin.result index f044ecca1019c..77c9400e3128a 100644 --- a/cmd/explaintest/r/new_character_set_builtin.result +++ b/cmd/explaintest/r/new_character_set_builtin.result @@ -399,17 +399,17 @@ a like 0xe4b880 b like 0xd2bb 1 1 1 1 select a = 0xb6fe from t; -Error 3854: Cannot convert string '\xB6\xFE' from binary to utf8mb4 +Error 3854 (HY000): Cannot convert string '\xB6\xFE' from binary to utf8mb4 select b = 0xe4ba8c from t; -Error 3854: Cannot convert string '\xE4\xBA\x8C' from binary to gbk +Error 3854 (HY000): Cannot convert string '\xE4\xBA\x8C' from binary to gbk select concat(a, 0xb6fe) from t; -Error 3854: Cannot convert string '\xB6\xFE' from binary to utf8mb4 +Error 3854 (HY000): Cannot convert string '\xB6\xFE' from binary to utf8mb4 select concat(b, 0xe4ba8c) from t; -Error 3854: Cannot convert string '\xE4\xBA\x8C' from binary to gbk +Error 3854 (HY000): Cannot convert string '\xE4\xBA\x8C' from binary to gbk select concat(convert('a' using gbk), 0x3fff) from t; -Error 3854: Cannot convert string '?\xFF' from binary to gbk +Error 3854 (HY000): Cannot convert string '?\xFF' from binary to gbk select concat(convert('a' using gbk), 0x3fffffffffffffff) from t; -Error 3854: Cannot convert string '?\xFF\xFF\xFF\xFF\xFF...' from binary to gbk +Error 3854 (HY000): Cannot convert string '?\xFF\xFF\xFF\xFF\xFF...' from binary to gbk set @@tidb_enable_vectorized_expression = false; select hex(concat(a, c)), hex(concat(b, c)) from t; hex(concat(a, c)) hex(concat(b, c)) @@ -502,13 +502,13 @@ a like 0xe4b880 b like 0xd2bb 1 1 1 1 select a = 0xb6fe from t; -Error 3854: Cannot convert string '\xB6\xFE' from binary to utf8mb4 +Error 3854 (HY000): Cannot convert string '\xB6\xFE' from binary to utf8mb4 select b = 0xe4ba8c from t; -Error 3854: Cannot convert string '\xE4\xBA\x8C' from binary to gbk +Error 3854 (HY000): Cannot convert string '\xE4\xBA\x8C' from binary to gbk select concat(a, 0xb6fe) from t; -Error 3854: Cannot convert string '\xB6\xFE' from binary to utf8mb4 +Error 3854 (HY000): Cannot convert string '\xB6\xFE' from binary to utf8mb4 select concat(b, 0xe4ba8c) from t; -Error 3854: Cannot convert string '\xE4\xBA\x8C' from binary to gbk +Error 3854 (HY000): Cannot convert string '\xE4\xBA\x8C' from binary to gbk drop table if exists t; create table t (a char(20) charset utf8mb4, b char(20) charset gbk, c binary(20)); insert into t values ('一二三', '一二三', '一二三'); diff --git a/cmd/explaintest/r/new_character_set_invalid.result b/cmd/explaintest/r/new_character_set_invalid.result index 7eea6348e2bc7..e0c749d81ab15 100644 --- a/cmd/explaintest/r/new_character_set_invalid.result +++ b/cmd/explaintest/r/new_character_set_invalid.result @@ -4,11 +4,11 @@ drop table if exists t; create table t (a varchar(255) charset gbk, b varchar(255) charset ascii, c varchar(255) charset utf8); insert into t values ('中文', 'asdf', '字符集'); insert into t values ('À', 'ø', '😂'); -Error 1366: Incorrect string value '\xC3\x80' for column 'a' +Error 1366 (HY000): Incorrect string value '\xC3\x80' for column 'a' insert into t values ('中文À中文', 'asdføfdsa', '字符集😂字符集'); -Error 1366: Incorrect string value '\xC3\x80' for column 'a' +Error 1366 (HY000): Incorrect string value '\xC3\x80' for column 'a' insert into t values (0x4040ffff, 0x4040ffff, 0x4040ffff); -Error 1366: Incorrect string value '\xFF\xFF' for column 'a' +Error 1366 (HY000): Incorrect string value '\xFF\xFF' for column 'a' select * from t; a b c 中文 asdf 字符集 diff --git a/cmd/explaintest/r/select.result b/cmd/explaintest/r/select.result index 02f2486542f45..70101f0218ca8 100644 --- a/cmd/explaintest/r/select.result +++ b/cmd/explaintest/r/select.result @@ -96,9 +96,9 @@ SELECT * from t a left join t2 b on a.c1 = b.c1; c1 c2 c3 c1 c2 1 2 3 1 2 SELECT * from (SELECT 1, 1) as a; -Error 1060: Duplicate column name '1' +Error 1060 (42S21): Duplicate column name '1' SELECT * from (SELECT * FROM t, t2) as a; -Error 1060: Duplicate column name 'c1' +Error 1060 (42S21): Duplicate column name 'c1' DROP TABLE IF EXISTS t; CREATE TABLE t (c1 INT, c2 INT); INSERT INTO t VALUES (1, 2), (1, 1), (1, 3); @@ -656,5 +656,5 @@ drop table if exists t3; create table t3(a char(10), primary key (a)); insert into t3 values ('a'); select * from t3 where a > 0x80; -Error 1105: Cannot convert string '\x80' from binary to utf8mb4 +Error 1105 (HY000): Cannot convert string '\x80' from binary to utf8mb4 set @@tidb_enable_outer_join_reorder=false; diff --git a/dumpling/export/BUILD.bazel b/dumpling/export/BUILD.bazel index 08cc7fe2e664e..c9aebfb577c8a 100644 --- a/dumpling/export/BUILD.bazel +++ b/dumpling/export/BUILD.bazel @@ -49,7 +49,6 @@ go_library( "@com_github_coreos_go_semver//semver", "@com_github_docker_go_units//:go-units", "@com_github_go_sql_driver_mysql//:mysql", - "@com_github_google_uuid//:uuid", "@com_github_pingcap_errors//:errors", "@com_github_pingcap_failpoint//:failpoint", "@com_github_pingcap_log//:log", diff --git a/dumpling/export/config.go b/dumpling/export/config.go index 57504e4e20882..741424b049175 100644 --- a/dumpling/export/config.go +++ b/dumpling/export/config.go @@ -4,6 +4,7 @@ package export import ( "context" + "crypto/tls" "encoding/json" "fmt" "net" @@ -15,7 +16,6 @@ import ( "github.com/coreos/go-semver/semver" "github.com/docker/go-units" "github.com/go-sql-driver/mysql" - "github.com/google/uuid" "github.com/pingcap/errors" "github.com/pingcap/failpoint" "github.com/pingcap/tidb/br/pkg/storage" @@ -103,7 +103,7 @@ type Config struct { User string Password string `json:"-"` Security struct { - DriveTLSName string `json:"-"` + TLS *tls.Config `json:"-"` CAPath string CertPath string KeyPath string @@ -219,8 +219,16 @@ func (conf *Config) GetDriverConfig(db string) *mysql.Config { driverCfg.WriteTimeout = 30 * time.Second driverCfg.InterpolateParams = true driverCfg.MaxAllowedPacket = 0 - if conf.Security.DriveTLSName != "" { - driverCfg.TLSConfig = conf.Security.DriveTLSName + if conf.Security.TLS != nil { + driverCfg.TLS = conf.Security.TLS + } else { + // Use TLS first. + driverCfg.AllowFallbackToPlaintext = true + /* #nosec G402 */ + driverCfg.TLS = &tls.Config{ + InsecureSkipVerify: true, + MinVersion: tls.VersionTLS10, + } } if conf.AllowCleartextPasswords { driverCfg.AllowCleartextPasswords = true @@ -653,7 +661,7 @@ func adjustConfig(conf *Config, fns ...func(*Config) error) error { return nil } -func registerTLSConfig(conf *Config) error { +func buildTLSConfig(conf *Config) error { tlsConfig, err := util.NewTLSConfig( util.WithCAPath(conf.Security.CAPath), util.WithCertAndKeyPath(conf.Security.CertPath, conf.Security.KeyPath), @@ -663,14 +671,8 @@ func registerTLSConfig(conf *Config) error { if err != nil { return errors.Trace(err) } - - if tlsConfig == nil { - return nil - } - - conf.Security.DriveTLSName = "dumpling" + uuid.NewString() - err = mysql.RegisterTLSConfig(conf.Security.DriveTLSName, tlsConfig) - return errors.Trace(err) + conf.Security.TLS = tlsConfig + return nil } func validateSpecifiedSQL(conf *Config) error { diff --git a/dumpling/export/dump.go b/dumpling/export/dump.go index 7e5a81e0f3ce1..291b02b30bff9 100644 --- a/dumpling/export/dump.go +++ b/dumpling/export/dump.go @@ -95,7 +95,7 @@ func NewDumper(ctx context.Context, conf *Config) (*Dumper, error) { }() err = adjustConfig(conf, - registerTLSConfig, + buildTLSConfig, validateSpecifiedSQL, adjustFileFormat) if err != nil { @@ -1264,9 +1264,6 @@ func (d *Dumper) Close() error { if d.dbHandle != nil { return d.dbHandle.Close() } - if d.conf.Security.DriveTLSName != "" { - mysql.DeregisterTLSConfig(d.conf.Security.DriveTLSName) - } return nil } diff --git a/dumpling/tests/basic/run.sh b/dumpling/tests/basic/run.sh index 11a738805275b..51e33de43fbcb 100644 --- a/dumpling/tests/basic/run.sh +++ b/dumpling/tests/basic/run.sh @@ -114,8 +114,8 @@ echo "expected panic 0, actual ${actual}" [ "$actual" = 0 ] # check stdout, should contain mysql error log -actual=$(grep -w "Error 1064: You have an error in your SQL syntax" ${DUMPLING_OUTPUT_DIR}/dumpling.log|wc -l) -echo "expect contain Error 1064, actual ${actual}" +actual=$(grep -w "You have an error in your SQL syntax" ${DUMPLING_OUTPUT_DIR}/dumpling.log|wc -l) +echo "expect contain error in SQL syntax, actual ${actual}" [ "$actual" -ge 1 ] # Test for consistency lock with empty database. diff --git a/dumpling/tests/non_exist_tables/run.sh b/dumpling/tests/non_exist_tables/run.sh index 78003069cce9d..180db04407f3a 100644 --- a/dumpling/tests/non_exist_tables/run.sh +++ b/dumpling/tests/non_exist_tables/run.sh @@ -21,6 +21,6 @@ rm -rf "$DUMPLING_OUTPUT_DIR" run_dumpling --consistency=lock --tables-list "$DB_NAME.$TABLE_NAME2" -L ${DUMPLING_OUTPUT_DIR}/dumpling.log set -e -actual=$(grep -w "Error 1146: Table 'non_exist_tables.t2' doesn't exist" ${DUMPLING_OUTPUT_DIR}/dumpling.log|wc -l) +actual=$(grep -w "Table 'non_exist_tables.t2' doesn't exist" ${DUMPLING_OUTPUT_DIR}/dumpling.log|wc -l) echo "expected 1 return error when specifying --tables-list with non-existing tables, actual ${actual}" [ $actual = 1 ] diff --git a/go.mod b/go.mod index 8c68ec0d5137c..1ea8d11ca96d0 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( github.com/fatanugraha/noloopclosure v0.1.1 github.com/fatih/color v1.13.0 github.com/fsouza/fake-gcs-server v1.19.0 - github.com/go-sql-driver/mysql v1.6.0 + github.com/go-sql-driver/mysql v1.7.0 github.com/gogo/protobuf v1.3.2 github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.2 diff --git a/go.sum b/go.sum index 31210331beeb6..c29ca5c0b3929 100644 --- a/go.sum +++ b/go.sum @@ -327,8 +327,8 @@ github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= -github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= +github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo=