Skip to content

Commit

Permalink
tests: enable check-error for integrationtest (#49230)
Browse files Browse the repository at this point in the history
  • Loading branch information
Defined2014 authored Dec 7, 2023
1 parent 4dabd69 commit 8dac756
Show file tree
Hide file tree
Showing 26 changed files with 98 additions and 119 deletions.
3 changes: 0 additions & 3 deletions tests/integrationtest/r/collation_agg_func_disabled.result
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,10 @@ 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 (01000): Data truncated for column 'b' at row 1
insert into tt values ("b", "b", "b", JSON_OBJECT("b", "b"));
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 (01000): Data truncated for column 'b' at row 1
split table tt by (0), (1), (2), (3), (4), (5);
TOTAL_SPLIT_REGION SCATTER_FINISH_RATIO
6 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ 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 (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);
Expand Down Expand Up @@ -80,7 +79,6 @@ 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 (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);
Expand Down
4 changes: 2 additions & 2 deletions tests/integrationtest/r/collation_misc_disabled.result
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ Error 8200 (HY000): Unsupported modify charset from latin1 to utf8
alter table t modify column a varchar(20) charset utf8mb4 collate utf8bin;
Error 1273 (HY000): Unknown collation: 'utf8bin'
alter table t collate LATIN1_GENERAL_CI charset utf8 collate utf8_bin;
Error 1302 (HY000): Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8'
Got one of the listed errors
alter table t collate LATIN1_GENERAL_CI collate UTF8MB4_UNICODE_ci collate utf8_bin;
Error 1253 (42000): COLLATION 'utf8mb4_unicode_ci' is not valid for CHARACTER SET 'latin1'
Got one of the listed errors
drop table t;
create table t(a varchar(20) charset latin1);
insert into t values ("t_value");
Expand Down
7 changes: 2 additions & 5 deletions tests/integrationtest/r/collation_misc_enabled.result
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ Error 8200 (HY000): Unsupported modify charset from latin1 to utf8
alter table t modify column a varchar(20) charset utf8mb4 collate utf8bin;
Error 1273 (HY000): Unknown collation: 'utf8bin'
alter table t collate LATIN1_GENERAL_CI charset utf8 collate utf8_bin;
Error 1273 (HY000): Unsupported collation when new collation is enabled: 'latin1_general_ci'
Got one of the listed errors
alter table t collate LATIN1_GENERAL_CI collate UTF8MB4_UNICODE_ci collate utf8_bin;
Error 1273 (HY000): Unsupported collation when new collation is enabled: 'latin1_general_ci'
Got one of the listed errors
drop table t;
create table t(a varchar(20) charset latin1);
insert into t values ("t_value");
Expand All @@ -51,7 +51,6 @@ 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 (HY000): Unsupported collation when new collation is enabled: 'latin1_swedish_ci'
use cd_test_utf8;
select @@character_set_database;
@@character_set_database
Expand All @@ -60,15 +59,13 @@ select @@collation_database;
@@collation_database
utf8_bin
use cd_test_latin1;
Error 1049 (42000): Unknown database 'cd_test_latin1'
select @@character_set_database;
@@character_set_database
utf8
select @@collation_database;
@@collation_database
utf8_bin
create database if not exists test_db CHARACTER SET latin1 COLLATE 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
Expand Down
4 changes: 2 additions & 2 deletions tests/integrationtest/r/executor/executor.result
Original file line number Diff line number Diff line change
Expand Up @@ -3933,8 +3933,8 @@ a
1
2
3
SELECT `s`.`count(a)` FROM (SELECT COUNT(`a`) FROM `test`.`t`) AS `s`;
Error 1146 (42S02): Table 'test.t' doesn't exist
SELECT `s`.`count(a)` FROM (SELECT COUNT(`a`) FROM `executor__executor`.`t`) AS `s`;
Error 1054 (42S22): Unknown column 's.count(a)' in 'field list'
drop view v;
create definer='root'@'localhost' view v as select * from (select count(a) from t) s;
select * from v;
Expand Down
4 changes: 2 additions & 2 deletions tests/integrationtest/r/executor/write.result
Original file line number Diff line number Diff line change
Expand Up @@ -2012,8 +2012,8 @@ replace replace_test_1 select id, c1 from replace_test;
affected rows: 4
info: Records: 4 Duplicates: 0 Warnings: 0
begin;
replace replace_test_0 select c1 from replace_test;
Error 1146 (42S02): Table 'executor__write.replace_test_0' doesn't exist
replace replace_test_1 select c1 from replace_test;
Error 1136 (21S01): Column count doesn't match value count at row 1
rollback;
create table replace_test_2 (id int, c1 int);
replace replace_test_1 select id, c1 from replace_test union select id * 10, c1 * 10 from replace_test;
Expand Down
11 changes: 5 additions & 6 deletions tests/integrationtest/r/privilege/privileges.result
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,14 @@ set global innodb_commit_concurrency=16;
Error 1227 (42000): Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation
# TestCheckPointGetDBPrivilege
CREATE USER 'tester'@'localhost';
GRANT SELECT,UPDATE ON privilege__privileges.* TO 'tester'@'localhost';
GRANT SELECT,UPDATE ON privilege__privileges2.* TO 'tester'@'localhost';
create database if not exists privilege__privileges;
create table privilege__privileges.t(id int, v int, primary key(id));
insert into privilege__privileges.t(id, v) values(1, 1);
use privilege__privileges;
select * from privilege__privileges.t where id = 1;
id v
1 1
Error 1142 (42000): SELECT command denied to user 'tester'@'localhost' for table 't'
update privilege__privileges.t set v = 2 where id = 1;
Error 1142 (42000): SELECT command denied to user 'tester'@'localhost' for table 't'
DROP USER 'tester'@'localhost';
CREATE DATABASE if not exists privilege__privileges;
USE privilege__privileges;
Expand Down Expand Up @@ -328,8 +327,8 @@ GRANT USAGE ON *.* TO 'column'@'%'
GRANT SELECT(a), INSERT(c), UPDATE(a, b) ON `privilege__privileges`.`column_table` TO 'column'@'%'
CREATE USER 'tableaccess'@'localhost';
CREATE TABLE fieldlistt1 (a int);
desc fieldlistt1;
Error 1046 (3D000): No database selected
desc privilege__privileges.fieldlistt1;
Error 1142 (42000): SELECT command denied to user 'tableaccess'@'localhost' for table 'fieldlistt1'
CREATE USER tr_insert;
CREATE USER tr_update;
CREATE USER tr_delete;
Expand Down
6 changes: 3 additions & 3 deletions tests/integrationtest/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -235,18 +235,18 @@ function run_mysql_tester()
if [ $record -eq 1 ]; then
if [ "$record_case" = 'all' ]; then
echo "record all cases"
$mysql_tester -port "$port" --collation-disable=$coll_disabled --record
$mysql_tester -port "$port" --check-error=true --collation-disable=$coll_disabled --record
else
echo "record result for case: \"$record_case\""
$mysql_tester -port "$port" --collation-disable=$coll_disabled --record $record_case
$mysql_tester -port "$port" --check-error=true --collation-disable=$coll_disabled --record $record_case
fi
else
if [ -z "$tests" ]; then
echo "run all integration test cases ($coll_msg)"
else
echo "run integration test cases($coll_msg): $tests"
fi
$mysql_tester -port "$port" --collation-disable=$coll_disabled $tests
$mysql_tester -port "$port" --check-error=true --collation-disable=$coll_disabled $tests
fi
}

Expand Down
10 changes: 3 additions & 7 deletions tests/integrationtest/t/collation_agg_func.test
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ select approx_count_distinct(value collate utf8mb4_bin, value1) from t;
# minMax
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"));
--error 1265
--error 0,1265
insert into tt values ("A", "A", "A", JSON_OBJECT("A", "A"));
--error 1265
--error 0,1265
insert into tt values ("b", "b", "b", JSON_OBJECT("b", "b"));
insert into tt values ("B", "B", "B", JSON_OBJECT("B", "B"));
insert into tt values ("c", "c", "c", JSON_OBJECT("c", "c"));
--error 1265
--error 0,1265
insert into tt values ("C", "C", "C", JSON_OBJECT("C", "C"));
split table tt by (0), (1), (2), (3), (4), (5);
desc format='brief' select min(a) from tt;
Expand Down Expand Up @@ -88,14 +88,10 @@ desc format='brief' select max(c collate utf8mb4_bin) from tt;
select max(c collate utf8mb4_bin) from tt;
desc format='brief' select min(d) from tt;
select min(d) from tt;
--error 1253
desc format='brief' select min(d collate utf8mb4_bin) from tt;
--error 1253
select min(d collate utf8mb4_bin) from tt;
desc format='brief' select max(d) from tt;
select max(d) from tt;
--error 1253
desc format='brief' select max(d collate utf8mb4_bin) from tt;
--error 1253
select max(d collate utf8mb4_bin) from tt;

5 changes: 2 additions & 3 deletions tests/integrationtest/t/collation_check_use_collation.test
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ CREATE TABLE `t1` (
);
insert into t values ("A");
# Ignore error for the disabled new-collation case.
--error 1265
insert into t1 values ("a");
select a as a_col from t where t.a = all (select a collate utf8mb4_general_ci from t1);
select a as a_col from t where t.a != any (select a collate utf8mb4_general_ci from t1);
Expand All @@ -29,7 +28,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");
# Ignore error for the disabled new-collation case.
--error 1265
--error 0,1265
insert into t values ("B", "b");
select * from t where 'B' collate utf8mb4_general_ci in (a);
select * from t where 'B' collate utf8mb4_bin in (a);
Expand Down Expand Up @@ -57,7 +56,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");
# Ignore error for the disabled new-collation case.
--error 1265
--error 0,1265
insert into t values ("B", "b");
select * from t where 'B' collate utf8mb4_general_ci in (a);
select * from t where 'B' collate utf8mb4_bin in (a);
Expand Down
6 changes: 3 additions & 3 deletions tests/integrationtest/t/collation_misc.test
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ select * from t;

# TestCharsetDatabase
create database if not exists cd_test_utf8 CHARACTER SET utf8 COLLATE utf8_bin;
--error 1273
--error 0,1273
create database if not exists cd_test_latin1 CHARACTER SET latin1 COLLATE latin1_swedish_ci;
use cd_test_utf8;
select @@character_set_database;
select @@collation_database;
--error 1049
--error 0,1049
use cd_test_latin1;
select @@character_set_database;
select @@collation_database;

# DefaultDBAfterDropCurDB
--error 1273
--error 0,1273
create database if not exists test_db CHARACTER SET latin1 COLLATE latin1_swedish_ci;

# CollationUnion
Expand Down
7 changes: 3 additions & 4 deletions tests/integrationtest/t/ddl/constraint.test
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,6 @@ create table t(a int);
insert into t values(1), (2), (3);
-- error 3819
alter table t add constraint check(a < 2);
-- error 3819
alter table t add constraint check(a < 2) not enforced;

# TestAlterTableDropCheckConstraints
Expand Down Expand Up @@ -666,12 +665,12 @@ CREATE TABLE `t` (`a` int(11) DEFAULT NULL);
show create table t;
insert t values(1);
select * from t;
-- error 3940
-- error 3819
alter table t ADD CONSTRAINT chk CHECK (a > 1) ENFORCED;
-- error 3940
-- error 3819
alter table t ADD CONSTRAINT chk CHECK (a > 1) ENFORCED;
alter table t ADD CONSTRAINT chk CHECK (a > 1) NOT ENFORCED;
-- error 3940
-- error 3819
ALTER TABLE t ALTER CONSTRAINT chk ENFORCED;
show create table t;
alter table t drop CONSTRAINT chk;
Expand Down
4 changes: 2 additions & 2 deletions tests/integrationtest/t/ddl/db_partition.test
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ explain format = 'brief' select * from t where a is null;
explain format = 'brief' select * from t where a = 3;
# TODO: check ranges with 1,2 and 3 matching values, including 'holes' matching DEFAULT
# DEFAULT partition will not be used in reorganize partition if not included in the source/destination
-- error 8112
-- error 1526
alter table t reorganize partition p0 into (partition p0 values in (0));
drop table t;
CREATE TABLE t (a VARCHAR(100),b INT) PARTITION BY LIST COLUMNS (a) (PARTITION p1 VALUES IN ('a', 'b', 'DEFAULT'),PARTITION pDef DEFAULT);
Expand Down Expand Up @@ -369,7 +369,7 @@ explain format = 'brief' select * from t where a >= "3" and a <= "4";
--sorted_result
select * from t where a >= "3" and a <= "4";
# DEFAULT partition will not be used in reorganize partition if not included in the source/destination
-- error 8112
-- error 1526
alter table t reorganize partition p0 into (partition p0 values in (0));
set @@tidb_partition_prune_mode = default;

Expand Down
34 changes: 17 additions & 17 deletions tests/integrationtest/t/ddl/table_modify.test
Original file line number Diff line number Diff line change
Expand Up @@ -20,45 +20,45 @@ create table dbCollateTest (a varchar(10));
show create table dbCollateTest;
-- error 1291
create table t_enum (a enum('e','e'));
-- error 1290
-- error 1115
create table t_enum (a enum('e','E')) charset=utf7 collate=utf8_general_ci;
-- error 1290
-- error 1115
create table t_enum (a enum('abc','Abc')) charset=utf7 collate=utf8_general_ci;
-- error 1290
-- error 1115
create table t_enum (a enum('e','E')) charset=utf7 collate=utf8_unicode_ci;
-- error 1290
-- error 1115
create table t_enum (a enum('ss','ß')) charset=utf7 collate=utf8_unicode_ci;
-- error 1290
-- error 1115
create table t_enum (a enum('æ','ae')) charset=utf7mb4 collate=utf8mb4_0900_ai_ci;
-- error 1290
-- error 1291
create table t_enum (a set('e','e'));
-- error 1290
-- error 1115
create table t_enum (a set('e','E')) charset=utf7 collate=utf8_general_ci;
-- error 1290
-- error 1115
create table t_enum (a set('abc','Abc')) charset=utf7 collate=utf8_general_ci;
-- error 1290
-- error 1115
create table t_enum (a enum('B','b')) charset=utf7 collate=utf8_general_ci;
-- error 1290
-- error 1115
create table t_enum (a set('e','E')) charset=utf7 collate=utf8_unicode_ci;
-- error 1290
-- error 1115
create table t_enum (a set('ss','ß')) charset=utf7 collate=utf8_unicode_ci;
-- error 1290
-- error 1115
create table t_enum (a enum('ss','ß')) charset=utf7 collate=utf8_unicode_ci;
-- error 1290
-- error 1115
create table t_enum (a set('æ','ae')) charset=utf7mb4 collate=utf8mb4_0900_ai_ci;
CREATE TABLE x (a INT) ENGINE = MyISAM;
CREATE TABLE y (a INT) ENGINE = MyISAM;
-- error 8231
-- error 8232
CREATE TABLE z (a INT) ENGINE = MERGE UNION = (x, y);
-- error 8231
-- error 8232
ALTER TABLE x UNION = (y);
drop table x;
drop table y;
CREATE TABLE x (a INT) ENGINE = MyISAM;
CREATE TABLE y (a INT) ENGINE = MyISAM;
-- error 8232
-- error 8233
CREATE TABLE z (a INT) ENGINE = MERGE INSERT_METHOD=LAST;
-- error 8232
-- error 8233
ALTER TABLE x INSERT_METHOD=LAST;
drop table x;
drop table y;
Expand Down
10 changes: 5 additions & 5 deletions tests/integrationtest/t/executor/aggregate.test
Original file line number Diff line number Diff line change
Expand Up @@ -741,15 +741,15 @@ select b like '%a' from t group by c;
select c REGEXP '1.*' from t group by b;
--error 1055
select -b from t group by c;
--error 1055
--error 8123
select a, max(b) from t;
--error 1055
--error 8123
select sum(a)+b from t;
--error 1055
--error 8123
select count(b), c from t;
select count(b), any_value(c) from t;
select count(b), any_value(c) + 2 from t;
--error 1055
--error 8123
select distinct a, b, count(a) from t;
select a from t group by a,b,c;
select b from t group by b;
Expand Down Expand Up @@ -804,7 +804,7 @@ select * from (select * from t) as e group by b,c;
select c from t group by c,d order by d;
--error 1055
select c from t group by c order by d;
--error 1055
--error 1052
select c from t,x group by t.c;
set sql_mode = default;
set @@session.tidb_enable_new_only_full_group_by_check = default;
Expand Down
2 changes: 1 addition & 1 deletion tests/integrationtest/t/executor/delete.test
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ SHOW WARNINGS;
delete from delete_test;
--disable_info
create view v as select * from delete_test;
-- error 1356
-- error 1105
delete from v where name = 'aaa';
drop view v;
create sequence seq;
Expand Down
2 changes: 1 addition & 1 deletion tests/integrationtest/t/executor/executor.test
Original file line number Diff line number Diff line change
Expand Up @@ -2226,7 +2226,7 @@ drop view v;
create definer='root'@'localhost' view v as select * from (select a from t group by a) s;
select * from v order by 1;
-- error 1054
SELECT `s`.`count(a)` FROM (SELECT COUNT(`a`) FROM `test`.`t`) AS `s`;
SELECT `s`.`count(a)` FROM (SELECT COUNT(`a`) FROM `executor__executor`.`t`) AS `s`;
drop view v;
create definer='root'@'localhost' view v as select * from (select count(a) from t) s;
select * from v;
Expand Down
Loading

0 comments on commit 8dac756

Please sign in to comment.