diff options
Diffstat (limited to 'mysql-test/r')
356 files changed, 34150 insertions, 3650 deletions
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index e572fdb197c..9c0a25f6d61 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -293,6 +293,15 @@ t2 CREATE TABLE `t2` ( drop table if exists t1, t2; create table t1 (a int, b int, c int, d int, e int, f int, g int, h int,i int, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM; insert into t1 (a) values(1); +Warnings: +Warning 1364 Field 'b' doesn't have a default value +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value +Warning 1364 Field 'e' doesn't have a default value +Warning 1364 Field 'f' doesn't have a default value +Warning 1364 Field 'g' doesn't have a default value +Warning 1364 Field 'h' doesn't have a default value +Warning 1364 Field 'i' doesn't have a default value show table status like 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment t1 MyISAM 10 Fixed 1 37 X X X X X X X X latin1_swedish_ci NULL @@ -2021,3 +2030,27 @@ ALTER TABLE t1 ADD PRIMARY KEY IF NOT EXISTS event_id (event_id,market_id); Warnings: Note 1061 Multiple primary key defined DROP TABLE t1; +# +# MDEV-7374 : Losing connection to MySQL while running ALTER TABLE +# +CREATE TABLE t1(i INT) ENGINE=INNODB; +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8); +INSERT INTO t1 SELECT a.* FROM t1 a, t1 b, t1 c, t1 d, t1 e; +ALTER TABLE t1 MODIFY i FLOAT; +DROP TABLE t1; +# +# Start of 10.1 tests +# +# +# MDEV-7816 ALTER with DROP INDEX and ADD INDEX .. COMMENT='comment2' ignores the new comment +# +CREATE TABLE t1(a INT); +CREATE INDEX i1 ON t1(a) COMMENT 'comment1'; +ALTER TABLE t1 DROP INDEX i1, ADD INDEX i1(a) COMMENT 'comment2'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + KEY `i1` (`a`) COMMENT 'comment2' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; diff --git a/mysql-test/r/alter_table_online.result b/mysql-test/r/alter_table_online.result index f416c53f42c..e3f285437a7 100644 --- a/mysql-test/r/alter_table_online.result +++ b/mysql-test/r/alter_table_online.result @@ -73,3 +73,117 @@ drop table t1; create table t1 (a int) partition by hash(a) partitions 2; alter online table t1 modify a int comment 'test'; drop table t1; +# +# MDEV-8948 ALTER ... INPLACE does work for BINARY, BLOB +# +CREATE TABLE t1 (a BINARY(10)); +ALTER TABLE t1 MODIFY a BINARY(10), ALGORITHM=INPLACE; +DROP TABLE t1; +CREATE TABLE t1 (a VARBINARY(10)); +ALTER TABLE t1 MODIFY a VARBINARY(10), ALGORITHM=INPLACE; +DROP TABLE t1; +CREATE TABLE t1 (a TINYBLOB); +ALTER TABLE t1 MODIFY a TINYBLOB, ALGORITHM=INPLACE; +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMBLOB); +ALTER TABLE t1 MODIFY a MEDIUMBLOB, ALGORITHM=INPLACE; +DROP TABLE t1; +CREATE TABLE t1 (a BLOB); +ALTER TABLE t1 MODIFY a BLOB, ALGORITHM=INPLACE; +DROP TABLE t1; +CREATE TABLE t1 (a LONGBLOB); +ALTER TABLE t1 MODIFY a LONGBLOB, ALGORITHM=INPLACE; +DROP TABLE t1; +CREATE TABLE t1 (a CHAR(10)); +ALTER TABLE t1 MODIFY a CHAR(10), ALGORITHM=INPLACE; +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)); +ALTER TABLE t1 MODIFY a VARCHAR(10), ALGORITHM=INPLACE; +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT); +ALTER TABLE t1 MODIFY a TINYTEXT, ALGORITHM=INPLACE; +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT); +ALTER TABLE t1 MODIFY a MEDIUMTEXT, ALGORITHM=INPLACE; +DROP TABLE t1; +CREATE TABLE t1 (a TEXT); +ALTER TABLE t1 MODIFY a TEXT, ALGORITHM=INPLACE; +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT); +ALTER TABLE t1 MODIFY a LONGTEXT, ALGORITHM=INPLACE; +DROP TABLE t1; +CREATE TABLE t1 (a CHAR(10)); +ALTER TABLE t1 MODIFY a CHAR(10) COLLATE latin1_bin, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)); +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE latin1_bin, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT); +ALTER TABLE t1 MODIFY a TINYTEXT COLLATE latin1_bin, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT); +ALTER TABLE t1 MODIFY a MEDIUMTEXT COLLATE latin1_bin, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a TEXT); +ALTER TABLE t1 MODIFY a TEXT COLLATE latin1_bin, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT); +ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_bin, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a CHAR(10) COLLATE latin1_bin); +ALTER TABLE t1 MODIFY a CHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COLLATE latin1_bin); +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COLLATE latin1_bin); +ALTER TABLE t1 MODIFY a TINYTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COLLATE latin1_bin); +ALTER TABLE t1 MODIFY a MEDIUMTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COLLATE latin1_bin); +ALTER TABLE t1 MODIFY a TEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COLLATE latin1_bin); +ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a CHAR(10) COLLATE latin1_general_ci); +ALTER TABLE t1 MODIFY a CHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) COLLATE latin1_general_ci); +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a TINYTEXT COLLATE latin1_general_ci); +ALTER TABLE t1 MODIFY a TINYTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMTEXT COLLATE latin1_general_ci); +ALTER TABLE t1 MODIFY a MEDIUMTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COLLATE latin1_general_ci); +ALTER TABLE t1 MODIFY a TEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a LONGTEXT COLLATE latin1_general_ci); +ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +# +# End of MDEV-8948 ALTER ... INPLACE does work for BINARY, BLOB +# diff --git a/mysql-test/r/analyze_format_json.result b/mysql-test/r/analyze_format_json.result new file mode 100644 index 00000000000..69930bc0215 --- /dev/null +++ b/mysql-test/r/analyze_format_json.result @@ -0,0 +1,765 @@ +drop table if exists t0,t1,t2,t3; +create table t0 (a int); +INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +# r_filtered=30%, because 3 rows match: 0,1,2 +analyze format=json select * from t0 where a<3; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t0", + "access_type": "ALL", + "r_loops": 1, + "rows": 10, + "r_rows": 10, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 30, + "attached_condition": "(t0.a < 3)" + } + } +} +create table t1 (a int, b int, c int, key(a)); +insert into t1 select A.a*10 + B.a, A.a*10 + B.a, A.a*10 + B.a from t0 A, t0 B; +analyze +select * from t0, t1 where t1.a=t0.a and t0.a > 9; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 100.00 0.00 Using where +1 SIMPLE t1 ref a a 5 test.t0.a 1 NULL 100.00 NULL +analyze format=json +select * from t0, t1 where t1.a=t0.a and t0.a > 9; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t0", + "access_type": "ALL", + "r_loops": 1, + "rows": 10, + "r_rows": 10, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 0, + "attached_condition": "((t0.a > 9) and (t0.a is not null))" + }, + "table": { + "table_name": "t1", + "access_type": "ref", + "possible_keys": ["a"], + "key": "a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t0.a"], + "r_loops": 0, + "rows": 1, + "r_rows": null, + "filtered": 100, + "r_filtered": null + } + } +} +analyze +select * from t0, t1 where t1.a=t0.a and t1.b<4; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using where +1 SIMPLE t1 ref a a 5 test.t0.a 1 1.00 100.00 40.00 Using where +analyze format=json +select * from t0, t1 where t1.a=t0.a and t1.b<4; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t0", + "access_type": "ALL", + "r_loops": 1, + "rows": 10, + "r_rows": 10, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100, + "attached_condition": "(t0.a is not null)" + }, + "table": { + "table_name": "t1", + "access_type": "ref", + "possible_keys": ["a"], + "key": "a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t0.a"], + "r_loops": 10, + "rows": 1, + "r_rows": 1, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 40, + "attached_condition": "(t1.b < 4)" + } + } +} +analyze +select * from t1 tbl1, t1 tbl2 where tbl1.b<2 and tbl2.b>5; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE tbl1 ALL NULL NULL NULL NULL 100 100.00 100.00 2.00 Using where +1 SIMPLE tbl2 ALL NULL NULL NULL NULL 100 100.00 100.00 94.00 Using where; Using join buffer (flat, BNL join) +analyze format=json +select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "tbl1", + "access_type": "ALL", + "r_loops": 1, + "rows": 100, + "r_rows": 100, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 20, + "attached_condition": "(tbl1.b < 20)" + }, + "block-nl-join": { + "table": { + "table_name": "tbl2", + "access_type": "ALL", + "r_loops": 1, + "rows": 100, + "r_rows": 100, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 60, + "attached_condition": "(tbl2.b < 60)" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "r_filtered": 100 + } + } +} +analyze format=json +select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60 and tbl1.c > tbl2.c; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "tbl1", + "access_type": "ALL", + "r_loops": 1, + "rows": 100, + "r_rows": 100, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 20, + "attached_condition": "(tbl1.b < 20)" + }, + "block-nl-join": { + "table": { + "table_name": "tbl2", + "access_type": "ALL", + "r_loops": 1, + "rows": 100, + "r_rows": 100, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 60, + "attached_condition": "(tbl2.b < 60)" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "(tbl1.c > tbl2.c)", + "r_filtered": 15.833 + } + } +} +drop table t1; +drop table t0; +# +# MDEV-7674: ANALYZE shows r_rows=0 +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, key(a)); +insert into t2 values (0),(1); +analyze format=json select * from t1 straight_join t2 force index(a) where t2.a=t1.a; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 1, + "rows": 10, + "r_rows": 10, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100, + "attached_condition": "(t1.a is not null)" + }, + "table": { + "table_name": "t2", + "access_type": "ref", + "possible_keys": ["a"], + "key": "a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t1.a"], + "r_loops": 10, + "rows": 2, + "r_rows": 0.2, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100, + "using_index": true + } + } +} +drop table t1,t2; +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +# +# MDEV-7679: ANALYZE crashes when printing WHERE when no default db +# +select database(); +database() +test +select database(); +database() +NULL +analyze format=json select * from test.t1 where t1.a<5; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 1, + "rows": 10, + "r_rows": 10, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 50, + "attached_condition": "(test.t1.a < 5)" + } + } +} +drop table t1; +# +# MDEV-7812: ANALYZE FORMAT=JSON UPDATE/DELETE doesnt print +# the r_total_time_ms +# +create table t2(a int); +insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t3(a int); +insert into t3 select A.a + B.a* 10 + C.a * 100 from t2 A, t2 B, t2 C; +create table t1 (pk int primary key); +insert into t1 select a from t3; +alter table t1 add b int; +analyze format=json +update t1 set b=pk; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_total_time_ms": "REPLACED", + "table": { + "update": 1, + "table_name": "t1", + "access_type": "ALL", + "rows": 1000, + "r_rows": 1000, + "r_filtered": 100, + "r_total_time_ms": "REPLACED" + } + } +} +analyze format=json +select * from t1 where pk < 10 and b > 4; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t1", + "access_type": "range", + "possible_keys": ["PRIMARY"], + "key": "PRIMARY", + "key_length": "4", + "used_key_parts": ["pk"], + "r_loops": 1, + "rows": 11, + "r_rows": 10, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 50, + "index_condition": "(t1.pk < 10)", + "attached_condition": "(t1.b > 4)" + } + } +} +analyze format=json +delete from t1 where pk < 10 and b > 4; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_total_time_ms": "REPLACED", + "table": { + "delete": 1, + "table_name": "t1", + "access_type": "range", + "possible_keys": ["PRIMARY"], + "key": "PRIMARY", + "key_length": "4", + "used_key_parts": ["pk"], + "rows": 11, + "r_rows": 10, + "r_filtered": 50, + "r_total_time_ms": "REPLACED", + "attached_condition": "((t1.pk < 10) and (t1.b > 4))" + } + } +} +drop table t1, t3, t2; +# +# MDEV-7833:ANALYZE FORMAT=JSON and Range checked for each record +# +create table t3(a int); +insert into t3 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t4(a int); +insert into t4 select A.a + B.a* 10 + C.a * 100 from t3 A, t3 B, t3 C; +create table t1 (lb1 int, rb1 int, lb2 int, rb2 int, c1 int, c2 int); +insert into t1 values (1,2,10,20,15,15); +insert into t1 values (3,5,10,20,15,15); +insert into t1 values (10,20,10,20,15,15); +insert into t1 values (10,20,1,2,15,15); +insert into t1 values (10,20,10,20,1,3); +create table t2 (key1 int, key2 int, key3 int, key4 int, col1 int, +key(key1), key(key2), key(key3), key(key4)); +insert into t2 select a,a,a,a,a from t3; +insert into t2 select 15,15,15,15,15 from t4; +analyze format=json +select * from t1, t2 where (t2.key1 between t1.lb1 and t1.rb1) and +(t2.key2 between t1.lb2 and t1.rb2) and +(t2.key3=t1.c1 OR t2.key4=t1.c2); +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 1, + "rows": 5, + "r_rows": 5, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + }, + "range-checked-for-each-record": { + "keys": ["key1", "key2", "key3", "key4"], + "r_keys": { + "full_scan": 1, + "index_merge": 1, + "range": { + "key1": 2, + "key2": 1, + "key3": 0, + "key4": 0 + } + }, + "table": { + "table_name": "t2", + "access_type": "ALL", + "possible_keys": ["key1", "key2", "key3", "key4"], + "r_loops": 5, + "rows": 1010, + "r_rows": 203.8, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 98.135 + } + } + } +} +drop table t1,t2,t3,t4; +# +# MDEV-7904: ANALYZE FORMAT=JSON SELECT .. UNION SELECT doesn't print r_rows for union output +# +create table t0 (a int); +INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (a int); +INSERT INTO t1 select * from t0; +analyze format=json (select * from t1 tbl1 where a<5) union (select * from t1 tbl2 where a in (2,3)); +ANALYZE +{ + "query_block": { + "union_result": { + "table_name": "<union1,2>", + "access_type": "ALL", + "r_loops": 1, + "r_rows": 5, + "query_specifications": [ + { + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "tbl1", + "access_type": "ALL", + "r_loops": 1, + "rows": 10, + "r_rows": 10, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 50, + "attached_condition": "(tbl1.a < 5)" + } + } + }, + { + "query_block": { + "select_id": 2, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "tbl2", + "access_type": "ALL", + "r_loops": 1, + "rows": 10, + "r_rows": 10, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 20, + "attached_condition": "(tbl2.a in (2,3))" + } + } + } + ] + } + } +} +drop table t0, t1; +# +# MDEV-7970: EXPLAIN FORMAT=JSON does not print HAVING +# +create table t0(a int); +insert into t0 values (0),(1),(2),(3); +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; +create table t2 ( +a int, +b int, +key (a) +); +insert into t2 select A.a*1000 + B.a, A.a*1000 + B.a from t0 A, t1 B; +# normal HAVING +analyze format=json select a, max(b) as TOP from t2 group by a having TOP > a; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "volatile parameter": "REPLACED", + "having_condition": "(TOP > a)", + "filesort": { + "r_loops": 1, + "volatile parameter": "REPLACED", + "r_used_priority_queue": false, + "r_output_rows": 0, + "volatile parameter": "REPLACED", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "r_loops": 1, + "rows": 256, + "r_rows": 256, + "volatile parameter": "REPLACED", + "filtered": 100, + "r_filtered": 100 + } + } + } + } +} +# HAVING is always TRUE (not printed) +analyze format=json select a, max(b) as TOP from t2 group by a having 1<>2; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "volatile parameter": "REPLACED", + "filesort": { + "r_loops": 1, + "volatile parameter": "REPLACED", + "r_used_priority_queue": false, + "r_output_rows": 256, + "volatile parameter": "REPLACED", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "r_loops": 1, + "rows": 256, + "r_rows": 256, + "volatile parameter": "REPLACED", + "filtered": 100, + "r_filtered": 100 + } + } + } + } +} +# HAVING is always FALSE (intercepted by message) +analyze format=json select a, max(b) as TOP from t2 group by a having 1=2; +ANALYZE +{ + "query_block": { + "select_id": 1, + "table": { + "message": "Impossible HAVING" + } + } +} +# HAVING is absent +analyze format=json select a, max(b) as TOP from t2 group by a; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "volatile parameter": "REPLACED", + "filesort": { + "r_loops": 1, + "volatile parameter": "REPLACED", + "r_used_priority_queue": false, + "r_output_rows": 256, + "volatile parameter": "REPLACED", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "r_loops": 1, + "rows": 256, + "r_rows": 256, + "volatile parameter": "REPLACED", + "filtered": 100, + "r_filtered": 100 + } + } + } + } +} +drop table t0, t1, t2; +# +# MDEV-7267: Server crashes in Item_field::print on ANALYZE FORMAT=JSON +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (3),(4); +ANALYZE FORMAT=JSON SELECT STRAIGHT_JOIN * FROM t1, t2 WHERE b IN ( SELECT a FROM t1 ); +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "volatile parameter": "REPLACED", + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 1, + "rows": 2, + "r_rows": 2, + "volatile parameter": "REPLACED", + "filtered": 100, + "r_filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<subquery2>", + "access_type": "ALL", + "possible_keys": ["distinct_key"], + "r_loops": 1, + "rows": 2, + "r_rows": 2, + "volatile parameter": "REPLACED", + "filtered": 100, + "r_filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "r_filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 2, + "r_loops": 1, + "volatile parameter": "REPLACED", + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 1, + "rows": 2, + "r_rows": 2, + "volatile parameter": "REPLACED", + "filtered": 100, + "r_filtered": 100 + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "r_loops": 1, + "rows": 2, + "r_rows": 2, + "volatile parameter": "REPLACED", + "filtered": 100, + "r_filtered": 100 + }, + "buffer_type": "incremental", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "(t2.b = `<subquery2>`.a)", + "r_filtered": 0 + } + } +} +drop table t1,t2; +# +# MDEV-8864: Server crash #2 in Item_field::print on ANALYZE FORMAT=JSON +# +CREATE TABLE t1 (f1 INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (f2 INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (2),(3); +CREATE TABLE t3 (f3 INT) ENGINE=MyISAM; +INSERT INTO t3 VALUES (3),(4); +ANALYZE FORMAT=JSON +SELECT GROUP_CONCAT(f3) AS gc, ( SELECT MAX(f1) FROM t1, t2 WHERE f2 = f3 ) sq +FROM t2, t3 +WHERE f3 IN ( 1, 2 ) +GROUP BY sq ORDER BY gc; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "volatile parameter": "REPLACED", + "filesort": { + "r_loops": 1, + "volatile parameter": "REPLACED", + "r_used_priority_queue": false, + "r_output_rows": 0, + "volatile parameter": "REPLACED", + "filesort": { + "r_loops": 1, + "volatile parameter": "REPLACED", + "r_used_priority_queue": false, + "r_output_rows": 0, + "volatile parameter": "REPLACED", + "temporary_table": { + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "r_loops": 1, + "rows": 2, + "r_rows": 2, + "volatile parameter": "REPLACED", + "filtered": 100, + "r_filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "t3", + "access_type": "ALL", + "r_loops": 1, + "rows": 2, + "r_rows": 2, + "volatile parameter": "REPLACED", + "filtered": 100, + "r_filtered": 0, + "attached_condition": "(t3.f3 in (1,2))" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "r_filtered": null + }, + "subqueries": [ + { + "expression_cache": { + "state": "uninitialized", + "r_loops": 0, + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 0, + "rows": 2, + "r_rows": null, + "filtered": 100, + "r_filtered": null + }, + "block-nl-join": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "r_loops": 0, + "rows": 2, + "r_rows": null, + "filtered": 100, + "r_filtered": null + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "(t2.f2 = t3.f3)", + "r_filtered": null + } + } + } + } + ] + } + } + } + } + } +} +drop table t1,t2,t3; diff --git a/mysql-test/r/analyze_stmt.result b/mysql-test/r/analyze_stmt.result new file mode 100644 index 00000000000..c3c98593210 --- /dev/null +++ b/mysql-test/r/analyze_stmt.result @@ -0,0 +1,336 @@ +drop table if exists t0,t1,t2,t3; +create table t0 (a int) engine=myisam; +INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (a int) engine=myisam; +INSERT INTO t1 select * from t0; +# Try a few basic selects to see that r_rows and r_filtered columns work +analyze select * from t1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 +analyze select * from t1 where a<5; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where +analyze select * from t1 where a>100; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 0.00 Using where +# ANALYZE DELETE will delete rows: +analyze delete from t1 where a in (2,3,4); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where +select * from t1; +a +0 +1 +5 +6 +7 +8 +9 +drop table t1; +# ANALYZE UPDATE will make updates: +create table t1(a int, b int); +insert into t1 select a,a from t0; +analyze update t1 set b=100+b where a in (6,7,8); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where +select * from t1; +a b +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 106 +7 107 +8 108 +9 9 +drop table t1; +# Check that UNION works +create table t1(a int, b int); +insert into t1 select a,a from t0; +analyze (select * from t1 A where a<5) union (select * from t1 B where a in (5,6)); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where +2 UNION B ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where +NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 7.00 NULL NULL +analyze (select * from t1 A where a<5) union (select * from t1 B where a in (1,2)); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where +2 UNION B ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where +NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 5.00 NULL NULL +drop table t1; +drop table t0; +# +# Try a subquery. +# +create table t0 (a int, b int); +insert into t0 values +(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +create table t1 (a int, b int); +insert into t1 values (1,1),(2,2),(3,3); +# See .test file for the right values of r_rows and r_filtered. +analyze select a, a in (select t0.b from t0 where t0.b+1=t1.b+1) from t1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 3.00 100.00 33.33 Using where +# Try a subquery that is never executed +analyze select a, a in (select t0.b from t0 where t0.b+1=t1.b+1) from t1 where t1.a > 5; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 3.00 100.00 0.00 Using where +2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where +drop table t0, t1; +# +# Tests for join buffering +# +create table t0 (a int, b int); +insert into t0 values +(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +create table t1 like t0; +insert into t1 select * from t0; +explain select * from t0, t1 where t0.a<5 and t1.a<5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +# These should have filtered=50 +analyze select * from t0, t1 where t0.a<5 and t1.a<5; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where; Using join buffer (flat, BNL join) +explain select * from t0, t1 where t0.a<5 and t1.b=t0.b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +# Now, t1 should have filtered=10 +analyze select * from t0, t1 where t0.a<5 and t1.b=t0.b; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where; Using join buffer (flat, BNL join) +explain select * from t0, t1 where t0.a<5 and t1.a<5 and t1.b=t0.b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +# Now, t1 should have filtered=10 +analyze select * from t0, t1 where t0.a<5 and t1.a<5 and t1.b=t0.b; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where; Using join buffer (flat, BNL join) +# TODO: Check what is counted for "range checked for each record". +# +# Test for joins +# +create table t2 (key1 int, key2x int, col1 int, key(key1), key(key2x)); +insert into t2 select A.a + 10 *B.a +100 * C.a, +(A.a + 10 *B.a +100 * C.a)*2, +A.a + 10 *B.a +100 * C.a +from t0 A, t0 B, t0 C; +# This always has matches, filtered=100%. +analyze select * from t1,t2 where t2.key1=t1.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using where +1 SIMPLE t2 ref key1 key1 5 test.t1.a 1 1.00 100.00 100.00 +# This shows r_rows=0. It is actually 0.5 (should r_rows be changed to double?) +analyze select * from t1,t2 where t2.key2x=t1.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using where +1 SIMPLE t2 ref key2x key2x 5 test.t1.a 1 0.50 100.00 100.00 +select * from t1,t2 where t2.key2x=t1.a; +a b key1 key2x col1 +0 0 0 0 0 +2 2 1 2 1 +4 4 2 4 2 +6 6 3 6 3 +8 8 4 8 4 +# This has t2.filtered=40% (there are 5 values: {0,1,2,3,4}. two of them have mod=0) +analyze select * from t1,t2 where t2.key2x=t1.a and mod(t2.col1,4)=0; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using where +1 SIMPLE t2 ref key2x key2x 5 test.t1.a 1 0.50 100.00 40.00 Using where +drop table t0,t1,t2; +# +# Check non-merged derived tables +# +create table t0 (a int, b int); +insert into t0 values +(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +update t0 set b=b/3; +analyze select * from (select count(*),max(a),b from t0 group by b) T; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 10 4.00 100.00 100.00 +2 DERIVED t0 ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using temporary; Using filesort +drop table t0; +# +# Check ORDER/GROUP BY +# +create table t0 (a int, b int); +insert into t0 values +(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +analyze select count(*),max(a),b from t0 where a<7 group by b; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 100.00 70.00 Using where; Using temporary; Using filesort +drop table t0; +# +# Check multi-table UPDATE/DELETE. +# +create table t0 (a int, b int); +create table t1 (a int, b int); +insert into t0 values (0,0),(2,2),(4,4), (8,8); +insert into t1 values (0,0),(2,2), (6,6); +analyze select * from t0,t1 where t0.a=t1.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t0 ALL NULL NULL NULL NULL 4 4.00 100.00 16.67 Using where; Using join buffer (flat, BNL join) +analyze update t0,t1 set t1.b=5555 where t0.a=t1.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t0 ALL NULL NULL NULL NULL 4 4.00 100.00 16.67 Using where +select * from t1; +a b +0 5555 +2 5555 +6 6 +analyze delete t1 from t1, t0 where t0.a=t1.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t0 ALL NULL NULL NULL NULL 4 4.00 100.00 16.67 Using where +select * from t1; +a b +6 6 +drop table t0, t1; +# +# MDEV-6393: ANALYZE SELECT crashes in Explain_query::print_explain with a non-existing column +# +create table t1 (i int); +insert into t1 values (1),(2); +analyze select a from t1; +ERROR 42S22: Unknown column 'a' in 'field list' +analyze delete from t1 where a=2; +ERROR 42S22: Unknown column 'a' in 'where clause' +analyze update t1 set a=2; +ERROR 42S22: Unknown column 'a' in 'field list' +create table t2 like t1; +insert into t2 select * from t1; +analyze update t2,t1 set t2.i=5 where t2.a=t1.a; +ERROR 42S22: Unknown column 't2.a' in 'where clause' +analyze delete t1 from t2,t1 where t2.a=t1.a; +ERROR 42S22: Unknown column 't2.a' in 'where clause' +drop table t1, t2; +# +# MDEV-6395: ANALYZE UPDATE/DELETE with impossible where does not produce any output +# +create table t1 (a int, b int, key(a)); +insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5); +analyze delete from t1 where 1 > 2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +analyze delete from t1 where a > 30 and a < 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +analyze update t1 set b=12345 where 1 > 2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +analyze update t1 set b=12345 where a > 30 and a < 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +drop table t1; +# +# MDEV-6398: ANALYZE UPDATE does not populate r_rows +# +create table t1 (i int); +insert into t1 values (1),(2),(3),(4); +analyze update t1 set i=8; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 +drop table t1; +# +# Check ANALYZE SELECT INTO +# +create table t1 (i int); +insert into t1 values (1); +analyze select * from t1 into @var; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 NULL 100.00 NULL +drop table t1; +# +# MDEV-6394: ANALYZE DELETE .. RETURNING fails with ERROR 2027 Malformed packet +# +create table t1 (i int); +analyze delete from t1 returning *; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 0 0.00 100.00 100.00 +drop table t1; +# +# MDEV-6396: ANALYZE INSERT/REPLACE is accepted, but does not produce a plan +# +create table t1 (a int primary key, b int); +analyze insert into t1 values (1,1); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +select * from t1; +a b +1 1 +analyze replace t1 values (1,2); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +select * from t1; +a b +1 2 +drop table t1; +# +# MDEV-6400 "ANALYZE SELECT ... INTO @var" doesn't set @var +# +create table t1(a int); +insert into t1 values (1),(2); +analyze select a from t1 where a <2 into @var; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 2.00 100.00 50.00 Using where +analyze select a from t1 into @var; +ERROR 42000: Result consisted of more than one row +analyze insert into t1 select * from t1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 2.00 100.00 100.00 Using temporary +analyze select * into outfile '../../tmp/data1.tmp' from t1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 +drop table t1; +# +# MDEV-7024: Assertion `! is_set()' failed in +# Diagnostics_area::set_eof_status on executing ANALYZE SELECT via PS +# +create table t1(a int); +prepare stmt from "analyze select * from t1"; +execute stmt; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +drop table t1; +# +# MDEV-7674: ANALYZE shows r_rows=0 +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, key(a)); +insert into t2 values (0),(1); +analyze select * from t1 straight_join t2 force index(a) where t2.a=t1.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using where +1 SIMPLE t2 ref a a 5 test.t1.a 2 0.20 100.00 100.00 Using index +drop table t1,t2; +# +# MDEV-8063: Unconditional ANALYZE DELETE does not delete rows +# +create table t1 (i int); +insert into t1 values (1),(2); +analyze delete from t1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL 2 NULL NULL NULL Deleting all rows +select * from t1; +i +insert into t1 values (1),(2); +explain delete from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL 2 Deleting all rows +select * from t1; +i +1 +2 +drop table t1; diff --git a/mysql-test/r/analyze_stmt_orderby.result b/mysql-test/r/analyze_stmt_orderby.result new file mode 100644 index 00000000000..be1f01a2a52 --- /dev/null +++ b/mysql-test/r/analyze_stmt_orderby.result @@ -0,0 +1,586 @@ +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; +create table t2 ( +a int, +b int, +key (a) +); +insert into t2 select A.a*1000 + B.a, A.a*1000 + B.a from t0 A, t1 B; +# +# Try an UPDATE that uses filesort: +# +explain +update t2 set b=b+1 order by b limit 5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 10000 Using filesort +explain format=json +update t2 set b=b+1 order by b limit 5; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "filesort": { + "table": { + "update": 1, + "table_name": "t2", + "access_type": "ALL", + "rows": 10000 + } + } + } +} +analyze format=json +update t2 set b=b+1 order by b limit 5; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_total_time_ms": "REPLACED", + "filesort": { + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "r_limit": 5, + "r_used_priority_queue": true, + "r_output_rows": 6, + "table": { + "update": 1, + "table_name": "t2", + "access_type": "ALL", + "rows": 10000, + "r_rows": 10000, + "r_filtered": 100, + "r_total_time_ms": "REPLACED" + } + } + } +} +# +# Try an UPDATE that uses buffering: +# +explain +update t2 set a=a+1 where a<10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range a a 5 NULL 8 Using where; Using buffer +explain format=json +update t2 set a=a+1 where a<10; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "buffer": { + "table": { + "update": 1, + "table_name": "t2", + "access_type": "range", + "possible_keys": ["a"], + "key": "a", + "key_length": "5", + "used_key_parts": ["a"], + "rows": 8, + "attached_condition": "(t2.a < 10)" + } + } + } +} +analyze format=json +update t2 set a=a+1 where a<10; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_total_time_ms": "REPLACED", + "buffer": { + "table": { + "update": 1, + "table_name": "t2", + "access_type": "range", + "possible_keys": ["a"], + "key": "a", + "key_length": "5", + "used_key_parts": ["a"], + "rows": 8, + "r_rows": 10, + "r_filtered": 100, + "r_total_time_ms": "REPLACED", + "attached_condition": "(t2.a < 10)" + } + } + } +} +# +# Try a DELETE that uses filesort: +# +explain +delete from t2 order by b limit 5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 10000 Using filesort +explain format=json +delete from t2 order by b limit 5; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "filesort": { + "table": { + "delete": 1, + "table_name": "t2", + "access_type": "ALL", + "rows": 10000 + } + } + } +} +analyze format=json +delete from t2 order by b limit 5; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_total_time_ms": "REPLACED", + "filesort": { + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "r_used_priority_queue": false, + "r_output_rows": 10000, + "r_buffer_size": "REPLACED", + "table": { + "delete": 1, + "table_name": "t2", + "access_type": "ALL", + "rows": 10000, + "r_rows": 10000, + "r_filtered": 100, + "r_total_time_ms": "REPLACED" + } + } + } +} +# +# Try a SELECT with QEP in form: filesort { tmp_table { join } } +# +explain +select * from t0,t2 where t2.a=t0.a order by t2.b limit 4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where; Using temporary; Using filesort +1 SIMPLE t2 ref a a 5 test.t0.a 1 +explain format=json +select * from t0,t2 where t2.a=t0.a order by t2.b limit 4; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "filesort": { + "temporary_table": { + "function": "buffer", + "table": { + "table_name": "t0", + "access_type": "ALL", + "rows": 10, + "filtered": 100, + "attached_condition": "(t0.a is not null)" + }, + "table": { + "table_name": "t2", + "access_type": "ref", + "possible_keys": ["a"], + "key": "a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t0.a"], + "rows": 1, + "filtered": 100 + } + } + } + } +} +analyze format=json +select * from t0,t2 where t2.a=t0.a order by t2.b limit 4; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "filesort": { + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "r_limit": 4, + "r_used_priority_queue": true, + "r_output_rows": 4, + "temporary_table": { + "table": { + "table_name": "t0", + "access_type": "ALL", + "r_loops": 1, + "rows": 10, + "r_rows": 10, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100, + "attached_condition": "(t0.a is not null)" + }, + "table": { + "table_name": "t2", + "access_type": "ref", + "possible_keys": ["a"], + "key": "a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t0.a"], + "r_loops": 10, + "rows": 1, + "r_rows": 0.4, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + } + } + } + } +} +# +# Try a SELECT with QEP in form: join { filesort { table0 }, table2 } +# +explain +select * from t0,t2 where t2.a=t0.a order by t0.a limit 4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where; Using filesort +1 SIMPLE t2 ref a a 5 test.t0.a 1 +explain format=json +select * from t0,t2 where t2.a=t0.a order by t0.a limit 4; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "read_sorted_file": { + "filesort": { + "table": { + "table_name": "t0", + "access_type": "ALL", + "rows": 10, + "filtered": 100, + "attached_condition": "(t0.a is not null)" + } + } + }, + "table": { + "table_name": "t2", + "access_type": "ref", + "possible_keys": ["a"], + "key": "a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t0.a"], + "rows": 1, + "filtered": 100 + } + } +} +analyze format=json +select * from t0,t2 where t2.a=t0.a order by t0.a limit 4; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "read_sorted_file": { + "r_rows": 10, + "filesort": { + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "r_used_priority_queue": false, + "r_output_rows": 10, + "r_buffer_size": "REPLACED", + "table": { + "table_name": "t0", + "access_type": "ALL", + "r_loops": 1, + "rows": 10, + "r_rows": 10, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 1, + "attached_condition": "(t0.a is not null)" + } + } + }, + "table": { + "table_name": "t2", + "access_type": "ref", + "possible_keys": ["a"], + "key": "a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t0.a"], + "r_loops": 10, + "rows": 1, + "r_rows": 0.4, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + } + } +} +drop table t2; +create table t2 ( +a int, +b int, +c int +); +insert into t2 +select +a.a+10*b.a+100*c.a, +b.a+10*c.a, +c.a +from t0 a, t0 b, t0 c; +analyze format=json +select MAX(b) from t2 where mod(a,2)=0 group by c; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "filesort": { + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "r_used_priority_queue": false, + "r_output_rows": 10, + "r_buffer_size": "REPLACED", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "r_loops": 1, + "rows": 1000, + "r_rows": 1000, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 50, + "attached_condition": "((t2.a % 2) = 0)" + } + } + } + } +} +drop table t2; +# +# MDEV-8282: crash in filesort() with simple ordered delete +# +create table t3(a int) engine=innodb; +delete from t3 order by a; +# EXPLAIN thinks it will use delete_all_rows(): +explain +delete from t3 order by a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL 1 Deleting all rows +# ANALYZE shows that delete_all_rows() didn't work and we deleted rows +# one-by-one: +analyze +delete from t3 order by a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t3 ALL NULL NULL NULL NULL 1 0.00 100.00 100.00 Using filesort +drop table t3; +# +# A test for duplicate_removal() +# +create table t3 (a int, b int); +insert into t3 select a, 123 from t0; +analyze format=json +select distinct max(t3.b) Q from t0, t3 where t0.a=t3.a group by t0.a order by null; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "duplicate_removal": { + "temporary_table": { + "table": { + "table_name": "t0", + "access_type": "ALL", + "r_loops": 1, + "rows": 10, + "r_rows": 10, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "t3", + "access_type": "ALL", + "r_loops": 1, + "rows": 10, + "r_rows": 10, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "(t3.a = t0.a)", + "r_filtered": 10 + } + } + } + } +} +# +# A query with two filesort calls: +# - first is needed to do group-by-group grouping to calculate COUNT(DISTINCT) +# - the second is need to produce ORDER BY. +# (see MDEV-7836 for description of the query plan) +create table t5 (a int , b int) ; +create table t6 like t5 ; +create table t7 like t5 ; +insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7), +(2, -1), (3, 10); +insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1); +insert into t7 values (3, 3), (2, 2), (1, 1); +# TODO: This ANALYZE output doesn't make it clear what is used for what. +analyze format=json +select count(distinct t5.b) as sum from t5, t6 +where t5.a=t6.a and t6.b > 0 and t5.a <= 5 +group by t5.a order by sum limit 1; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "filesort": { + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "r_limit": 1, + "r_used_priority_queue": true, + "r_output_rows": 2, + "filesort": { + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "r_used_priority_queue": false, + "r_output_rows": 6, + "r_buffer_size": "REPLACED", + "temporary_table": { + "temporary_table": { + "table": { + "table_name": "t6", + "access_type": "ALL", + "r_loops": 1, + "rows": 5, + "r_rows": 5, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 80, + "attached_condition": "((t6.b > 0) and (t6.a <= 5))" + }, + "block-nl-join": { + "table": { + "table_name": "t5", + "access_type": "ALL", + "r_loops": 1, + "rows": 7, + "r_rows": 7, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "(t5.a = t6.a)", + "r_filtered": 21.429 + } + } + } + } + } + } +} +explain format=json +select count(distinct t5.b) as sum from t5, t6 +where t5.a=t6.a and t6.b > 0 and t5.a <= 5 +group by t5.a order by sum limit 1; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "filesort": { + "temporary_table": { + "function": "buffer", + "table": { + "table_name": "t6", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "((t6.b > 0) and (t6.a <= 5))" + }, + "block-nl-join": { + "table": { + "table_name": "t5", + "access_type": "ALL", + "rows": 7, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "(t5.a = t6.a)" + } + } + } + } +} +drop table t5,t6,t7; +drop table t3; +# +# Tabular ANALYZE must get its data from execution tracker (and not from +# the query plan) +# +CREATE TABLE t2( +col1 int, +col2 int, +UNIQUE INDEX idx (col1, col2)) engine=myisam; +INSERT INTO t2(col1, col2) VALUES +(1,20),(2,19),(3,18),(4,17),(5,16),(6,15),(7,14),(8,13),(9,12),(10,11), +(11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1); +flush status; +explain +select col1 f1, col2 f2, col1 f3 from t2 group by f1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range NULL idx 5 NULL 7 Using index for group-by +analyze +select col1 f1, col2 f2, col1 f3 from t2 group by f1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 range NULL idx 5 NULL 7 20.00 100.00 100.00 Using index for group-by +analyze format=json +select col1 f1, col2 f2, col1 f3 from t2 group by f1; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t2", + "access_type": "range", + "key": "idx", + "key_length": "5", + "used_key_parts": ["col1"], + "r_loops": 1, + "rows": 7, + "r_rows": 20, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100, + "using_index_for_group_by": true + } + } +} +drop table t2; +drop table t0,t1; diff --git a/mysql-test/r/analyze_stmt_privileges.result b/mysql-test/r/analyze_stmt_privileges.result new file mode 100644 index 00000000000..d54b5b37863 --- /dev/null +++ b/mysql-test/r/analyze_stmt_privileges.result @@ -0,0 +1,41 @@ +# +# MDEV-7025 and MDEV-7027 ANALYZE SELECT/INSERT/UPDATE/DELETE from a +# view does not check access permissions on the underlying table +# +create database db; +use db; +create table t1 (i int, c varchar(8)); +insert into t1 values (1,'foo'),(2,'bar'),(3,'baz'),(4,'qux'); +create view v1 as select * from t1 where i > 1; +CREATE USER u1@localhost; +grant ALL on db.v1 to u1@localhost; +connect con1,localhost,u1,,; +select * from db.t1; +ERROR 42000: SELECT command denied to user 'u1'@'localhost' for table 't1' +explain select * from db.t1; +ERROR 42000: SELECT command denied to user 'u1'@'localhost' for table 't1' +analyze select * from db.t1; +ERROR 42000: SELECT command denied to user 'u1'@'localhost' for table 't1' +select * from db.v1; +i c +2 bar +3 baz +4 qux +explain select * from db.v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +analyze select * from db.v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE db.v1 SET i = 5; +explain UPDATE db.v1 SET i = 5; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +analyze UPDATE db.v1 SET i = 5; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM db.v1 WHERE i = 5; +explain DELETE FROM db.v1 WHERE i = 5; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +analyze DELETE FROM db.v1 WHERE i = 5; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +disconnect con1; +connection default; +drop user u1@localhost; +drop database db; diff --git a/mysql-test/r/analyze_stmt_privileges2.result b/mysql-test/r/analyze_stmt_privileges2.result new file mode 100644 index 00000000000..892791dd8f8 --- /dev/null +++ b/mysql-test/r/analyze_stmt_privileges2.result @@ -0,0 +1,5237 @@ +set GLOBAL sql_mode=""; +set LOCAL sql_mode=""; +CREATE DATABASE privtest_db; +CREATE TABLE privtest_db.t1 (a INT, b VARCHAR(3)) ENGINE=MyISAM; +CREATE TABLE privtest_db.t2 (a INT, b VARCHAR(3)) ENGINE=MyISAM; +CREATE VIEW privtest_db.v1 AS SELECT a, b FROM privtest_db.t1 WHERE b IS NOT NULL; +CREATE VIEW privtest_db.v2 AS SELECT * FROM privtest_db.v1 WHERE a > 0; +INSERT INTO privtest_db.t2 VALUES (1,'foo'), (2,'bar'), (3,'qux'); +GRANT SELECT ON privtest_db.t2 TO 'privtest'@'localhost'; +connect con1,localhost,privtest,,privtest_db; + +######################################################################### +# Underlying table permission tests +# (we modify permissions on the base table, keeping ALL on views) +######################################################################### + +connection default; +GRANT ALL ON privtest_db.v1 TO 'privtest'@'localhost'; +GRANT ALL ON privtest_db.v2 TO 'privtest'@'localhost'; +connection con1; + +#======================================================================== +# Test: No permissions on the table +#======================================================================== + +#------------------------------------------------------------------------ +# I/R/U/D/S on the table +# Expectation: Cannot run query, EXPLAIN, ANALYZE on the table +# because the query itself cannot be executed +#------------------------------------------------------------------------ +INSERT INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN INSERT INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE INSERT INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +INSERT INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN INSERT INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE INSERT INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +REPLACE INTO t1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN REPLACE INTO t1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE REPLACE INTO t1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +REPLACE INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN REPLACE INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE REPLACE INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +UPDATE t1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN UPDATE t1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE UPDATE t1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +UPDATE t1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN UPDATE t1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE UPDATE t1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +DELETE FROM t1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN DELETE FROM t1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE DELETE FROM t1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +DELETE FROM t1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN DELETE FROM t1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE DELETE FROM t1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +DELETE FROM t1 USING t1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN DELETE FROM t1 USING t1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE DELETE FROM t1 USING t1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +SELECT * FROM t1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN SELECT * FROM t1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE SELECT * FROM t1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +SELECT * FROM t1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN SELECT * FROM t1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE SELECT * FROM t1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Can run the queries, but not EXPLAIN or ANALYZE +# because the query plan cannot be shown +# (it would have revealed the structure of the table) +#------------------------------------------------------------------------ +INSERT INTO v1 (a) VALUES (10); +EXPLAIN INSERT INTO v1 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v1 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +INSERT INTO v1 SELECT * FROM t2; +EXPLAIN INSERT INTO v1 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v1 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v1 (a) VALUES (10); +EXPLAIN REPLACE INTO v1 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v1 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v1 SELECT * FROM t2; +EXPLAIN REPLACE INTO v1 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v1 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v1 SET a = 10; +EXPLAIN UPDATE v1 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v1 SET a = a + 1; +EXPLAIN UPDATE v1 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1; +EXPLAIN DELETE FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1 WHERE a = 10; +EXPLAIN DELETE FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1 USING v1, t2; +EXPLAIN DELETE FROM v1 USING v1, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v1 USING v1, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v1; +a b +EXPLAIN SELECT * FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v1 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run the queries, but not EXPLAIN or ANALYZE +# because the query plan cannot be shown +# (it would have revealed the structure of the table) +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +INSERT INTO v2 SELECT * FROM t2; +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 (a) VALUES (10); +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 SELECT * FROM t2; +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 WHERE a = 10; +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2; +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table + +#======================================================================== +# Test: Grant SELECT on the table +#======================================================================== + +connection default; +GRANT SELECT ON privtest_db.t1 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the table +# Expectation: Can only run SELECT, EXPLAIN SELECT, ANALYZE SELECT +#------------------------------------------------------------------------ +INSERT INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN INSERT INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE INSERT INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +INSERT INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN INSERT INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE INSERT INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +REPLACE INTO t1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN REPLACE INTO t1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE REPLACE INTO t1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +REPLACE INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN REPLACE INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE REPLACE INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +UPDATE t1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN UPDATE t1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE UPDATE t1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +UPDATE t1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN UPDATE t1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE UPDATE t1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +DELETE FROM t1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN DELETE FROM t1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE DELETE FROM t1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +DELETE FROM t1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN DELETE FROM t1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE DELETE FROM t1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +DELETE FROM t1 USING t1, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN DELETE FROM t1 USING t1, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE DELETE FROM t1 USING t1, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +SELECT * FROM t1; +a b +10 NULL +10 NULL +10 NULL +10 NULL +EXPLAIN SELECT * FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +ANALYZE SELECT * FROM t1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 +SELECT * FROM t1 WHERE a = 10; +a b +10 NULL +10 NULL +10 NULL +10 NULL +EXPLAIN SELECT * FROM t1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +ANALYZE SELECT * FROM t1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 Using where +SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 3.00 100.00 100.00 +1 PRIMARY t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Can run everything +#------------------------------------------------------------------------ +INSERT INTO v1 (a) VALUES (10); +EXPLAIN INSERT INTO v1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE INSERT INTO v1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +INSERT INTO v1 SELECT * FROM t2; +EXPLAIN INSERT INTO v1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE INSERT INTO v1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +REPLACE INTO v1 (a) VALUES (10); +EXPLAIN REPLACE INTO v1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE REPLACE INTO v1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +REPLACE INTO v1 SELECT * FROM t2; +EXPLAIN REPLACE INTO v1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE REPLACE INTO v1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +UPDATE v1 SET a = 10; +EXPLAIN UPDATE v1 SET a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 20 Using where +ANALYZE UPDATE v1 SET a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 20 20.00 100.00 60.00 Using where +UPDATE v1 SET a = a + 1; +EXPLAIN UPDATE v1 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 20 Using where +ANALYZE UPDATE v1 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 20 20.00 100.00 60.00 Using where +UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 ALL NULL NULL NULL NULL 20 Using where +ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 20 20.00 100.00 0.00 Using where +DELETE FROM v1; +EXPLAIN DELETE FROM v1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +ANALYZE DELETE FROM v1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +DELETE FROM v1 WHERE a = 10; +EXPLAIN DELETE FROM v1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +ANALYZE DELETE FROM v1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +DELETE FROM v1 USING v1, t2; +EXPLAIN DELETE FROM v1 USING v1, t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +ANALYZE DELETE FROM v1 USING v1, t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +SELECT * FROM v1; +a b +EXPLAIN SELECT * FROM v1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +ANALYZE SELECT * FROM v1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +SELECT * FROM v1 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +ANALYZE SELECT * FROM v1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 3.00 100.00 100.00 +1 PRIMARY t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run everything +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +EXPLAIN INSERT INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE INSERT INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +INSERT INTO v2 SELECT * FROM t2; +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE INSERT INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +REPLACE INTO v2 (a) VALUES (10); +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE REPLACE INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +REPLACE INTO v2 SELECT * FROM t2; +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 24 Using where +ANALYZE UPDATE v2 SET a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 24 24.00 100.00 50.00 Using where +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 24 Using where +ANALYZE UPDATE v2 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 24 24.00 100.00 50.00 Using where +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 24 Using where +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 24 24.00 100.00 0.00 Using where +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 Using where +ANALYZE DELETE FROM v2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where +DELETE FROM v2 WHERE a = 10; +EXPLAIN DELETE FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 Using where +ANALYZE DELETE FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where +DELETE FROM v2 USING v2, t2; +ANALYZE DELETE FROM v2 USING v2, t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 Using where +ANALYZE SELECT * FROM v2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 Using where +ANALYZE SELECT * FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 3.00 100.00 100.00 +1 PRIMARY t1 ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where + +#======================================================================== +# Test: Grant INSERT on the table +#======================================================================== + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost'; +GRANT INSERT ON privtest_db.t1 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the table +# Expectation: Can only run INSERT, EXPLAIN INSERT, ANALYZE INSERT +#------------------------------------------------------------------------ +INSERT INTO t1 (a) VALUES (10); +EXPLAIN INSERT INTO t1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE INSERT INTO t1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +INSERT INTO t1 SELECT * FROM t2; +EXPLAIN INSERT INTO t1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE INSERT INTO t1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +REPLACE INTO t1 (a) VALUES (10); +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN REPLACE INTO t1 (a) VALUES (10); +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE REPLACE INTO t1 (a) VALUES (10); +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +REPLACE INTO t1 SELECT * FROM t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN REPLACE INTO t1 SELECT * FROM t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE REPLACE INTO t1 SELECT * FROM t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +UPDATE t1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN UPDATE t1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE UPDATE t1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +UPDATE t1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN UPDATE t1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE UPDATE t1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +DELETE FROM t1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN DELETE FROM t1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE DELETE FROM t1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +DELETE FROM t1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN DELETE FROM t1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE DELETE FROM t1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +DELETE FROM t1 USING t1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN DELETE FROM t1 USING t1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE DELETE FROM t1 USING t1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +SELECT * FROM t1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN SELECT * FROM t1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE SELECT * FROM t1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +SELECT * FROM t1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN SELECT * FROM t1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE SELECT * FROM t1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Can run the queries, but not EXPLAIN or ANALYZE +# because the query plan cannot be shown +# (it would have revealed the structure of the table) +#------------------------------------------------------------------------ +INSERT INTO v1 (a) VALUES (10); +EXPLAIN INSERT INTO v1 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v1 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +INSERT INTO v1 SELECT * FROM t2; +EXPLAIN INSERT INTO v1 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v1 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v1 (a) VALUES (10); +EXPLAIN REPLACE INTO v1 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v1 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v1 SELECT * FROM t2; +EXPLAIN REPLACE INTO v1 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v1 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v1 SET a = 10; +EXPLAIN UPDATE v1 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v1 SET a = a + 1; +EXPLAIN UPDATE v1 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1; +EXPLAIN DELETE FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1 WHERE a = 10; +EXPLAIN DELETE FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1 USING v1, t2; +EXPLAIN DELETE FROM v1 USING v1, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v1 USING v1, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v1; +a b +EXPLAIN SELECT * FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v1 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run the queries, but not EXPLAIN or ANALYZE +# because the query plan cannot be shown +# (it would have revealed the structure of the table) +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +INSERT INTO v2 SELECT * FROM t2; +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 (a) VALUES (10); +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 SELECT * FROM t2; +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 WHERE a = 10; +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2; +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table + +#======================================================================== +# Test: Grant UPDATE on the table +#======================================================================== + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost'; +GRANT UPDATE ON privtest_db.t1 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the table +# Expectation: Can only run UPDATE, EXPLAIN UPDATE, ANALYZE UPDATE +# when the UPDATE does not read any columns. UPDATEs which +# read columns fail with ER_COLUMNACCESS_DENIED_ERROR +#------------------------------------------------------------------------ +INSERT INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN INSERT INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE INSERT INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE INSERT INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE INSERT INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE INSERT INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +REPLACE INTO t1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN REPLACE INTO t1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE REPLACE INTO t1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +REPLACE INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN REPLACE INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE REPLACE INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' +UPDATE t1 SET a = 10; +EXPLAIN UPDATE t1 SET a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 18 +ANALYZE UPDATE t1 SET a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 18 18.00 100.00 100.00 +UPDATE t1 SET a = a + 1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 't1' +EXPLAIN UPDATE t1 SET a = a + 1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 't1' +ANALYZE UPDATE t1 SET a = a + 1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 't1' +UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 't1' +EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 't1' +ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 't1' +DELETE FROM t1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN DELETE FROM t1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE DELETE FROM t1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +DELETE FROM t1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN DELETE FROM t1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE DELETE FROM t1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' +DELETE FROM t1 USING t1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN DELETE FROM t1 USING t1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE DELETE FROM t1 USING t1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +SELECT * FROM t1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN SELECT * FROM t1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE SELECT * FROM t1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +SELECT * FROM t1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN SELECT * FROM t1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE SELECT * FROM t1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Can run the queries, but not EXPLAIN or ANALYZE +# because the query plan cannot be shown +# (it would have revealed the structure of the table) +#------------------------------------------------------------------------ +INSERT INTO v1 (a) VALUES (10); +EXPLAIN INSERT INTO v1 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v1 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +INSERT INTO v1 SELECT * FROM t2; +EXPLAIN INSERT INTO v1 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v1 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v1 (a) VALUES (10); +EXPLAIN REPLACE INTO v1 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v1 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v1 SELECT * FROM t2; +EXPLAIN REPLACE INTO v1 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v1 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v1 SET a = 10; +EXPLAIN UPDATE v1 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v1 SET a = a + 1; +EXPLAIN UPDATE v1 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1; +EXPLAIN DELETE FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1 WHERE a = 10; +EXPLAIN DELETE FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1 USING v1, t2; +EXPLAIN DELETE FROM v1 USING v1, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v1 USING v1, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v1; +a b +EXPLAIN SELECT * FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v1 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run the queries, but not EXPLAIN or ANALYZE +# because the query plan cannot be shown +# (it would have revealed the structure of the table) +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +INSERT INTO v2 SELECT * FROM t2; +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 (a) VALUES (10); +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 SELECT * FROM t2; +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 WHERE a = 10; +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2; +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table + +#======================================================================== +# Test: Grant DELETE on the table +#======================================================================== + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost'; +GRANT DELETE ON privtest_db.t1 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the table +# Expectation: Can only run DELETE, EXPLAIN DELETE, ANALYZE DELETE +# when the DELETE does not read any columns. DELETEs which +# read columns fail with ER_COLUMNACCESS_DENIED_ERROR +#------------------------------------------------------------------------ +# Note: ANALYZE DELETE FROM t1 USING t1, t2 ... fails due to MDEV-7043 +INSERT INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN INSERT INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE INSERT INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +INSERT INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN INSERT INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE INSERT INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +REPLACE INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN REPLACE INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE REPLACE INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +REPLACE INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN REPLACE INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE REPLACE INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +UPDATE t1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN UPDATE t1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE UPDATE t1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +UPDATE t1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN UPDATE t1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE UPDATE t1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +DELETE FROM t1; +EXPLAIN DELETE FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL 0 Deleting all rows +ANALYZE DELETE FROM t1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL 0 NULL NULL NULL Deleting all rows +DELETE FROM t1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 't1' +EXPLAIN DELETE FROM t1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 't1' +ANALYZE DELETE FROM t1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 't1' +DELETE FROM t1 USING t1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN DELETE FROM t1 USING t1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE DELETE FROM t1 USING t1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +SELECT * FROM t1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN SELECT * FROM t1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE SELECT * FROM t1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +SELECT * FROM t1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN SELECT * FROM t1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE SELECT * FROM t1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Can run the queries, but not EXPLAIN or ANALYZE +# because the query plan cannot be shown +# (it would have revealed the structure of the table) +#------------------------------------------------------------------------ +INSERT INTO v1 (a) VALUES (10); +EXPLAIN INSERT INTO v1 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v1 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +INSERT INTO v1 SELECT * FROM t2; +EXPLAIN INSERT INTO v1 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v1 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v1 (a) VALUES (10); +EXPLAIN REPLACE INTO v1 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v1 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v1 SELECT * FROM t2; +EXPLAIN REPLACE INTO v1 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v1 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v1 SET a = 10; +EXPLAIN UPDATE v1 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v1 SET a = a + 1; +EXPLAIN UPDATE v1 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1; +EXPLAIN DELETE FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1 WHERE a = 10; +EXPLAIN DELETE FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1 USING v1, t2; +EXPLAIN DELETE FROM v1 USING v1, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v1 USING v1, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v1; +a b +EXPLAIN SELECT * FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v1 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run the queries, but not EXPLAIN or ANALYZE +# because the query plan cannot be shown +# (it would have revealed the structure of the table) +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +INSERT INTO v2 SELECT * FROM t2; +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 (a) VALUES (10); +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 SELECT * FROM t2; +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 WHERE a = 10; +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2; +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table + +#======================================================================== +# Test: Grant DELETE, SELECT(a) on the table +#======================================================================== + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost'; +GRANT SELECT(a), DELETE ON privtest_db.t1 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the table +# Expectation: Can run DELETE, EXPLAIN DELETE, ANALYZE DELETE +#------------------------------------------------------------------------ +INSERT INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN INSERT INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE INSERT INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +INSERT INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN INSERT INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE INSERT INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +REPLACE INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN REPLACE INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE REPLACE INTO t1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +REPLACE INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN REPLACE INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE REPLACE INTO t1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 't1' +UPDATE t1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN UPDATE t1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE UPDATE t1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +UPDATE t1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN UPDATE t1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE UPDATE t1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' +DELETE FROM t1; +EXPLAIN DELETE FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL 0 Deleting all rows +ANALYZE DELETE FROM t1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL 0 NULL NULL NULL Deleting all rows +DELETE FROM t1 WHERE a = 10; +EXPLAIN DELETE FROM t1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using where +ANALYZE DELETE FROM t1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 1 0.00 100.00 100.00 Using where +DELETE FROM t1 USING t1, t2; +EXPLAIN DELETE FROM t1 USING t1, t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE DELETE FROM t1 USING t1, t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +SELECT * FROM t1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN SELECT * FROM t1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE SELECT * FROM t1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +SELECT * FROM t1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN SELECT * FROM t1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE SELECT * FROM t1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Can run everything: SELECT access to the column `a` +# in the underlying table is enough to show EXPLAIN +# (that's how it works now) +#------------------------------------------------------------------------ +INSERT INTO v1 (a) VALUES (10); +EXPLAIN INSERT INTO v1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE INSERT INTO v1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +INSERT INTO v1 SELECT * FROM t2; +EXPLAIN INSERT INTO v1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE INSERT INTO v1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +REPLACE INTO v1 (a) VALUES (10); +EXPLAIN REPLACE INTO v1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE REPLACE INTO v1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +REPLACE INTO v1 SELECT * FROM t2; +EXPLAIN REPLACE INTO v1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE REPLACE INTO v1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +UPDATE v1 SET a = 10; +EXPLAIN UPDATE v1 SET a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 16 Using where +ANALYZE UPDATE v1 SET a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 16 16.00 100.00 75.00 Using where +UPDATE v1 SET a = a + 1; +EXPLAIN UPDATE v1 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 16 Using where +ANALYZE UPDATE v1 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 16 16.00 100.00 75.00 Using where +UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 ALL NULL NULL NULL NULL 16 Using where +ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 16 16.00 100.00 0.00 Using where +DELETE FROM v1; +EXPLAIN DELETE FROM v1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +ANALYZE DELETE FROM v1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +DELETE FROM v1 WHERE a = 10; +EXPLAIN DELETE FROM v1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +ANALYZE DELETE FROM v1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +DELETE FROM v1 USING v1, t2; +EXPLAIN DELETE FROM v1 USING v1, t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +ANALYZE DELETE FROM v1 USING v1, t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +SELECT * FROM v1; +a b +EXPLAIN SELECT * FROM v1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +ANALYZE SELECT * FROM v1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +SELECT * FROM v1 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +ANALYZE SELECT * FROM v1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 3.00 100.00 100.00 +1 PRIMARY t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run everything: SELECT access to the column `a` +# in the underlying table is enough to show EXPLAIN +# (that's how it works now) +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +EXPLAIN INSERT INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE INSERT INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +INSERT INTO v2 SELECT * FROM t2; +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE INSERT INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +REPLACE INTO v2 (a) VALUES (10); +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE REPLACE INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +REPLACE INTO v2 SELECT * FROM t2; +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 20 Using where +ANALYZE UPDATE v2 SET a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 20 20.00 100.00 60.00 Using where +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 20 Using where +ANALYZE UPDATE v2 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 20 20.00 100.00 60.00 Using where +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 20 Using where +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 20 20.00 100.00 0.00 Using where +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +ANALYZE DELETE FROM v2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +DELETE FROM v2 WHERE a = 10; +EXPLAIN DELETE FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +ANALYZE DELETE FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +DELETE FROM v2 USING v2, t2; +EXPLAIN DELETE FROM v2 USING v2, t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +ANALYZE DELETE FROM v2 USING v2, t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +ANALYZE SELECT * FROM v2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +ANALYZE SELECT * FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 3.00 100.00 100.00 +1 PRIMARY t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where + +#======================================================================== +# Test: Grant SELECT, INSERT, UPDATE, DELETE on the table +#======================================================================== + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost'; +GRANT SELECT, INSERT, UPDATE, DELETE ON privtest_db.t1 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the table +# Expectation: Can run everything +#------------------------------------------------------------------------ +INSERT INTO t1 (a) VALUES (10); +EXPLAIN INSERT INTO t1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE INSERT INTO t1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +INSERT INTO t1 SELECT * FROM t2; +EXPLAIN INSERT INTO t1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE INSERT INTO t1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +REPLACE INTO t1 (a) VALUES (10); +EXPLAIN REPLACE INTO t1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE REPLACE INTO t1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +REPLACE INTO t1 SELECT * FROM t2; +EXPLAIN REPLACE INTO t1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE REPLACE INTO t1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +UPDATE t1 SET a = 10; +EXPLAIN UPDATE t1 SET a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 24 +ANALYZE UPDATE t1 SET a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 24 24.00 100.00 100.00 +UPDATE t1 SET a = a + 1; +EXPLAIN UPDATE t1 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 24 +ANALYZE UPDATE t1 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 24 24.00 100.00 100.00 +UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 ALL NULL NULL NULL NULL 24 Using where +ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 24 24.00 100.00 0.00 Using where +DELETE FROM t1; +EXPLAIN DELETE FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL 0 Deleting all rows +ANALYZE DELETE FROM t1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL 0 NULL NULL NULL Deleting all rows +DELETE FROM t1 WHERE a = 10; +EXPLAIN DELETE FROM t1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using where +ANALYZE DELETE FROM t1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 1 0.00 100.00 100.00 Using where +DELETE FROM t1 USING t1, t2; +EXPLAIN DELETE FROM t1 USING t1, t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE DELETE FROM t1 USING t1, t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +SELECT * FROM t1; +a b +EXPLAIN SELECT * FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +ANALYZE SELECT * FROM t1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +SELECT * FROM t1 WHERE a = 10; +a b +EXPLAIN SELECT * FROM t1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +ANALYZE SELECT * FROM t1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Can run everything +#------------------------------------------------------------------------ +INSERT INTO v1 (a) VALUES (10); +EXPLAIN INSERT INTO v1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE INSERT INTO v1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +INSERT INTO v1 SELECT * FROM t2; +EXPLAIN INSERT INTO v1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE INSERT INTO v1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +REPLACE INTO v1 (a) VALUES (10); +EXPLAIN REPLACE INTO v1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE REPLACE INTO v1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +REPLACE INTO v1 SELECT * FROM t2; +EXPLAIN REPLACE INTO v1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE REPLACE INTO v1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +UPDATE v1 SET a = 10; +EXPLAIN UPDATE v1 SET a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 16 Using where +ANALYZE UPDATE v1 SET a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 16 16.00 100.00 75.00 Using where +UPDATE v1 SET a = a + 1; +EXPLAIN UPDATE v1 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 16 Using where +ANALYZE UPDATE v1 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 16 16.00 100.00 75.00 Using where +UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 ALL NULL NULL NULL NULL 16 Using where +ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 16 16.00 100.00 0.00 Using where +DELETE FROM v1; +EXPLAIN DELETE FROM v1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +ANALYZE DELETE FROM v1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +DELETE FROM v1 WHERE a = 10; +EXPLAIN DELETE FROM v1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +ANALYZE DELETE FROM v1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +DELETE FROM v1 USING v1, t2; +EXPLAIN DELETE FROM v1 USING v1, t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +ANALYZE DELETE FROM v1 USING v1, t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +SELECT * FROM v1; +a b +EXPLAIN SELECT * FROM v1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +ANALYZE SELECT * FROM v1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +SELECT * FROM v1 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +ANALYZE SELECT * FROM v1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 3.00 100.00 100.00 +1 PRIMARY t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run everything +#------------------------------------------------------------------------ +# Note: some queries are commented due to MDEV-7034 +INSERT INTO v2 (a) VALUES (10); +EXPLAIN INSERT INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE INSERT INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +INSERT INTO v2 SELECT * FROM t2; +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE INSERT INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +REPLACE INTO v2 (a) VALUES (10); +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE REPLACE INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +REPLACE INTO v2 SELECT * FROM t2; +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 20 Using where +ANALYZE UPDATE v2 SET a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 20 20.00 100.00 60.00 Using where +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 20 Using where +ANALYZE UPDATE v2 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 20 20.00 100.00 60.00 Using where +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 20 Using where +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 20 20.00 100.00 0.00 Using where +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +ANALYZE DELETE FROM v2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +DELETE FROM v2 WHERE a = 10; +EXPLAIN DELETE FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +ANALYZE DELETE FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +DELETE FROM v2 USING v2, t2; +ANALYZE DELETE FROM v2 USING v2, t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +ANALYZE SELECT * FROM v2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +ANALYZE SELECT * FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 3.00 100.00 100.00 +1 PRIMARY t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where + +######################################################################### +# Inner view permission tests +# (we modify permissions on the inner view, keeping ALL the rest) +######################################################################### + + +#======================================================================== +# Test: No permissions on the inner view +#======================================================================== + +connection default; +GRANT ALL ON privtest_db.t1 TO 'privtest'@'localhost'; +GRANT ALL ON privtest_db.v2 TO 'privtest'@'localhost'; +REVOKE ALL PRIVILEGES ON privtest_db.v1 FROM 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Cannot run anything +#------------------------------------------------------------------------ +INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 USING v1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 USING v1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE SELECT * FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run the queries, but not EXPLAIN or ANALYZE +# because the query plan cannot be shown +# (it could have revealed the structure of the inner view) +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +INSERT INTO v2 SELECT * FROM t2; +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 (a) VALUES (10); +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 SELECT * FROM t2; +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 WHERE a = 10; +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2; +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table + +#======================================================================== +# Test: Grant SHOW VIEW on the inner view +#======================================================================== + +connection default; +GRANT SHOW VIEW ON privtest_db.v1 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Cannot run anything +#------------------------------------------------------------------------ +INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 USING v1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 USING v1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE SELECT * FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run the queries, but not EXPLAIN or ANALYZE +# because the query plan cannot be shown +# (that's how it works now) +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +INSERT INTO v2 SELECT * FROM t2; +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 (a) VALUES (10); +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 SELECT * FROM t2; +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 WHERE a = 10; +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2; +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table + +#======================================================================== +# Test: Grant SELECT on the inner view +#======================================================================== + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.v1 FROM 'privtest'@'localhost'; +GRANT SELECT ON privtest_db.v1 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Can run SELECT, but not EXPLAIN SELECT or ANALYZE SELECT +# because the query plan cannot be shown +# (it could have revealed the structure of the view) +#------------------------------------------------------------------------ +INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 USING v1, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 USING v1, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1; +a b +EXPLAIN SELECT * FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v1 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run the queries, but not EXPLAIN or ANALYZE +# because the query plan cannot be shown +# (it could have revealed the structure of the inner view) +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +INSERT INTO v2 SELECT * FROM t2; +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 (a) VALUES (10); +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 SELECT * FROM t2; +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 WHERE a = 10; +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2; +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table + +#======================================================================== +# Test: Grant SELECT, SHOW VIEW on the inner view +#======================================================================== + + +#------------------------------------------------------------------------ +# Test: SELECT + SHOW VIEW privileges allow ANALYZE SELECT for the inner +# view, and ANALYZE <anything> for the outer view +#------------------------------------------------------------------------ + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.v1 FROM 'privtest'@'localhost'; +GRANT SELECT, SHOW VIEW ON privtest_db.v1 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Can run SELECT, EXPLAIN SELECT, ANALYZE SELECT +#------------------------------------------------------------------------ +INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 USING v1, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 USING v1, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1; +a b +EXPLAIN SELECT * FROM v1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 14 Using where +ANALYZE SELECT * FROM v1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 14 14.00 100.00 0.00 Using where +SELECT * FROM v1 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 14 Using where +ANALYZE SELECT * FROM v1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 14 14.00 100.00 0.00 Using where +SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 14 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 3.00 100.00 100.00 +1 PRIMARY t1 ALL NULL NULL NULL NULL 14 14.00 100.00 0.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run everything +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +EXPLAIN INSERT INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE INSERT INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +INSERT INTO v2 SELECT * FROM t2; +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE INSERT INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +REPLACE INTO v2 (a) VALUES (10); +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE REPLACE INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +REPLACE INTO v2 SELECT * FROM t2; +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 30 Using where +ANALYZE UPDATE v2 SET a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 30 30.00 100.00 40.00 Using where +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 30 Using where +ANALYZE UPDATE v2 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 30 30.00 100.00 40.00 Using where +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 30 Using where +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 30 30.00 100.00 0.00 Using where +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 18 Using where +ANALYZE DELETE FROM v2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where +DELETE FROM v2 WHERE a = 10; +EXPLAIN DELETE FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 18 Using where +ANALYZE DELETE FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where +DELETE FROM v2 USING v2, t2; +ANALYZE DELETE FROM v2 USING v2, t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 18 Using where +ANALYZE SELECT * FROM v2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 18 Using where +ANALYZE SELECT * FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 3.00 100.00 100.00 +1 PRIMARY t1 ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where + +#======================================================================== +# Test: Grant INSERT on the inner view +#======================================================================== + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.v1 FROM 'privtest'@'localhost'; +GRANT INSERT ON privtest_db.v1 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Can run INSERT, but not EXPLAIN INSERT or ANALYZE INSERT +# because the query plan cannot be shown +# (it could have revealed the structure of the view) +#------------------------------------------------------------------------ +INSERT INTO v1 (a) VALUES (10); +EXPLAIN INSERT INTO v1 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v1 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +INSERT INTO v1 SELECT * FROM t2; +EXPLAIN INSERT INTO v1 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v1 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 USING v1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 USING v1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE SELECT * FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run the queries, but not EXPLAIN or ANALYZE +# because the query plan cannot be shown +# (it could have revealed the structure of the inner view) +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +INSERT INTO v2 SELECT * FROM t2; +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 (a) VALUES (10); +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 SELECT * FROM t2; +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 WHERE a = 10; +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2; +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table + +#======================================================================== +# Test: Grant UPDATE on the inner view +#======================================================================== + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.v1 FROM 'privtest'@'localhost'; +GRANT UPDATE ON privtest_db.v1 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Can run UPDATE which does not read any columns, but not +# but not EXPLAIN UPDATE or ANALYZE UPDATE +# because the query plan cannot be shown +# (it could have revealed the structure of the view). +#------------------------------------------------------------------------ +INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1 SET a = 10; +EXPLAIN UPDATE v1 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v1 SET a = a + 1; +EXPLAIN UPDATE v1 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 'v1' +EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 USING v1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 USING v1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE SELECT * FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run the queries, but not EXPLAIN or ANALYZE +# because the query plan cannot be shown +# (it could have revealed the structure of the inner view) +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +INSERT INTO v2 SELECT * FROM t2; +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 (a) VALUES (10); +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 SELECT * FROM t2; +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 WHERE a = 10; +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2; +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table + +#======================================================================== +# Test: Grant UPDATE, SELECT(a) on the inner view +#======================================================================== + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.v1 FROM 'privtest'@'localhost'; +GRANT SELECT(a), UPDATE ON privtest_db.v1 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Can run UPDATE, but not EXPLAIN or ANALYZE for it +# because the query plan cannot be shown +# (it could have revealed the structure of the view) +#------------------------------------------------------------------------ +INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1 SET a = 10; +EXPLAIN UPDATE v1 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v1 SET a = a + 1; +EXPLAIN UPDATE v1 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 USING v1, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 USING v1, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run the queries, but not EXPLAIN or ANALYZE +# because the query plan cannot be shown +# (it could have revealed the structure of the inner view) +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +INSERT INTO v2 SELECT * FROM t2; +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 (a) VALUES (10); +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 SELECT * FROM t2; +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 WHERE a = 10; +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2; +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table + +#======================================================================== +# Test: Grant SELECT, UPDATE on the inner view +#======================================================================== + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.v1 FROM 'privtest'@'localhost'; +GRANT SELECT, UPDATE ON privtest_db.v1 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Can run the UPDATE and SELECT queries, but not EXPLAIN +# or ANALYZE because the query plan cannot be shown +# (it could have revealed the structure of the view) +#------------------------------------------------------------------------ +INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1 SET a = 10; +EXPLAIN UPDATE v1 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v1 SET a = a + 1; +EXPLAIN UPDATE v1 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 USING v1, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 USING v1, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1; +a b +EXPLAIN SELECT * FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v1 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run the queries, but not EXPLAIN or ANALYZE +# because the query plan cannot be shown +# (it could have revealed the structure of the inner view) +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +INSERT INTO v2 SELECT * FROM t2; +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 (a) VALUES (10); +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 SELECT * FROM t2; +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 WHERE a = 10; +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2; +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table + +#======================================================================== +# Test: Grant DELETE on the inner view +#======================================================================== + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.v1 FROM 'privtest'@'localhost'; +GRANT DELETE ON privtest_db.v1 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Can run DELETE which does not read any columns, +# but not EXPLAIN DELETE or ANALYZE DELETE +# because the query plan cannot be shown +# (it could have revealed the structure of the view) +#------------------------------------------------------------------------ +INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1; +EXPLAIN DELETE FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 'v1' +EXPLAIN DELETE FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v1 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v1 USING v1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 USING v1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE SELECT * FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run the queries, but not EXPLAIN or ANALYZE +# because the query plan cannot be shown +# (it could have revealed the structure of the inner view) +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +INSERT INTO v2 SELECT * FROM t2; +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 (a) VALUES (10); +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 SELECT * FROM t2; +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 WHERE a = 10; +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2; +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table + +#======================================================================== +# Test: Grant DELETE, SHOW VIEW on the inner view +#======================================================================== + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.v1 FROM 'privtest'@'localhost'; +GRANT SHOW VIEW, DELETE ON privtest_db.v1 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Can run DELETE, EXPLAIN DELETE, UPDATE DELETE +# which don't read any columns +#------------------------------------------------------------------------ +INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE INSERT INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE INSERT INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE REPLACE INTO v1 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE REPLACE INTO v1 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE UPDATE v1 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE UPDATE v1 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v1' +UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +DELETE FROM v1; +EXPLAIN DELETE FROM v1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 29 Using where +ANALYZE DELETE FROM v1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 29 29.00 100.00 0.00 Using where +DELETE FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 'v1' +EXPLAIN DELETE FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 'v1' +ANALYZE DELETE FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 'v1' +DELETE FROM v1 USING v1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 USING v1, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE SELECT * FROM v1 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run the queries, but not EXPLAIN or ANALYZE +# because the query plan cannot be shown +# (that's how it works now) +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +INSERT INTO v2 SELECT * FROM t2; +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 (a) VALUES (10); +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 SELECT * FROM t2; +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 WHERE a = 10; +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2; +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table + +#======================================================================== +# Test: Grant SELECT, INSERT, UPDATE, DELETE, SHOW VIEW +#======================================================================== + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.v1 FROM 'privtest'@'localhost'; +GRANT SELECT, INSERT, UPDATE, DELETE, SHOW VIEW ON privtest_db.v1 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Can run everything +#------------------------------------------------------------------------ +INSERT INTO v1 (a) VALUES (10); +EXPLAIN INSERT INTO v1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE INSERT INTO v1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +INSERT INTO v1 SELECT * FROM t2; +EXPLAIN INSERT INTO v1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE INSERT INTO v1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +REPLACE INTO v1 (a) VALUES (10); +EXPLAIN REPLACE INTO v1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE REPLACE INTO v1 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +REPLACE INTO v1 SELECT * FROM t2; +EXPLAIN REPLACE INTO v1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE REPLACE INTO v1 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +UPDATE v1 SET a = 10; +EXPLAIN UPDATE v1 SET a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 47 Using where +ANALYZE UPDATE v1 SET a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 47 47.00 100.00 25.53 Using where +UPDATE v1 SET a = a + 1; +EXPLAIN UPDATE v1 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 47 Using where +ANALYZE UPDATE v1 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 47 47.00 100.00 25.53 Using where +UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 ALL NULL NULL NULL NULL 47 Using where +ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 47 47.00 100.00 0.00 Using where +DELETE FROM v1; +EXPLAIN DELETE FROM v1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 35 Using where +ANALYZE DELETE FROM v1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where +DELETE FROM v1 WHERE a = 10; +EXPLAIN DELETE FROM v1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 35 Using where +ANALYZE DELETE FROM v1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where +DELETE FROM v1 USING v1, t2; +EXPLAIN DELETE FROM v1 USING v1, t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 ALL NULL NULL NULL NULL 35 Using where +ANALYZE DELETE FROM v1 USING v1, t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where +DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 ALL NULL NULL NULL NULL 35 Using where +ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where +SELECT * FROM v1; +a b +EXPLAIN SELECT * FROM v1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 35 Using where +ANALYZE SELECT * FROM v1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where +SELECT * FROM v1 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 35 Using where +ANALYZE SELECT * FROM v1 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where +SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 35 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 3.00 100.00 100.00 +1 PRIMARY t1 ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run everything +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +EXPLAIN INSERT INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE INSERT INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +INSERT INTO v2 SELECT * FROM t2; +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE INSERT INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +REPLACE INTO v2 (a) VALUES (10); +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE REPLACE INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +REPLACE INTO v2 SELECT * FROM t2; +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 51 Using where +ANALYZE UPDATE v2 SET a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 51 51.00 100.00 23.53 Using where +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 51 Using where +ANALYZE UPDATE v2 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 51 51.00 100.00 23.53 Using where +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 51 Using where +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 51 51.00 100.00 0.00 Using where +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 39 Using where +ANALYZE DELETE FROM v2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +DELETE FROM v2 WHERE a = 10; +EXPLAIN DELETE FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 39 Using where +ANALYZE DELETE FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +DELETE FROM v2 USING v2, t2; +ANALYZE DELETE FROM v2 USING v2, t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 39 Using where +ANALYZE SELECT * FROM v2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 39 Using where +ANALYZE SELECT * FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 39 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 3.00 100.00 100.00 +1 PRIMARY t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where + +######################################################################### +# Outer view permission tests +# (we modify permissions on the outer view, keeping ALL the rest) +######################################################################### + + +#======================================================================== +# Test: No permissions on the outer view +#======================================================================== + +connection default; +GRANT ALL ON privtest_db.t1 TO 'privtest'@'localhost'; +GRANT ALL ON privtest_db.v1 TO 'privtest'@'localhost'; +REVOKE ALL PRIVILEGES ON privtest_db.v2 FROM 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Cannot run anything +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 USING v2, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' + +#======================================================================== +# Test: Grant SHOW VIEW on the outer view +#======================================================================== + +connection default; +GRANT SHOW VIEW ON privtest_db.v2 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Cannot run anything +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 USING v2, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' + +#======================================================================== +# Test: Grant SHOW VIEW, SELECT(a) on the outer view +#======================================================================== + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.v2 FROM 'privtest'@'localhost'; +GRANT SELECT(a), SHOW VIEW ON privtest_db.v2 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run SELECT, EXPLAIN SELECT and ANALYZE SELECT +# when only `a` column is involved +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 USING v2, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +SELECT a FROM v2; +a +EXPLAIN SELECT a FROM v2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 39 Using where +ANALYZE SELECT a FROM v2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +SELECT a FROM v2 WHERE a = 10; +a +EXPLAIN SELECT a FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 39 Using where +ANALYZE SELECT a FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' + +#======================================================================== +# Test: Grant SELECT on the outer view +#======================================================================== + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.v2 FROM 'privtest'@'localhost'; +GRANT SELECT ON privtest_db.v2 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Can run SELECT, but not EXPLAIN SELECT or ANALYZE SELECT +# because the query plan cannot be shown +# (it could have revealed the structure of the view) +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 USING v2, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table + +#======================================================================== +# Test: Grant SHOW VIEW, SELECT on the outer view +#======================================================================== + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.v2 FROM 'privtest'@'localhost'; +GRANT SELECT, SHOW VIEW ON privtest_db.v2 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Can run SELECT, EXPLAIN SELECT, ANALYZE SELECT +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 USING v2, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 39 Using where +ANALYZE SELECT * FROM v2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 39 Using where +ANALYZE SELECT * FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 39 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 3.00 100.00 100.00 +1 PRIMARY t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where + +#======================================================================== +# Test: Grant INSERT on the outer view +#======================================================================== + + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.v2 FROM 'privtest'@'localhost'; +GRANT INSERT ON privtest_db.v2 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run INSERT, but not EXPLAIN INSERT or ANALYZE INSERT +# because the query plan cannot be shown +# (it could have revealed the structure of the view) +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +INSERT INTO v2 SELECT * FROM t2; +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 USING v2, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' + +#======================================================================== +# Test: Grant UPDATE on the outer view +#======================================================================== + + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.v2 FROM 'privtest'@'localhost'; +GRANT UPDATE ON privtest_db.v2 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run UPDATE which does not read any columns, +# but not EXPLAIN UPDATE or ANALYZE UPDATE +# because the query plan cannot be shown +# (it could have revealed the structure of the view) +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2 SET a = a + 1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 'v2' +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 USING v2, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' + +#======================================================================== +# Test: Grant UPDATE, SHOW VIEW on the outer view +#======================================================================== + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.v2 FROM 'privtest'@'localhost'; +GRANT SHOW VIEW, UPDATE ON privtest_db.v2 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the inner view +# Expectation: Can run UPDATE, EXPLAIN UPDATE, ANALYZE UPDATE +# which do not read any columns +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 43 Using where +ANALYZE UPDATE v2 SET a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 43 43.00 100.00 6.98 Using where +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 43 Using where +ANALYZE UPDATE v2 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 43 43.00 100.00 6.98 Using where +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 'v2' +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 'v2' +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 'v2' +DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 USING v2, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' + +#======================================================================== +# Test: Grant DELETE on the outer view +#======================================================================== + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.v2 FROM 'privtest'@'localhost'; +GRANT DELETE ON privtest_db.v2 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run DELETE which does not read any columns, +# but not EXPLAIN DELETE or ANALYZE DELETE +# because the query plan cannot be shown +# (it could have revealed the structure of the view) +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 'v2' +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' + +#======================================================================== +# Test: Grant DELETE, SELECT on the outer view +#======================================================================== + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.v2 FROM 'privtest'@'localhost'; +GRANT SELECT, DELETE ON privtest_db.v2 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run DELETE and SELECT, but not EXPLAIN or ANALYZE +# for them because the query plan cannot be shown +# (it could have revealed the structure of the view) +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE INSERT INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE INSERT INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE REPLACE INTO v2 (a) VALUES (10); +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +ERROR 42000: INSERT command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2 SET a = 10; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +ANALYZE UPDATE v2 SET a = a + 1; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 'v2' +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 WHERE a = 10; +EXPLAIN DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2; +EXPLAIN DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a = 10; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table + +#======================================================================== +# Test: Grant SELECT, INSERT, UPDATE, DELETE, SHOW VIEW on the outer view +#======================================================================== + +connection default; +REVOKE ALL PRIVILEGES ON privtest_db.v2 FROM 'privtest'@'localhost'; +GRANT SELECT, INSERT, UPDATE, DELETE, SHOW VIEW ON privtest_db.v2 TO 'privtest'@'localhost'; +connection con1; +#------------------------------------------------------------------------ +# I/R/U/D/S on the outer view +# Expectation: Can run everything +#------------------------------------------------------------------------ +INSERT INTO v2 (a) VALUES (10); +EXPLAIN INSERT INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE INSERT INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +INSERT INTO v2 SELECT * FROM t2; +EXPLAIN INSERT INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE INSERT INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +REPLACE INTO v2 (a) VALUES (10); +EXPLAIN REPLACE INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +ANALYZE REPLACE INTO v2 (a) VALUES (10); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +REPLACE INTO v2 SELECT * FROM t2; +EXPLAIN REPLACE INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +ANALYZE REPLACE INTO v2 SELECT * FROM t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +UPDATE v2 SET a = 10; +EXPLAIN UPDATE v2 SET a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 56 Using where +ANALYZE UPDATE v2 SET a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 56 56.00 100.00 21.43 Using where +UPDATE v2 SET a = a + 1; +EXPLAIN UPDATE v2 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 56 Using where +ANALYZE UPDATE v2 SET a = a + 1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 56 56.00 100.00 21.43 Using where +UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 56 Using where +ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 56 56.00 100.00 0.00 Using where +DELETE FROM v2; +EXPLAIN DELETE FROM v2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 44 Using where +ANALYZE DELETE FROM v2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where +DELETE FROM v2 WHERE a = 10; +EXPLAIN DELETE FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 44 Using where +ANALYZE DELETE FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where +DELETE FROM v2 USING v2, t2; +ANALYZE DELETE FROM v2 USING v2, t2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where +DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where +SELECT * FROM v2; +a b +EXPLAIN SELECT * FROM v2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 44 Using where +ANALYZE SELECT * FROM v2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where +SELECT * FROM v2 WHERE a = 10; +a b +EXPLAIN SELECT * FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 44 Using where +ANALYZE SELECT * FROM v2 WHERE a = 10; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where +SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +a b +EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 +1 PRIMARY t1 ALL NULL NULL NULL NULL 44 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where +ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 3.00 100.00 100.00 +1 PRIMARY t1 ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +disconnect con1; +connection default; +DROP USER 'privtest'@localhost; +USE test; +DROP DATABASE privtest_db; +set GLOBAL sql_mode=default; diff --git a/mysql-test/r/analyze_stmt_slow_query_log.result b/mysql-test/r/analyze_stmt_slow_query_log.result new file mode 100644 index 00000000000..7d280e66b6c --- /dev/null +++ b/mysql-test/r/analyze_stmt_slow_query_log.result @@ -0,0 +1,15 @@ +drop table if exists t1; +create table t1 (a int); +INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +select * from t1 where a<3; +a +0 +1 +2 +drop table t1; +# explain: id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +# explain: 1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +# explain: id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +# explain: 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where +# explain: id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +# explain: 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used diff --git a/mysql-test/r/auth_named_pipe.result b/mysql-test/r/auth_named_pipe.result new file mode 100644 index 00000000000..3268b760a22 --- /dev/null +++ b/mysql-test/r/auth_named_pipe.result @@ -0,0 +1,10 @@ +INSTALL SONAME 'auth_named_pipe'; +CREATE USER 'USERNAME' IDENTIFIED WITH named_pipe; +SELECT USER(),CURRENT_USER(); +USER() CURRENT_USER() +USERNAME@localhost USERNAME@% +DROP USER 'USERNAME'; +CREATE USER nosuchuser IDENTIFIED WITH named_pipe; +ERROR 28000: Access denied for user 'nosuchuser'@'localhost' +DROP USER nosuchuser; +UNINSTALL SONAME 'auth_named_pipe'; diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index b06ec5805a0..f21a1a763a3 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -180,14 +180,14 @@ create table t1 select 1 as 'a'; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(1) NOT NULL DEFAULT '0' + `a` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 select 9223372036854775809 as 'a'; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bigint(19) unsigned NOT NULL DEFAULT '0' + `a` bigint(19) unsigned NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t1; a @@ -397,12 +397,12 @@ select -(-9223372036854775808), -(-(-9223372036854775808)); create table t1 select -9223372036854775808 bi; describe t1; Field Type Null Key Default Extra -bi bigint(20) NO 0 +bi bigint(20) NO NULL drop table t1; create table t1 select -9223372036854775809 bi; describe t1; Field Type Null Key Default Extra -bi decimal(19,0) NO 0 +bi decimal(19,0) NO NULL drop table t1; # # Bug #45360: wrong results diff --git a/mysql-test/r/blackhole_plugin.result b/mysql-test/r/blackhole_plugin.result index dd1b95ab0d9..2884441056a 100644 --- a/mysql-test/r/blackhole_plugin.result +++ b/mysql-test/r/blackhole_plugin.result @@ -1,7 +1,9 @@ +set sql_mode=""; CREATE TABLE t1(a int) ENGINE=BLACKHOLE; Warnings: Warning 1286 Unknown storage engine 'BLACKHOLE' Warning 1266 Using storage engine MyISAM for table 't1' +set sql_mode=default; DROP TABLE t1; INSTALL PLUGIN blackhole SONAME 'ha_blackhole.so'; INSTALL PLUGIN BLACKHOLE SONAME 'ha_blackhole.so'; diff --git a/mysql-test/r/bug13633383.result b/mysql-test/r/bug13633383.result index 3b533f89df2..a6f5bab5260 100644 --- a/mysql-test/r/bug13633383.result +++ b/mysql-test/r/bug13633383.result @@ -49,5 +49,66 @@ col435 0.00000000000000000 0.00000000000000000 0.00000000000000000 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0' +Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00' set session sort_buffer_size= default; DROP TABLE t1, t2, t3; diff --git a/mysql-test/r/cache_innodb.result b/mysql-test/r/cache_innodb.result index 85eef0b3418..971750e3da2 100644 --- a/mysql-test/r/cache_innodb.result +++ b/mysql-test/r/cache_innodb.result @@ -1,3 +1,5 @@ +SET global query_cache_type=ON; +SET local query_cache_type=ON; SET SESSION STORAGE_ENGINE = InnoDB; drop table if exists t1,t2,t3; set @save_query_cache_size = @@global.query_cache_size; @@ -221,6 +223,7 @@ Variable_name Value Qcache_hits 1 set @@global.query_cache_size = @save_query_cache_size; drop table t2; +SET global query_cache_type=default; CREATE TABLE t1 (a INT) ENGINE=InnoDB; BEGIN; INSERT INTO t1 VALUES(1); diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result index 274d5da7d1c..9ceb7efde64 100644 --- a/mysql-test/r/case.result +++ b/mysql-test/r/case.result @@ -99,18 +99,18 @@ CASE WHEN 1 THEN 0.1e1 else '1' END AS c12 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci NOT NULL DEFAULT '', - `c2` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci NOT NULL DEFAULT '', - `c3` varchar(1) NOT NULL DEFAULT '', - `c4` varchar(1) NOT NULL DEFAULT '', - `c5` varchar(4) NOT NULL DEFAULT '', - `c6` varchar(4) NOT NULL DEFAULT '', - `c7` decimal(2,1) NOT NULL DEFAULT '0.0', - `c8` decimal(2,1) NOT NULL DEFAULT '0.0', + `c1` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci NOT NULL, + `c2` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci NOT NULL, + `c3` varchar(1) NOT NULL, + `c4` varchar(1) NOT NULL, + `c5` varchar(4) NOT NULL, + `c6` varchar(4) NOT NULL, + `c7` decimal(2,1) NOT NULL, + `c8` decimal(2,1) NOT NULL, `c9` decimal(2,1) DEFAULT NULL, - `c10` double NOT NULL DEFAULT '0', - `c11` double NOT NULL DEFAULT '0', - `c12` varchar(5) NOT NULL DEFAULT '' + `c10` double NOT NULL, + `c11` double NOT NULL, + `c12` varchar(5) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; SELECT CASE @@ -151,13 +151,13 @@ Note 1003 select coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,c SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `COALESCE(1)` int(1) NOT NULL DEFAULT '0', - `COALESCE(1.0)` decimal(2,1) NOT NULL DEFAULT '0.0', - `COALESCE('a')` varchar(1) NOT NULL DEFAULT '', - `COALESCE(1,1.0)` decimal(2,1) NOT NULL DEFAULT '0.0', - `COALESCE(1,'1')` varchar(1) NOT NULL DEFAULT '', - `COALESCE(1.1,'1')` varchar(4) NOT NULL DEFAULT '', - `COALESCE('a' COLLATE latin1_bin,'b')` varchar(1) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' + `COALESCE(1)` int(1) NOT NULL, + `COALESCE(1.0)` decimal(2,1) NOT NULL, + `COALESCE('a')` varchar(1) NOT NULL, + `COALESCE(1,1.0)` decimal(2,1) NOT NULL, + `COALESCE(1,'1')` varchar(1) NOT NULL, + `COALESCE(1.1,'1')` varchar(4) NOT NULL, + `COALESCE('a' COLLATE latin1_bin,'b')` varchar(1) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 SELECT IFNULL('a' COLLATE latin1_swedish_ci, 'b' COLLATE latin1_bin); @@ -244,3 +244,138 @@ DESCRIBE t1; Field Type Null Key Default Extra a decimal(2,0) YES NULL DROP TABLE t1; +# +# Start of 10.1 test +# +# +# MDEV-8752 Wrong result for SELECT..WHERE CASE enum_field WHEN 1 THEN 1 ELSE 0 END AND a='5' +# +CREATE TABLE t1 (a ENUM('5','6') CHARACTER SET BINARY); +INSERT INTO t1 VALUES ('5'),('6'); +SELECT * FROM t1 WHERE a='5'; +a +5 +SELECT * FROM t1 WHERE a=1; +a +5 +SELECT * FROM t1 WHERE CASE a WHEN 1 THEN 1 ELSE 0 END; +a +5 +SELECT * FROM t1 WHERE CASE a WHEN 1 THEN 1 ELSE 0 END AND a='5'; +a +5 +# Multiple comparison types in CASE, not Ok to propagate +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE CASE a WHEN 1 THEN 1 ELSE 0 END AND a='5'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '5') and (case `test`.`t1`.`a` when 1 then 1 else 0 end)) +DROP TABLE t1; +CREATE TABLE t1 (a ENUM('a','b','100')); +INSERT INTO t1 VALUES ('a'),('b'),('100'); +SELECT * FROM t1 WHERE a='a'; +a +a +SELECT * FROM t1 WHERE CASE a WHEN 'a' THEN 1 ELSE 0 END; +a +a +SELECT * FROM t1 WHERE CASE a WHEN 'a' THEN 1 ELSE 0 END AND a='a'; +a +a +# String comparison in CASE and in the equality, ok to propagate +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE CASE a WHEN 'a' THEN 1 ELSE 0 END AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a') +SELECT * FROM t1 WHERE a=3; +a +100 +SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END; +a +100 +SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a=3; +a +100 +# Integer comparison in CASE and in the equality, not ok to propagate +# ENUM does not support this type of propagation yet. +# This can change in the future. See MDEV-8748. +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a=3; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((case `test`.`t1`.`a` when 3 then 1 else 0 end) and (`test`.`t1`.`a` = 3)) +SELECT * FROM t1 WHERE a=3; +a +100 +SELECT * FROM t1 WHERE CASE a WHEN '100' THEN 1 ELSE 0 END; +a +100 +SELECT * FROM t1 WHERE CASE a WHEN '100' THEN 1 ELSE 0 END AND a=3; +a +100 +# String comparison in CASE, integer comparison in the equality, not Ok to propagate +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE CASE a WHEN '100' THEN 1 ELSE 0 END AND a=3; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((case `test`.`t1`.`a` when '100' then 1 else 0 end) and (`test`.`t1`.`a` = 3)) +SELECT * FROM t1 WHERE a='100'; +a +100 +SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END; +a +100 +SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a='100'; +a +100 +# Integer comparison in CASE, string comparison in the equality, not Ok to propagate +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a='100'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '100') and (case `test`.`t1`.`a` when 3 then 1 else 0 end)) +SELECT * FROM t1 WHERE a='100'; +a +100 +SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END; +a +100 +SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a='100'; +a +100 +# Multiple type comparison in CASE, string comparison in the equality, not Ok to propagate +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a='100'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '100') and (case `test`.`t1`.`a` when 3 then 1 when '100' then 1 else 0 end)) +SELECT * FROM t1 WHERE a=3; +a +100 +SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END; +a +100 +SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a=3; +a +100 +# Multiple type comparison in CASE, integer comparison in the equality, not Ok to propagate +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a=3; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((case `test`.`t1`.`a` when 3 then 1 when '100' then 1 else 0 end) and (`test`.`t1`.`a` = 3)) +DROP TABLE t1; +# +# End of MDEV-8752 +# +# +# End of 10.1 test +# diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result index c81af134add..4c9f257fdf2 100644 --- a/mysql-test/r/cast.result +++ b/mysql-test/r/cast.result @@ -13,7 +13,7 @@ select CAST('10 ' as unsigned integer); CAST('10 ' as unsigned integer) 10 Warnings: -Warning 1292 Truncated incorrect INTEGER value: '10 ' +Note 1292 Truncated incorrect INTEGER value: '10 ' select cast(-5 as unsigned) | 1, cast(-5 as unsigned) & -1; cast(-5 as unsigned) | 1 cast(-5 as unsigned) & -1 18446744073709551611 18446744073709551611 @@ -404,7 +404,7 @@ create table t1 select cast(_koi8r'ÔÅÓÔ' as char character set cp1251) as t; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `t` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `t` varchar(4) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select @@ -438,11 +438,11 @@ ab a ab a 6100 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(2) NOT NULL DEFAULT '', - `c2` varbinary(2) NOT NULL DEFAULT '', - `c3` varbinary(2) NOT NULL DEFAULT '', - `c4` varbinary(2) NOT NULL DEFAULT '', - `c5` varbinary(2) NOT NULL DEFAULT '' + `c1` varbinary(2) NOT NULL, + `c2` varbinary(2) NOT NULL, + `c3` varbinary(2) NOT NULL, + `c4` varbinary(2) NOT NULL, + `c5` varbinary(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select @@ -454,8 +454,8 @@ cast(_koi8r'Æ' AS nchar(2)) as c5; c1 c2 c3 c4 c5 фг Ñ„ фг Ñ„ Ñ„ Warnings: -Warning 1292 Truncated incorrect CHAR(4) value: 'фгх' -Warning 1292 Truncated incorrect CHAR(3) value: 'Ñ„ ' +Warning 1292 Truncated incorrect CHAR(2) value: 'фгх' +Warning 1292 Truncated incorrect CHAR(2) value: 'Ñ„ ' create table t1 select cast(_koi8r'ÆÇ' AS nchar) as c1, cast(_koi8r'Æ ' AS nchar) as c2, @@ -463,19 +463,19 @@ cast(_koi8r'ÆÇÈ' AS nchar(2)) as c3, cast(_koi8r'Æ ' AS nchar(2)) as c4, cast(_koi8r'Æ' AS nchar(2)) as c5; Warnings: -Warning 1292 Truncated incorrect CHAR(4) value: 'фгх' -Warning 1292 Truncated incorrect CHAR(3) value: 'Ñ„ ' +Warning 1292 Truncated incorrect CHAR(2) value: 'фгх' +Warning 1292 Truncated incorrect CHAR(2) value: 'Ñ„ ' select * from t1; c1 c2 c3 c4 c5 фг Ñ„ фг Ñ„ Ñ„ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '', - `c2` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '', - `c3` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '', - `c4` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '', - `c5` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET utf8 NOT NULL, + `c2` varchar(2) CHARACTER SET utf8 NOT NULL, + `c3` varchar(2) CHARACTER SET utf8 NOT NULL, + `c4` varchar(2) CHARACTER SET utf8 NOT NULL, + `c5` varchar(2) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a binary(4), b char(4) character set koi8r); @@ -582,12 +582,12 @@ create table t1 select cast(1 as unsigned), cast(1 as signed), cast(1 as double show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `cast(1 as unsigned)` int(1) unsigned NOT NULL DEFAULT '0', - `cast(1 as signed)` int(1) NOT NULL DEFAULT '0', + `cast(1 as unsigned)` int(1) unsigned NOT NULL, + `cast(1 as signed)` int(1) NOT NULL, `cast(1 as double(5,2))` double(5,2) DEFAULT NULL, - `cast(1 as decimal(5,3))` decimal(5,3) NOT NULL DEFAULT '0.000', - `cast("A" as binary)` varbinary(1) NOT NULL DEFAULT '', - `cast("A" as char(100))` varbinary(100) NOT NULL DEFAULT '', + `cast(1 as decimal(5,3))` decimal(5,3) NOT NULL, + `cast("A" as binary)` varbinary(1) NOT NULL, + `cast("A" as char(100))` varbinary(100) NOT NULL, `cast("2001-1-1" as DATE)` date DEFAULT NULL, `cast("2001-1-1" as DATETIME)` datetime DEFAULT NULL, `cast("1:2:3" as TIME)` time DEFAULT NULL @@ -751,8 +751,8 @@ Warning 1292 Truncated incorrect INTEGER value: '9999999999999999999999999999999 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `CONCAT(CAST(REPEAT('9', 1000) AS SIGNED))` varchar(21) NOT NULL DEFAULT '', - `CONCAT(CAST(REPEAT('9', 1000) AS UNSIGNED))` varchar(21) NOT NULL DEFAULT '' + `CONCAT(CAST(REPEAT('9', 1000) AS SIGNED))` varchar(21) NOT NULL, + `CONCAT(CAST(REPEAT('9', 1000) AS UNSIGNED))` varchar(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; # End of test for Bug#13581962, Bug#14096619 @@ -796,3 +796,26 @@ DATE("foo") NULL Warnings: Warning 1292 Incorrect datetime value: 'foo' +create table t1 (a int, b char(5) as (cast("a" as char(10) binary) + a) ); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` char(5) AS (cast("a" as char(10) binary) + a) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select collation(cast("a" as char(10) binary)); +collation(cast("a" as char(10) binary)) +latin1_bin +select collation(cast("a" as char(10) charset utf8 binary)); +collation(cast("a" as char(10) charset utf8 binary)) +utf8_bin +select collation(cast("a" as char(10) ascii binary)); +collation(cast("a" as char(10) ascii binary)) +latin1_bin +select collation(cast("a" as char(10) binary charset utf8)); +collation(cast("a" as char(10) binary charset utf8)) +utf8_bin +select collation(cast("a" as char(10) binary ascii)); +collation(cast("a" as char(10) binary ascii)) +latin1_bin diff --git a/mysql-test/r/change_user.result b/mysql-test/r/change_user.result index 18c53a5e22b..1de97ed02e6 100644 --- a/mysql-test/r/change_user.result +++ b/mysql-test/r/change_user.result @@ -1,6 +1,10 @@ +set global secure_auth=0; +create user test_nopw; grant select on test.* to test_nopw; -grant select on test.* to test_oldpw identified by password "09301740536db389"; -grant select on test.* to test_newpw identified by "newpw"; +create user test_oldpw identified by password "09301740536db389"; +grant select on test.* to test_oldpw; +create user test_newpw identified by "newpw"; +grant select on test.* to test_newpw; select concat('<', user(), '>'), concat('<', current_user(), '>'), database(); concat('<', user(), '>') concat('<', current_user(), '>') database() <root@localhost> <root@localhost> test @@ -85,3 +89,4 @@ IS_USED_LOCK('bug31418') NULL FLUSH STATUS; Value of com_select did not change +set global secure_auth=default; diff --git a/mysql-test/r/compare.result b/mysql-test/r/compare.result index cdd234f1478..a5654fb3160 100644 --- a/mysql-test/r/compare.result +++ b/mysql-test/r/compare.result @@ -64,7 +64,7 @@ EXPLAIN EXTENDED SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`b` = 1) and (concat('01',`test`.`t1`.`c`) = '0101')) +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`b` = 1) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = '0101')) SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101'; b c 01 01 diff --git a/mysql-test/r/compound.result b/mysql-test/r/compound.result new file mode 100644 index 00000000000..1d412e671a4 --- /dev/null +++ b/mysql-test/r/compound.result @@ -0,0 +1,171 @@ +CREATE TABLE t1 (a INT PRIMARY KEY)| +BEGIN NOT ATOMIC +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +END| +SELECT * FROM t1| +a +1 +2 +3 +PREPARE stmt FROM "BEGIN NOT ATOMIC + INSERT INTO t1 VALUES (4); + INSERT INTO t1 VALUES (5); + INSERT INTO t1 VALUES (?); +END"; +SET @val = 6| +reset master| +EXECUTE stmt USING @val| +SELECT * FROM t1| +a +1 +2 +3 +4 +5 +6 +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) +master-bin.000001 # Query # # COMMIT +DROP TABLE t1| +CREATE DATABASE mysqltest1| +CREATE PROCEDURE mysqltest1.sp1() +BEGIN +PREPARE stmt FROM "BEGIN NOT ATOMIC CREATE TABLE t1 AS SELECT DATABASE(); END"; +EXECUTE stmt; +END| +CALL mysqltest1.sp1()| +SELECT * FROM mysqltest1.t1| +DATABASE() +mysqltest1 +USE mysqltest1| +DROP DATABASE mysqltest1| +BEGIN NOT ATOMIC CREATE TABLE t1(a int); END| +ERROR 3D000: No database selected +BEGIN NOT ATOMIC SET @a=1; CREATE TABLE test.t1(a int); END| +USE test| +show tables| +Tables_in_test +t1 +drop table t1| +/**/ if (select count(*) from information_schema.tables +where table_schema='test' and table_name='t1') = 0 +then +create table t1 (a int); +end if| +show tables| +Tables_in_test +t1 +/**/ if (select count(*) from information_schema.tables +where table_schema='test' and table_name='t1') = 0 +then +create table t1 (a int); +end if| +show tables| +Tables_in_test +t1 +case (select table_name from information_schema.tables where table_schema='test') +when 't1' then create table t2 (b int); +when 't2' then create table t3 (b int); +else signal sqlstate '42S02'; +end case| +show tables| +Tables_in_test +t1 +t2 +case +when database() = 'test' then create table t3 (test text); +when now() < date'2001-02-03' then create table oops (machine time); +end case| +show tables| +Tables_in_test +t1 +t2 +t3 +loop +create table t4 (a int); +end loop| +ERROR 42S01: Table 't4' already exists +show tables| +Tables_in_test +t1 +t2 +t3 +t4 +set @a=0; +repeat +set @a = @a + 1; +until @a > 5 +end repeat| +select @a| +@a +6 +/**/ while (select count(*) from information_schema.tables where table_schema='test') +do +select concat('drop table ', table_name) into @a +from information_schema.tables where table_schema='test' limit 1; +select @a as 'executing:'; +prepare dt from @a; +execute dt; +end while| +executing: drop table t1 +executing: drop table t2 +executing: drop table t3 +executing: drop table t4 +create table t1 (x int)| +create function fn(a int) returns int +begin +insert t1 values (a+7); +return a+8; +end| +reset master| +/**/ if fn(9) > 5 then +select 1; +end if| +1 +1 +prepare stmt from "if fn(?) > 6 then + begin + declare a int; + set a=?*2; + insert t1 values(a+?); + end; +end if"| +set @a=1, @b=2, @c=3| +execute stmt using @a, @b, @c| +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fn`(9) +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fn`(1) +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; insert t1 values( NAME_CONST('a',4)+3) +master-bin.000001 # Query # # COMMIT +drop function fn| +drop table t1| +begin not atomic select @@sql_mode; end| +@@sql_mode +NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +create table t1 (a int)| +select a from t1 having a > 1| +a +begin not atomic select a from t1 having a > 1; end| +a +drop table t1| +# +# MDEV-8615: Assertion `m_cpp_buf <= begin_ptr && +# begin_ptr <= m_cpp_buf + m_buf_length' failed in +# Lex_input_stream::body_utf8_start +# +b'| +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'b'' at line 1 diff --git a/mysql-test/r/concurrent_innodb_safelog.result b/mysql-test/r/concurrent_innodb_safelog.result index 24a84afb9ce..03d20f40be3 100644 --- a/mysql-test/r/concurrent_innodb_safelog.result +++ b/mysql-test/r/concurrent_innodb_safelog.result @@ -1,4 +1,5 @@ SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ; +SET SQL_MODE=""; SELECT @@global.tx_isolation; @@global.tx_isolation REPEATABLE-READ @@ -790,3 +791,4 @@ eta tipo c ** connection default drop table t1; drop user mysqltest@localhost; +SET SQL_MODE=default; diff --git a/mysql-test/r/concurrent_innodb_unsafelog.result b/mysql-test/r/concurrent_innodb_unsafelog.result index 35fc2d89cfe..4a140d9e610 100644 --- a/mysql-test/r/concurrent_innodb_unsafelog.result +++ b/mysql-test/r/concurrent_innodb_unsafelog.result @@ -1,4 +1,5 @@ SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ; +SET SQL_MODE=""; SELECT @@global.tx_isolation; @@global.tx_isolation REPEATABLE-READ @@ -786,3 +787,4 @@ eta tipo c ** connection default drop table t1; drop user mysqltest@localhost; +SET SQL_MODE=default; diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result index 32c7bdfcf12..315aea0ef46 100644 --- a/mysql-test/r/connect.result +++ b/mysql-test/r/connect.result @@ -1,3 +1,4 @@ +SET global secure_auth=0; drop table if exists t1,t2; show tables; Tables_in_mysql @@ -143,6 +144,7 @@ drop table t1; # -- Bug#33507: Event scheduler creates more threads than max_connections # -- which results in user lockout. +CREATE USER mysqltest_u1@localhost; GRANT USAGE ON *.* TO mysqltest_u1@localhost; SET GLOBAL max_connections = 3; @@ -273,8 +275,8 @@ connect(localhost,mysqltest_nouser,newpw,test,MASTER_PORT,MASTER_SOCKET); ERROR 28000: Access denied for user 'mysqltest_nouser'@'localhost' (using password: YES) connect(localhost,mysqltest_nouser,,test,MASTER_PORT,MASTER_SOCKET); ERROR 28000: Access denied for user 'mysqltest_nouser'@'localhost' (using password: NO) -update mysql.user set password=authentication_string, authentication_string='' - where user like 'mysqltest_up_'; +update mysql.user set plugin='mysql_native_password' where user = 'mysqltest_up1'; +update mysql.user set plugin='mysql_old_password' where user = 'mysqltest_up2'; select user, password, plugin, authentication_string from mysql.user where user like 'mysqltest_up_'; user password plugin authentication_string @@ -313,3 +315,4 @@ test test test drop procedure p1; +SET global secure_auth=default; diff --git a/mysql-test/r/create-big.result b/mysql-test/r/create-big.result index 5aa44c2941d..bb8c62bb25c 100644 --- a/mysql-test/r/create-big.result +++ b/mysql-test/r/create-big.result @@ -9,7 +9,7 @@ ERROR 42S01: Table 't1' already exists show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `i` int(1) NOT NULL DEFAULT '0' + `i` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go'; @@ -21,7 +21,7 @@ ERROR 42S01: Table 't1' already exists show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `i` int(1) NOT NULL DEFAULT '0' + `i` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t3 (j char(5)); @@ -34,7 +34,7 @@ ERROR 42S01: Table 't1' already exists show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `i` int(1) NOT NULL DEFAULT '0' + `i` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go'; @@ -46,7 +46,7 @@ ERROR 42S01: Table 't1' already exists show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `i` int(1) NOT NULL DEFAULT '0' + `i` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go'; @@ -58,7 +58,7 @@ ERROR 42S01: Table 't1' already exists show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `i` int(1) NOT NULL DEFAULT '0' + `i` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go'; @@ -70,7 +70,7 @@ ERROR 42S01: Table 't1' already exists show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `i` int(1) NOT NULL DEFAULT '0' + `i` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1,t3; set debug_sync='create_table_select_before_open SIGNAL parked WAIT_FOR go'; diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 372e2baa02b..cad46f34c75 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -131,12 +131,12 @@ drop table t2; create table t2 select now() as a , curtime() as b, curdate() as c , 1+1 as d , 1.0 + 1 as e , 33333333333333333 + 3 as f; describe t2; Field Type Null Key Default Extra -a datetime NO 0000-00-00 00:00:00 -b time NO 00:00:00 -c date NO 0000-00-00 -d int(3) NO 0 -e decimal(3,1) NO 0.0 -f bigint(19) NO 0 +a datetime NO NULL +b time NO NULL +c date NO NULL +d int(3) NO NULL +e decimal(3,1) NO NULL +f bigint(19) NO NULL drop table t2; create table t2 select CAST("2001-12-29" AS DATE) as d, CAST("20:45:11" AS TIME) as t, CAST("2001-12-29 20:45:11" AS DATETIME) as dt; describe t2; @@ -481,10 +481,10 @@ from t1; explain t2; Field Type Null Key Default Extra a int(11) YES NULL -b bigint(11) NO 0 -c bigint(10) unsigned NO 0 +b bigint(11) NO NULL +c bigint(10) unsigned NO NULL d date YES NULL -e varchar(1) NO +e varchar(1) NO NULL f datetime YES NULL g time YES NULL h longblob NO NULL @@ -494,7 +494,7 @@ a b c d e f g h dd 1 -7 7 2000-01-01 b 2000-01-01 00:00:00 05:04:03 yet another binary data 02:00:00 2 -2 2 1825-12-14 a 2003-01-01 03:02:01 04:03:02 binary data 02:00:00 drop table t1, t2; -create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp, l datetime, m enum('a','b'), n set('a','b'), o char(10)); +create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, l datetime, m enum('a','b'), n set('a','b'), o char(10)); create table t2 select ifnull(a,a), ifnull(b,b), ifnull(c,c), ifnull(d,d), ifnull(e,e), ifnull(f,f), ifnull(g,g), ifnull(h,h), ifnull(i,i), ifnull(j,j), ifnull(k,k), ifnull(l,l), ifnull(m,m), ifnull(n,n), ifnull(o,o) from t1; show create table t2; Table Create Table @@ -727,7 +727,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) NOT NULL, `a` varchar(12) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, - `c` int(1) NOT NULL DEFAULT '0', + `c` int(1) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; @@ -740,7 +740,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, `a` varchar(12) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, - `c` int(1) NOT NULL DEFAULT '0', + `c` int(1) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; @@ -763,7 +763,7 @@ b int not null, primary key (a) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(12) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', + `a` varchar(12) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `b` int(11) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -912,788 +912,6 @@ unlock tables; drop table t1, t2; create table t1 (upgrade int); drop table t1; -create table t1 ( -c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, c8 int, -c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int, -key a001_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a002_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a003_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a004_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a005_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a006_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a007_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a008_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a009_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a010_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a011_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a012_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a013_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a014_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a015_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a016_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a017_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a018_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a019_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a020_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a021_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a022_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a023_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a024_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a025_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a026_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a027_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a028_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a029_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a030_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a031_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a032_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a033_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a034_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a035_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a036_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a037_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a038_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a039_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a040_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a041_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a042_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a043_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a044_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a045_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a046_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a047_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a048_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a049_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a050_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a051_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a052_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a053_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a054_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a055_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a056_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a057_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a058_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a059_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a060_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a061_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a062_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a063_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -key a064_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16) -); -Warnings: -Note 1831 Duplicate index 'a002_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a003_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a004_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a005_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a006_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a007_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a008_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a009_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a010_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a011_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a012_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a013_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a014_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a015_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a016_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a017_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a018_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a019_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a020_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a021_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a022_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a023_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a024_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a025_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a026_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a027_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a028_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a029_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a030_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a031_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a032_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a033_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a034_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a035_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a036_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a037_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a038_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a039_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a040_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a041_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a042_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a043_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a044_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a045_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a046_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a047_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a048_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a049_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a050_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a051_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a052_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a053_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a054_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a055_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a056_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a057_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a058_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a059_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a060_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a061_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a062_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a063_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a064_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int(11) DEFAULT NULL, - `c2` int(11) DEFAULT NULL, - `c3` int(11) DEFAULT NULL, - `c4` int(11) DEFAULT NULL, - `c5` int(11) DEFAULT NULL, - `c6` int(11) DEFAULT NULL, - `c7` int(11) DEFAULT NULL, - `c8` int(11) DEFAULT NULL, - `c9` int(11) DEFAULT NULL, - `c10` int(11) DEFAULT NULL, - `c11` int(11) DEFAULT NULL, - `c12` int(11) DEFAULT NULL, - `c13` int(11) DEFAULT NULL, - `c14` int(11) DEFAULT NULL, - `c15` int(11) DEFAULT NULL, - `c16` int(11) DEFAULT NULL, - KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -flush tables; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int(11) DEFAULT NULL, - `c2` int(11) DEFAULT NULL, - `c3` int(11) DEFAULT NULL, - `c4` int(11) DEFAULT NULL, - `c5` int(11) DEFAULT NULL, - `c6` int(11) DEFAULT NULL, - `c7` int(11) DEFAULT NULL, - `c8` int(11) DEFAULT NULL, - `c9` int(11) DEFAULT NULL, - `c10` int(11) DEFAULT NULL, - `c11` int(11) DEFAULT NULL, - `c12` int(11) DEFAULT NULL, - `c13` int(11) DEFAULT NULL, - `c14` int(11) DEFAULT NULL, - `c15` int(11) DEFAULT NULL, - `c16` int(11) DEFAULT NULL, - KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -drop table t1; -create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, -c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int); -alter table t1 -add key a001_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a002_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a003_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a004_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a005_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a006_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a007_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a008_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a009_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a010_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a011_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a012_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a013_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a014_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a015_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a016_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a017_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a018_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a019_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a020_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a021_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a022_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a023_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a024_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a025_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a026_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a027_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a028_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a029_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a030_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a031_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a032_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a033_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a034_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a035_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a036_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a037_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a038_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a039_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a040_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a041_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a042_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a043_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a044_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a045_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a046_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a047_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a048_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a049_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a050_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a051_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a052_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a053_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a054_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a055_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a056_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a057_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a058_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a059_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a060_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a061_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a062_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a063_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), -add key a064_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16); -Warnings: -Note 1831 Duplicate index 'a002_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a003_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a004_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a005_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a006_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a007_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a008_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a009_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a010_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a011_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a012_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a013_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a014_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a015_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a016_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a017_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a018_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a019_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a020_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a021_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a022_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a023_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a024_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a025_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a026_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a027_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a028_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a029_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a030_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a031_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a032_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a033_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a034_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a035_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a036_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a037_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a038_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a039_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a040_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a041_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a042_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a043_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a044_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a045_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a046_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a047_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a048_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a049_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a050_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a051_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a052_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a053_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a054_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a055_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a056_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a057_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a058_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a059_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a060_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a061_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a062_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a063_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Note 1831 Duplicate index 'a064_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int(11) DEFAULT NULL, - `c2` int(11) DEFAULT NULL, - `c3` int(11) DEFAULT NULL, - `c4` int(11) DEFAULT NULL, - `c5` int(11) DEFAULT NULL, - `c6` int(11) DEFAULT NULL, - `c7` int(11) DEFAULT NULL, - `c8` int(11) DEFAULT NULL, - `c9` int(11) DEFAULT NULL, - `c10` int(11) DEFAULT NULL, - `c11` int(11) DEFAULT NULL, - `c12` int(11) DEFAULT NULL, - `c13` int(11) DEFAULT NULL, - `c14` int(11) DEFAULT NULL, - `c15` int(11) DEFAULT NULL, - `c16` int(11) DEFAULT NULL, - KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -flush tables; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int(11) DEFAULT NULL, - `c2` int(11) DEFAULT NULL, - `c3` int(11) DEFAULT NULL, - `c4` int(11) DEFAULT NULL, - `c5` int(11) DEFAULT NULL, - `c6` int(11) DEFAULT NULL, - `c7` int(11) DEFAULT NULL, - `c8` int(11) DEFAULT NULL, - `c9` int(11) DEFAULT NULL, - `c10` int(11) DEFAULT NULL, - `c11` int(11) DEFAULT NULL, - `c12` int(11) DEFAULT NULL, - `c13` int(11) DEFAULT NULL, - `c14` int(11) DEFAULT NULL, - `c15` int(11) DEFAULT NULL, - `c16` int(11) DEFAULT NULL, - KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), - KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -alter table t1 add key -a065_long_123456789_123456789_123456789_123456789_123456789_1234 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16); -ERROR 42000: Too many keys specified; max 64 keys allowed -drop table t1; -create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, -c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, -c16 int, c17 int, c18 int,c19 int,c20 int,c21 int,c22 int,c23 int,c24 int,c25 int,c26 int,c27 int,c28 int,c29 int,c30 int,c31 int,c32 int, c33 int); -alter table t1 add key i1 ( -c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16, c17,c18,c19,c20,c21,c22,c23,c24,c25,c26,c27,c28,c29,c30,c31,c32,c33); -ERROR 42000: Too many key parts specified; max 32 parts allowed -alter table t1 add key -a001_long_123456789_123456789_123456789_123456789_123456789_12345 (c1); -ERROR 42000: Identifier name 'a001_long_123456789_123456789_123456789_123456789_123456789_12345' is too long -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int(11) DEFAULT NULL, - `c2` int(11) DEFAULT NULL, - `c3` int(11) DEFAULT NULL, - `c4` int(11) DEFAULT NULL, - `c5` int(11) DEFAULT NULL, - `c6` int(11) DEFAULT NULL, - `c7` int(11) DEFAULT NULL, - `c8` int(11) DEFAULT NULL, - `c9` int(11) DEFAULT NULL, - `c10` int(11) DEFAULT NULL, - `c11` int(11) DEFAULT NULL, - `c12` int(11) DEFAULT NULL, - `c13` int(11) DEFAULT NULL, - `c14` int(11) DEFAULT NULL, - `c15` int(11) DEFAULT NULL, - `c16` int(11) DEFAULT NULL, - `c17` int(11) DEFAULT NULL, - `c18` int(11) DEFAULT NULL, - `c19` int(11) DEFAULT NULL, - `c20` int(11) DEFAULT NULL, - `c21` int(11) DEFAULT NULL, - `c22` int(11) DEFAULT NULL, - `c23` int(11) DEFAULT NULL, - `c24` int(11) DEFAULT NULL, - `c25` int(11) DEFAULT NULL, - `c26` int(11) DEFAULT NULL, - `c27` int(11) DEFAULT NULL, - `c28` int(11) DEFAULT NULL, - `c29` int(11) DEFAULT NULL, - `c30` int(11) DEFAULT NULL, - `c31` int(11) DEFAULT NULL, - `c32` int(11) DEFAULT NULL, - `c33` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -drop table t1; Bug #26104 Bug on foreign key class constructor @@ -1925,7 +1143,9 @@ t1 CREATE TABLE `t1` ( `PROGRESS` decimal(7,3) NOT NULL DEFAULT '0.000', `MEMORY_USED` int(7) NOT NULL DEFAULT '0', `EXAMINED_ROWS` int(7) NOT NULL DEFAULT '0', - `QUERY_ID` bigint(4) NOT NULL DEFAULT '0' + `QUERY_ID` bigint(4) NOT NULL DEFAULT '0', + `INFO_BINARY` blob, + `TID` bigint(4) NOT NULL DEFAULT '0' ) DEFAULT CHARSET=utf8 drop table t1; create temporary table t1 like information_schema.processlist; @@ -1946,7 +1166,9 @@ t1 CREATE TEMPORARY TABLE `t1` ( `PROGRESS` decimal(7,3) NOT NULL DEFAULT '0.000', `MEMORY_USED` int(7) NOT NULL DEFAULT '0', `EXAMINED_ROWS` int(7) NOT NULL DEFAULT '0', - `QUERY_ID` bigint(4) NOT NULL DEFAULT '0' + `QUERY_ID` bigint(4) NOT NULL DEFAULT '0', + `INFO_BINARY` blob, + `TID` bigint(4) NOT NULL DEFAULT '0' ) DEFAULT CHARSET=utf8 drop table t1; create table t1 like information_schema.character_sets; @@ -1968,14 +1190,14 @@ DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; DROP TABLE IF EXISTS t3; -CREATE TABLE t1(c1 TIMESTAMP, c2 TIMESTAMP); +CREATE TABLE t1(c1 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c2 TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'); SET sql_mode = NO_ZERO_DATE; CREATE TABLE t2(c1 TIMESTAMP, c2 TIMESTAMP DEFAULT 0); ERROR 42000: Invalid default value for 'c2' -CREATE TABLE t2(c1 TIMESTAMP, c2 TIMESTAMP); +CREATE TABLE t2(c1 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c2 TIMESTAMP NOT NULL); ERROR 42000: Invalid default value for 'c2' # -- Check that NULL column still can be created. @@ -2120,6 +1342,11 @@ CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW BEGIN UPDATE A SET `pk`=1 WHERE `pk`=0 ; END ;| +ERROR HY000: Trigger already exists +CREATE TRIGGER f1 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +UPDATE A SET `pk`=1 WHERE `pk`=0 ; +END ;| ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table' DROP TABLE t1; DROP TABLE B; diff --git a/mysql-test/r/create_drop_binlog.result b/mysql-test/r/create_drop_binlog.result new file mode 100644 index 00000000000..537a1bd4605 --- /dev/null +++ b/mysql-test/r/create_drop_binlog.result @@ -0,0 +1,392 @@ +CREATE OR REPLACE DATABASE d1; +CREATE OR REPLACE DATABASE d1; +DROP DATABASE d1; +CREATE DATABASE IF NOT EXISTS d1; +CREATE DATABASE IF NOT EXISTS d1; +Warnings: +Note 1007 Can't create database 'd1'; database exists +DROP DATABASE IF EXISTS d1; +DROP DATABASE IF EXISTS d1; +Warnings: +Note 1008 Can't drop database 'd1'; database doesn't exist +"Runnig SHOW BINLOG EVENTS" +Log_name Pos Event_type Server_id End_log_pos Info +# # Gtid 1 # GTID #-#-# +# # Query 1 # CREATE OR REPLACE DATABASE d1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # CREATE OR REPLACE DATABASE d1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # DROP DATABASE d1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # CREATE DATABASE IF NOT EXISTS d1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # CREATE DATABASE IF NOT EXISTS d1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # DROP DATABASE IF EXISTS d1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # DROP DATABASE IF EXISTS d1 +RESET MASTER; +USE test; +CREATE OR REPLACE FUNCTION f1() RETURNS INT RETURN 1; +CREATE OR REPLACE FUNCTION f1() RETURNS INT RETURN 1; +DROP FUNCTION f1; +CREATE FUNCTION IF NOT EXISTS f1() RETURNS INT RETURN 1; +CREATE FUNCTION IF NOT EXISTS f1() RETURNS INT RETURN 1; +Warnings: +Note 1304 FUNCTION f1 already exists +DROP FUNCTION IF EXISTS f1; +DROP FUNCTION IF EXISTS f1; +Warnings: +Note 1305 FUNCTION test.f1 does not exist +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) +RETURN 1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) +RETURN 1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP FUNCTION f1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION IF NOT EXISTS `f1`() RETURNS int(11) +RETURN 1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION IF NOT EXISTS `f1`() RETURNS int(11) +RETURN 1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP FUNCTION IF EXISTS f1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP FUNCTION IF EXISTS f1 +RESET MASTER; +CREATE TABLE t1 (a DATETIME); +CREATE OR REPLACE PROCEDURE p1() DELETE FROM t1; +CREATE OR REPLACE PROCEDURE p1() DELETE FROM t1; +DROP PROCEDURE p1; +CREATE PROCEDURE IF NOT EXISTS p1() DELETE FROM t1; +CREATE PROCEDURE IF NOT EXISTS p1() DELETE FROM t1; +Warnings: +Note 1304 PROCEDURE p1 already exists +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p1; +Warnings: +Note 1305 PROCEDURE test.p1 does not exist +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE TABLE t1 (a DATETIME) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `p1`() +DELETE FROM t1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `p1`() +DELETE FROM t1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP PROCEDURE p1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE IF NOT EXISTS `p1`() +DELETE FROM t1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE IF NOT EXISTS `p1`() +DELETE FROM t1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP PROCEDURE IF EXISTS p1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP PROCEDURE IF EXISTS p1 +DROP TABLE t1; +RESET MASTER; +CREATE OR REPLACE FUNCTION metaphon RETURNS STRING SONAME 'UDF_EXAMPLE_LIB'; +CREATE OR REPLACE FUNCTION metaphon RETURNS STRING SONAME 'UDF_EXAMPLE_LIB'; +DROP FUNCTION metaphon; +CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME 'UDF_EXAMPLE_LIB'; +CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME 'UDF_EXAMPLE_LIB'; +Warnings: +Note 1125 Function 'metaphon' already exists +DROP FUNCTION IF EXISTS metaphon; +DROP FUNCTION IF EXISTS metaphon; +Warnings: +Note 1305 FUNCTION test.metaphon does not exist +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE FUNCTION metaphon RETURNS STRING SONAME 'UDM_EXAMPLE_LIB' +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE FUNCTION metaphon RETURNS STRING SONAME 'UDM_EXAMPLE_LIB' +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP FUNCTION metaphon +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME 'UDM_EXAMPLE_LIB' +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME 'UDM_EXAMPLE_LIB' +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP FUNCTION IF EXISTS metaphon +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP FUNCTION IF EXISTS metaphon +RESET MASTER; +# +# CREATE SERVER is not logged +# +CREATE OR REPLACE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'root', HOST 'localhost', DATABASE 'test'); +CREATE OR REPLACE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'root', HOST 'localhost', DATABASE 'test'); +DROP SERVER s1; +CREATE SERVER IF NOT EXISTS s1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'root', HOST 'localhost', DATABASE 'test'); +CREATE SERVER IF NOT EXISTS s1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'root', HOST 'localhost', DATABASE 'test'); +Warnings: +Note 1476 The foreign server, s1, you are trying to create already exists. +DROP SERVER IF EXISTS s1; +DROP SERVER IF EXISTS s1; +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +RESET MASTER; +CREATE OR REPLACE VIEW v1 AS SELECT 1; +CREATE OR REPLACE VIEW v1 AS SELECT 1; +DROP VIEW v1; +CREATE VIEW IF NOT EXISTS v1 AS SELECT 1; +CREATE VIEW IF NOT EXISTS v1 AS SELECT 1; +Warnings: +Note 1050 Table 'v1' already exists +DROP VIEW IF EXISTS v1; +DROP VIEW IF EXISTS v1; +Warnings: +Note 1051 Unknown table 'test.v1' +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS SELECT 1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS SELECT 1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP VIEW v1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW IF NOT EXISTS `v1` AS SELECT 1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW IF NOT EXISTS `v1` AS SELECT 1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP VIEW IF EXISTS v1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP VIEW IF EXISTS v1 +RESET MASTER; +CREATE OR REPLACE ROLE r1; +CREATE OR REPLACE ROLE r1; +DROP ROLE r1; +CREATE ROLE IF NOT EXISTS r1; +CREATE ROLE IF NOT EXISTS r1; +Warnings: +Note 1975 Can't create role 'r1'; it already exists +DROP ROLE IF EXISTS r1; +DROP ROLE IF EXISTS r1; +Warnings: +Note 1976 Can't drop role 'r1'; it doesn't exist +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE ROLE r1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE ROLE r1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP ROLE r1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE ROLE IF NOT EXISTS r1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE ROLE IF NOT EXISTS r1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP ROLE IF EXISTS r1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP ROLE IF EXISTS r1 +RESET MASTER; +CREATE OR REPLACE USER u1@localhost; +CREATE OR REPLACE USER u1@localhost; +DROP USER u1@localhost; +CREATE USER IF NOT EXISTS u1@localhost; +CREATE USER IF NOT EXISTS u1@localhost; +Warnings: +Note 1973 Can't create user 'u1'@'localhost'; it already exists +DROP USER IF EXISTS u1@localhost; +DROP USER IF EXISTS u1@localhost; +Warnings: +Note 1974 Can't drop user 'u1'@'localhost'; it doesn't exist +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE USER u1@localhost +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE USER u1@localhost +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP USER u1@localhost +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE USER IF NOT EXISTS u1@localhost +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE USER IF NOT EXISTS u1@localhost +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP USER IF EXISTS u1@localhost +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP USER IF EXISTS u1@localhost +RESET MASTER; +SET timestamp=UNIX_TIMESTAMP('2014-11-01 10:20:30'); +CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE IF EXISTS t1; +CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE IF EXISTS t2; +SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS; +EVENT_NAME EVENT_DEFINITION +ev1 DROP TABLE IF EXISTS t2 +DROP EVENT ev1; +DROP EVENT IF EXISTS ev1; +Warnings: +Note 1305 Event ev1 does not exist +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE IF EXISTS t1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE IF EXISTS t2 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP EVENT ev1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP EVENT IF EXISTS ev1 +RESET MASTER; +CREATE TABLE t1 (a INT); +CREATE OR REPLACE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=10; +CREATE OR REPLACE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=11; +DROP TRIGGER tr1; +CREATE TRIGGER IF NOT EXISTS tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=20; +CREATE TRIGGER IF NOT EXISTS tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=21; +Warnings: +Note 1359 Trigger already exists +DROP TRIGGER IF EXISTS tr1; +DROP TRIGGER IF EXISTS tr1; +Warnings: +Note 1360 Trigger does not exist +DROP TABLE t1; +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE TABLE t1 (a INT) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=10 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=11 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP TRIGGER tr1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER IF NOT EXISTS tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=20 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER IF NOT EXISTS tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=21 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP TRIGGER IF EXISTS tr1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP TRIGGER IF EXISTS tr1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP TABLE `t1` /* generated by server */ +RESET MASTER; +CREATE TABLE t1(a INT, b INT); +CREATE TABLE IF NOT EXISTS t1(a INT, b INT); +Warnings: +Note 1050 Table 't1' already exists +CREATE OR REPLACE INDEX i1 ON t1(a); +CREATE OR REPLACE INDEX i1 ON t1(a); +CREATE OR REPLACE INDEX i1 ON t1(a,b); +CREATE OR REPLACE INDEX i1 ON t1(a,b); +DROP TABLE t1; +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE TABLE t1(a INT, b INT) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS t1(a INT, b INT) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE INDEX i1 ON t1(a) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE INDEX i1 ON t1(a) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE INDEX i1 ON t1(a,b) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE INDEX i1 ON t1(a,b) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP TABLE `t1` /* generated by server */ +RESET MASTER; +RESET MASTER; +SHOW MASTER STATUS; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 <pos> +RESET MASTER TO 100; +SHOW MASTER STATUS; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000100 <pos> +RESET MASTER; +SHOW MASTER STATUS; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 <pos> +CREATE TABLE t1(a INT, b INT); +CREATE TABLE IF NOT EXISTS t1(a INT, b INT); +Warnings: +Note 1050 Table 't1' already exists +CREATE INDEX IF NOT EXISTS i1 ON t1(a); +CREATE INDEX IF NOT EXISTS i1 ON t1(a); +Warnings: +Note 1061 Duplicate key name 'i1' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + KEY `i1` (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP INDEX IF EXISTS i1 ON t1; +DROP INDEX IF EXISTS i1 ON t1; +Warnings: +Note 1091 Can't DROP 'i1'; check that column/key exists +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE TABLE t1(a INT, b INT) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS t1(a INT, b INT) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE INDEX IF NOT EXISTS i1 ON t1(a) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE INDEX IF NOT EXISTS i1 ON t1(a) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP INDEX IF EXISTS i1 ON t1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP INDEX IF EXISTS i1 ON t1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP TABLE `t1` /* generated by server */ +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */ +RESET MASTER; diff --git a/mysql-test/r/create_drop_db.result b/mysql-test/r/create_drop_db.result new file mode 100644 index 00000000000..aee88703c9b --- /dev/null +++ b/mysql-test/r/create_drop_db.result @@ -0,0 +1,40 @@ +CREATE DATABASE IF NOT EXISTS db1; +affected rows: 1 +CREATE DATABASE IF NOT EXISTS db1; +affected rows: 0 +Warnings: +Note 1007 Can't create database 'db1'; database exists +CREATE TABLE db1.t1 (a INT); +affected rows: 0 +SHOW TABLES IN db1; +Tables_in_db1 +t1 +affected rows: 1 +CREATE OR REPLACE DATABASE db1; +affected rows: 2 +SHOW TABLES IN db1; +Tables_in_db1 +affected rows: 0 +CREATE OR REPLACE DATABASE IF NOT EXISTS db2; +ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS +DROP DATABASE db1; +affected rows: 0 +DROP DATABASE IF EXISTS db1; +affected rows: 0 +Warnings: +Note 1008 Can't drop database 'db1'; database doesn't exist +DROP DATABASE db1; +ERROR HY000: Can't drop database 'db1'; database doesn't exist +CREATE OR REPLACE DATABASE db1; +affected rows: 1 +SHOW TABLES IN db1; +Tables_in_db1 +affected rows: 0 +CREATE DATABASE db1; +ERROR HY000: Can't create database 'db1'; database exists +DROP DATABASE IF EXISTS db1; +affected rows: 0 +DROP DATABASE IF EXISTS db1; +affected rows: 0 +Warnings: +Note 1008 Can't drop database 'db1'; database doesn't exist diff --git a/mysql-test/r/create_drop_event.result b/mysql-test/r/create_drop_event.result new file mode 100644 index 00000000000..0d69e85dfd6 --- /dev/null +++ b/mysql-test/r/create_drop_event.result @@ -0,0 +1,48 @@ +SET timestamp=UNIX_TIMESTAMP('2014-11-01 10:20:30'); +SET GLOBAL event_scheduler=off; +CREATE TABLE t1 (a INT); +CREATE OR REPLACE EVENT IF NOT EXISTS ev1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE db1; +ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS +CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (10); +SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS; +EVENT_NAME EVENT_DEFINITION +ev1 INSERT INTO t1 VALUES (10) +SET GLOBAL event_scheduler=on; +SELECT DISTINCT a FROM t1; +a +10 +SET GLOBAL event_scheduler=off; +DELETE FROM t1; +CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (11); +ERROR HY000: Event 'ev1' already exists +SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS; +EVENT_NAME EVENT_DEFINITION +ev1 INSERT INTO t1 VALUES (10) +CREATE EVENT IF NOT EXISTS ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (12); +Warnings: +Note 1537 Event 'ev1' already exists +SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS; +EVENT_NAME EVENT_DEFINITION +ev1 INSERT INTO t1 VALUES (10) +CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (13); +SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS; +EVENT_NAME EVENT_DEFINITION +ev1 INSERT INTO t1 VALUES (13) +SET GLOBAL event_scheduler=on; +SELECT DISTINCT a FROM t1; +a +13 +SET GLOBAL event_scheduler=off; +DELETE FROM t1; +DROP EVENT IF EXISTS ev1; +SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS; +EVENT_NAME EVENT_DEFINITION +DROP EVENT IF EXISTS ev1; +Warnings: +Note 1305 Event ev1 does not exist +DROP EVENT ev1; +ERROR HY000: Unknown event 'ev1' +SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS; +EVENT_NAME EVENT_DEFINITION +DROP TABLE t1; +SET timestamp=DEFAULT; diff --git a/mysql-test/r/create_drop_function.result b/mysql-test/r/create_drop_function.result new file mode 100644 index 00000000000..e9db636ab87 --- /dev/null +++ b/mysql-test/r/create_drop_function.result @@ -0,0 +1,54 @@ +SET timestamp=UNIX_TIMESTAMP('2014-09-30 08:00:00'); +CREATE FUNCTION f1(str char(20)) +RETURNS CHAR(100) +RETURN CONCAT('Hello, ', str, '!'); +SELECT * FROM mysql.proc WHERE name like 'f1'; +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 +test f1 FUNCTION f1 SQL CONTAINS_SQL NO DEFINER str char(20) char(100) CHARSET latin1 RETURN CONCAT('Hello, ', str, '!') root@localhost 2014-09-30 08:00:00 2014-09-30 08:00:00 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci RETURN CONCAT('Hello, ', str, '!') +SELECT f1('world'); +f1('world') +Hello, world! +CREATE FUNCTION f1(str char(20)) +RETURNS TEXT +RETURN CONCAT('Hello2, ', str, '!'); +ERROR 42000: FUNCTION f1 already exists +SELECT body FROM mysql.proc WHERE name like 'f1'; +body +RETURN CONCAT('Hello, ', str, '!') +CREATE FUNCTION IF NOT EXISTS f1(str char(20)) +RETURNS CHAR(100) +RETURN CONCAT('Hello3, ', str, '!'); +Warnings: +Note 1304 FUNCTION f1 already exists +SELECT body FROM mysql.proc WHERE name like 'f1'; +body +RETURN CONCAT('Hello, ', str, '!') +CREATE OR REPLACE FUNCTION IF NOT EXISTS f1(str char(20)) +RETURNS CHAR(100) +RETURN CONCAT('Hello4, ', str, '!'); +ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS +SELECT body FROM mysql.proc WHERE name like 'f1'; +body +RETURN CONCAT('Hello, ', str, '!') +CREATE OR REPLACE FUNCTION f1(str char(20)) +RETURNS CHAR(100) +RETURN CONCAT('Hello5, ', str, '!'); +SELECT body FROM mysql.proc WHERE name like 'f1'; +body +RETURN CONCAT('Hello5, ', str, '!') +DROP FUNCTION f1; +CREATE FUNCTION IF NOT EXISTS f1(str char(20)) +RETURNS CHAR(100) +RETURN CONCAT('Hello6, ', str, '!'); +SELECT body FROM mysql.proc WHERE name like 'f1'; +body +RETURN CONCAT('Hello6, ', str, '!') +SELECT f1('world'); +f1('world') +Hello6, world! +DROP FUNCTION IF EXISTS f1; +SELECT body FROM mysql.proc WHERE name like 'f1'; +body +DROP FUNCTION IF EXISTS f1; +Warnings: +Note 1305 FUNCTION test.f1 does not exist diff --git a/mysql-test/r/create_drop_index.result b/mysql-test/r/create_drop_index.result new file mode 100644 index 00000000000..113c32aca4d --- /dev/null +++ b/mysql-test/r/create_drop_index.result @@ -0,0 +1,44 @@ +CREATE TABLE t1(a INT, b INT); +CREATE INDEX IF NOT EXISTS i1 ON t1(a); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + KEY `i1` (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP INDEX IF EXISTS i1 ON t1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP INDEX IF EXISTS i1 ON t1; +Warnings: +Note 1091 Can't DROP 'i1'; check that column/key exists +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE OR REPLACE INDEX i1 ON t1(a); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + KEY `i1` (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE OR REPLACE INDEX i1 ON t1(a,b); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + KEY `i1` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE OR REPLACE INDEX IF NOT EXISTS i1 ON t1(b,a); +ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS diff --git a/mysql-test/r/create_drop_procedure.result b/mysql-test/r/create_drop_procedure.result new file mode 100644 index 00000000000..02c71ab6446 --- /dev/null +++ b/mysql-test/r/create_drop_procedure.result @@ -0,0 +1,47 @@ +CREATE TABLE t1 (id INT); +CREATE PROCEDURE proc1 (OUT cnt INT) COMMENT 'comment1' BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$ +CALL proc1(@cnt); +SELECT @cnt; +@cnt +0 +INSERT INTO t1 VALUES (1), (2), (3); +CALL proc1(@cnt); +SELECT @cnt; +@cnt +3 +CREATE PROCEDURE proc1 (OUT cnt INT) COMMENT 'comment2' + BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$ +ERROR 42000: PROCEDURE proc1 already exists +SELECT comment FROM mysql.proc WHERE name='proc1'$$ +comment +comment1 +CREATE PROCEDURE IF NOT EXISTS proc1 (OUT cnt INT) COMMENT 'comment3' + BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$ +Warnings: +Note 1304 PROCEDURE proc1 already exists +SELECT comment FROM mysql.proc WHERE name='proc1'$$ +comment +comment1 +CREATE OR REPLACE PROCEDURE IF NOT EXISTS proc1 (OUT cnt INT) COMMENT 'comment4' + BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$ +ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS +SELECT comment FROM mysql.proc WHERE name='proc1'$$ +comment +comment1 +CREATE OR REPLACE PROCEDURE proc1 (OUT cnt INT) COMMENT 'comment5' + BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$ +SELECT comment FROM mysql.proc WHERE name='proc1'$$ +comment +comment5 +DROP PROCEDURE proc1; +CREATE PROCEDURE IF NOT EXISTS proc1 (OUT cnt INT) BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$ +INSERT INTO t1 VALUES (1), (2), (3); +CALL proc1(@cnt); +SELECT @cnt; +@cnt +6 +DROP TABLE IF EXISTS t1; +DROP PROCEDURE IF EXISTS proc1; +DROP PROCEDURE IF EXISTS proc1; +Warnings: +Note 1305 PROCEDURE test.proc1 does not exist diff --git a/mysql-test/r/create_drop_role.result b/mysql-test/r/create_drop_role.result new file mode 100644 index 00000000000..6e05900264d --- /dev/null +++ b/mysql-test/r/create_drop_role.result @@ -0,0 +1,75 @@ +CREATE ROLE IF NOT EXISTS role1 WITH ADMIN user1; +Warnings: +Note 1449 The user specified as a definer ('user1'@'%') does not exist +SELECT * FROM mysql.roles_mapping; +Host User Role Admin_option +% user1 role1 Y +DROP ROLE role1; +CREATE OR REPLACE ROLE role1 WITH ADMIN user2; +Warnings: +Note 1449 The user specified as a definer ('user2'@'%') does not exist +SELECT * FROM mysql.roles_mapping WHERE Role='role1'; +Host User Role Admin_option +% user2 role1 Y +CREATE OR REPLACE ROLE role1 WITH ADMIN user3; +Warnings: +Note 1449 The user specified as a definer ('user3'@'%') does not exist +SELECT * FROM mysql.roles_mapping WHERE Role='role1'; +Host User Role Admin_option +% user3 role1 Y +CREATE ROLE IF NOT EXISTS role1 WITH ADMIN user4; +Warnings: +Note 1449 The user specified as a definer ('user4'@'%') does not exist +Note 1975 Can't create role 'role1'; it already exists +SELECT * FROM mysql.roles_mapping WHERE Role='role1'; +Host User Role Admin_option +% user3 role1 Y +DROP ROLE IF EXISTS role1; +SELECT * FROM mysql.roles_mapping WHERE Role='role1'; +Host User Role Admin_option +DROP ROLE IF EXISTS role1; +Warnings: +Note 1976 Can't drop role 'role1'; it doesn't exist +CREATE ROLE role_1; +CREATE ROLE IF NOT EXISTS role_1; +Warnings: +Note 1975 Can't create role 'role_1'; it already exists +CREATE OR REPLACE ROLE role_1; +CREATE OR REPLACE ROLE IF NOT EXISTS role_1; +ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS +CREATE ROLE role_1; +ERROR HY000: Operation CREATE ROLE failed for 'role_1' +CREATE USER u1@localhost; +REVOKE SHOW DATABASES ON *.* FROM 'u1'@'localhost'; +GRANT SHOW DATABASES ON *.* TO role_1; +GRANT role_1 TO u1@localhost; +SELECT CURRENT_USER; +CURRENT_USER +u1@localhost +SHOW DATABASES; +Database +information_schema +test +SELECT CURRENT_ROLE; +CURRENT_ROLE +NULL +SET ROLE role_1; +SELECT CURRENT_ROLE; +CURRENT_ROLE +role_1 +SHOW DATABASES; +Database +information_schema +mtr +mysql +performance_schema +test +SET ROLE NONE; +# Clearing up +DROP ROLE role_1; +DROP ROLE IF EXISTS role_1; +Warnings: +Note 1976 Can't drop role 'role_1'; it doesn't exist +DROP ROLE role_1; +ERROR HY000: Operation DROP ROLE failed for 'role_1' +DROP USER u1@localhost; diff --git a/mysql-test/r/create_drop_server.result b/mysql-test/r/create_drop_server.result new file mode 100644 index 00000000000..5c3c15ff477 --- /dev/null +++ b/mysql-test/r/create_drop_server.result @@ -0,0 +1,37 @@ +# +# MDEV-7285 SERVER: CREATE OR REPLACE and CREATE IF NOT EXISTS +# +CREATE SERVER IF NOT EXISTS server1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user1', HOST 'localhost', DATABASE 'test0'); +SELECT server_name, username, db FROM mysql.servers; +server_name username db +server1 user1 test0 +CREATE SERVER IF NOT EXISTS server1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user2', HOST 'localhost', DATABASE 'test1'); +Warnings: +Note 1476 The foreign server, server1, you are trying to create already exists. +SELECT server_name, username, db FROM mysql.servers; +server_name username db +server1 user1 test0 +CREATE OR REPLACE SERVER server1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user3', HOST 'localhost', DATABASE 'test2'); +SELECT server_name, username, db FROM mysql.servers; +server_name username db +server1 user3 test2 +DROP SERVER IF EXISTS server1; +SELECT server_name, username, db FROM mysql.servers; +server_name username db +DROP SERVER IF EXISTS server1; +CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test0'); +CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test1'); +ERROR HY000: The foreign server, server_1, you are trying to create already exists. +CREATE SERVER IF NOT EXISTS server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test2'); +Warnings: +Note 1476 The foreign server, server_1, you are trying to create already exists. +SELECT server_name, username, db FROM mysql.servers; +server_name username db +server_1 mysqltest_1 test0 +CREATE OR REPLACE SERVER IF NOT EXISTS server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test3'); +ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS +CREATE OR REPLACE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test4'); +SELECT server_name, username, db FROM mysql.servers; +server_name username db +server_1 mysqltest_1 test4 +DROP SERVER server_1; diff --git a/mysql-test/r/create_drop_trigger.result b/mysql-test/r/create_drop_trigger.result new file mode 100644 index 00000000000..a215838b0fd --- /dev/null +++ b/mysql-test/r/create_drop_trigger.result @@ -0,0 +1,37 @@ +CREATE DATABASE db1; +USE db1; +CREATE TABLE t1 (val INT); +CREATE TRIGGER IF NOT EXISTS val_sum BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + NEW.val; +SET @sum=0; +INSERT INTO t1 VALUES (10), (20), (30); +SELECT @sum; +@sum +60 +CREATE TRIGGER IF NOT EXISTS val_sum_new BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + NEW.val; +ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table' +CREATE TRIGGER IF NOT EXISTS val_sum AFTER INSERT ON t1 FOR EACH ROW SET @sum = @sum + 1 + NEW.val; +Warnings: +Note 1359 Trigger already exists +CREATE OR REPLACE TRIGGER IF NOT EXISTS val_sum BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + 2 + NEW.val; +ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS +SELECT ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='val_sum'; +ACTION_STATEMENT +SET @sum = @sum + NEW.val +CREATE OR REPLACE TRIGGER val_sum BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + 3 + NEW.val; +SELECT ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='val_sum'; +ACTION_STATEMENT +SET @sum = @sum + 3 + NEW.val +CREATE TRIGGER val_sum BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + 4 + NEW.val; +ERROR HY000: Trigger already exists +SELECT ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='val_sum'; +ACTION_STATEMENT +SET @sum = @sum + 3 + NEW.val +# Clearing up +DROP TRIGGER IF EXISTS val_sum; +SELECT ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='val_sum'; +ACTION_STATEMENT +DROP TRIGGER IF EXISTS val_sum; +Warnings: +Note 1360 Trigger does not exist +DROP TABLE t1; +DROP DATABASE db1; diff --git a/mysql-test/r/create_drop_udf.result b/mysql-test/r/create_drop_udf.result new file mode 100644 index 00000000000..40da0b62a3a --- /dev/null +++ b/mysql-test/r/create_drop_udf.result @@ -0,0 +1,38 @@ +CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; +SELECT ret FROM mysql.func WHERE name like 'metaphon'; +ret +0 +CREATE FUNCTION metaphon RETURNS INT SONAME "$UDF_EXAMPLE_SO"; +ERROR HY000: Function 'metaphon' already exists +SELECT ret FROM mysql.func WHERE name like 'metaphon'; +ret +0 +CREATE FUNCTION IF NOT EXISTS metaphon RETURNS REAL SONAME "UDF_EXAMPLE_LIB"; +Warnings: +Note 1125 Function 'metaphon' already exists +SELECT ret FROM mysql.func WHERE name like 'metaphon'; +ret +0 +DROP FUNCTION IF EXISTS metaphon; +CREATE FUNCTION IF NOT EXISTS metaphon RETURNS REAL SONAME "UDF_EXAMPLE_LIB"; +SELECT ret FROM mysql.func WHERE name like 'metaphon'; +ret +1 +CREATE OR REPLACE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; +ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS +SELECT ret FROM mysql.func WHERE name like 'metaphon'; +ret +1 +CREATE OR REPLACE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; +SELECT ret FROM mysql.func WHERE name like 'metaphon'; +ret +0 +CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; +ERROR HY000: Function 'metaphon' already exists +SELECT metaphon('mariadb'); +metaphon('mariadb') +MRTB +DROP FUNCTION metaphon; +DROP FUNCTION IF EXISTS metaphon; +Warnings: +Note 1305 FUNCTION test.metaphon does not exist diff --git a/mysql-test/r/create_drop_user.result b/mysql-test/r/create_drop_user.result new file mode 100644 index 00000000000..dd75d1c257a --- /dev/null +++ b/mysql-test/r/create_drop_user.result @@ -0,0 +1,43 @@ +CREATE USER IF NOT EXISTS u1@localhost IDENTIFIED BY 'pw1'; +SELECT password FROM mysql.user WHERE user='u1'; +password +*2B602296A79E0A8784ACC5C88D92E46588CCA3C3 +CREATE USER IF NOT EXISTS u1@localhost IDENTIFIED BY 'pw2'; +Warnings: +Note 1973 Can't create user 'u1'@'localhost'; it already exists +SELECT password FROM mysql.user WHERE user='u1'; +password +*2B602296A79E0A8784ACC5C88D92E46588CCA3C3 +CREATE OR REPLACE USER u1@localhost IDENTIFIED BY 'pw3'; +SELECT password FROM mysql.user WHERE user='u1'; +password +*77B4A70CEFD76DB9415F36D291E74C110D2738E0 +CREATE OR REPLACE USER IF NOT EXISTS u1@localhost IDENTIFIED BY 'pw4'; +ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS +SELECT password FROM mysql.user WHERE user='u1'; +password +*77B4A70CEFD76DB9415F36D291E74C110D2738E0 +DROP USER IF EXISTS u1@localhost; +DROP USER IF EXISTS u1@localhost; +Warnings: +Note 1974 Can't drop user 'u1'@'localhost'; it doesn't exist +DROP USER u1@localhost; +ERROR HY000: Operation DROP USER failed for 'u1'@'localhost' +CREATE OR REPLACE USER u1@localhost; +CREATE USER u1@localhost; +ERROR HY000: Operation CREATE USER failed for 'u1'@'localhost' +DROP USER u1@localhost; +CREATE USER u1; +CREATE USER u1, u2; +ERROR HY000: Operation CREATE USER failed for 'u1'@'%' +CREATE USER u2; +ERROR HY000: Operation CREATE USER failed for 'u2'@'%' +CREATE OR REPLACE USER u1 IDENTIFIED BY PASSWORD 'password', u2; +ERROR HY000: Password hash should be a 41-digit hexadecimal number +CREATE OR REPLACE USER u1 IDENTIFIED BY PASSWORD 'abcdefghijklmnop', u2; +DROP USER u1; +DROP USER IF EXISTS u1, u2; +Warnings: +Note 1974 Can't drop user 'u1'@'%'; it doesn't exist +DROP USER u2; +ERROR HY000: Operation DROP USER failed for 'u2'@'%' diff --git a/mysql-test/r/create_drop_view.result b/mysql-test/r/create_drop_view.result new file mode 100644 index 00000000000..a822c16ae3c --- /dev/null +++ b/mysql-test/r/create_drop_view.result @@ -0,0 +1,59 @@ +CREATE TABLE t1(id INT); +CREATE VIEW IF NOT EXISTS v1 AS SELECT * FROM t1 WHERE id>10; +INSERT INTO t1 VALUES (5), (8), (10), (20), (30); +SELECT * FROM t1; +id +5 +8 +10 +20 +30 +SELECT * FROM v1; +id +20 +30 +CREATE VIEW v1 AS SELECT * FROM t1 WHERE id>11; +ERROR 42S01: Table 'v1' already exists +SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1'; +VIEW_DEFINITION +select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`id` > 10) +CREATE VIEW IF NOT EXISTS v1 AS SELECT * FROM t1 WHERE id>12; +Warnings: +Note 1050 Table 'v1' already exists +SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1'; +VIEW_DEFINITION +select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`id` > 10) +CREATE OR REPLACE VIEW IF NOT EXISTS v1 AS SELECT * FROM t1 WHERE id>13; +ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS +SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1'; +VIEW_DEFINITION +select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`id` > 10) +CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1 WHERE id>14; +SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1'; +VIEW_DEFINITION +select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`id` > 14) +INSERT INTO t1 VALUES (50), (80), (3), (2), (40); +SELECT * FROM t1; +id +5 +8 +10 +20 +30 +50 +80 +3 +2 +40 +SELECT * FROM v1; +id +20 +30 +50 +80 +40 +DROP VIEW IF EXISTS v1; +DROP VIEW IF EXISTS v1; +Warnings: +Note 1051 Unknown table 'test.v1' +DROP TABLE t1; diff --git a/mysql-test/r/create_or_replace.result b/mysql-test/r/create_or_replace.result index ff8170b7309..ed25fbadf45 100644 --- a/mysql-test/r/create_or_replace.result +++ b/mysql-test/r/create_or_replace.result @@ -6,8 +6,6 @@ INSERT INTO t2 VALUES(1),(2),(3); # CREATE OR REPLACE TABLE IF NOT EXISTS t1 (a int); ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS -create or replace trigger trg before insert on t1 for each row set @a:=1; -ERROR HY000: Incorrect usage of OR REPLACE and TRIGGERS / SP / EVENT create or replace table mysql.general_log (a int); ERROR HY000: You cannot 'CREATE OR REPLACE' a log table if logging is enabled create or replace table mysql.slow_log (a int); @@ -103,7 +101,7 @@ CREATE OR REPLACE TABLE t1 AS SELECT 1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `1` int(1) NOT NULL DEFAULT '0' + `1` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; create table t1 (a int); @@ -144,7 +142,7 @@ CREATE OR REPLACE TABLE t1 AS SELECT 1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `1` int(1) NOT NULL DEFAULT '0' + `1` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE OR REPLACE TABLE t1 (a int); @@ -402,29 +400,29 @@ select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock # MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test # MDL_SHARED_READ MDL_EXPLICIT Table metadata lock test t2 +# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test create or replace table t1 (i int); select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock # MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test # MDL_SHARED_READ MDL_EXPLICIT Table metadata lock test t2 +# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test create or replace table t1 like t2; select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock # MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test # MDL_SHARED_READ MDL_EXPLICIT Table metadata lock test t2 +# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test create or replace table t1 select 1 as f1; select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Global read lock # MDL_SHARED_NO_READ_WRITE MDL_EXPLICIT Table metadata lock test t1 -# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test # MDL_SHARED_READ MDL_EXPLICIT Table metadata lock test t2 +# MDL_INTENTION_EXCLUSIVE MDL_EXPLICIT Schema metadata lock test drop table t1; unlock tables; # diff --git a/mysql-test/r/create_or_replace_permission.result b/mysql-test/r/create_or_replace_permission.result new file mode 100644 index 00000000000..f662bf1bfd8 --- /dev/null +++ b/mysql-test/r/create_or_replace_permission.result @@ -0,0 +1,53 @@ +set local sql_mode=""; +set global sql_mode=""; +# +# Tests for checking permission denied on CREATE OR REPLACE if DROP +# access is revoked +# +# These statements do not need special tests for CREATE OR REPLACE, +# because they do not have separate permissions for create and drop: +# CREATE OR REPLACE EVENT (uses EVENT_ACL for both CREATE and DROP) +# CREATE OR DROP SERVER (uses SUPER_ALC for both CREATE and DROP) +# CREATE OR DROP TRIGGER (uses TRIGGER_ACL for both CREATE and DROP) +SELECT CURRENT_USER; +CURRENT_USER +root@localhost +CREATE DATABASE db1; +GRANT ALL ON db1.* TO mysqltest_1@localhost; +REVOKE DROP ON db1.* FROM mysqltest_1@localhost; +REVOKE ALTER ROUTINE ON db1.* FROM mysqltest_1@localhost; +GRANT DELETE ON mysql.* TO mysqltest_1@localhost; +REVOKE DELETE ON mysql.* FROM mysqltest_1@localhost; +FLUSH PRIVILEGES; +SELECT CURRENT_USER; +CURRENT_USER +mysqltest_1@localhost +CREATE DATABASE db1; +ERROR HY000: Can't create database 'db1'; database exists +CREATE OR REPLACE DATABASE db1; +ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'db1' +CREATE OR REPLACE DATABASE db2; +ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'db2' +USE db1; +CREATE OR REPLACE TABLE t1(id INT); +ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1' +CREATE OR REPLACE PROCEDURE proc1 (OUT cnt INT) BEGIN END; +ERROR 42000: alter routine command denied to user 'mysqltest_1'@'localhost' for routine 'db1.proc1' +CREATE OR REPLACE FUNCTION lookup RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; +ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql' +CREATE OR REPLACE FUNCTION hello(str char(20)) RETURNS TEXT RETURN CONCAT('Hello, ', str, '!'); +ERROR 42000: alter routine command denied to user 'mysqltest_1'@'localhost' for routine 'db1.hello' +CREATE OR REPLACE USER u1@localhost; +ERROR 42000: Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation +CREATE OR REPLACE ROLE developer; +ERROR 42000: Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation +SELECT CURRENT_USER; +CURRENT_USER +root@localhost +REVOKE ALL ON db1.* FROM mysqltest_1@localhost; +DROP DATABASE IF EXISTS db2; +Warnings: +Note 1008 Can't drop database 'db2'; database doesn't exist +DROP DATABASE db1; +DROP USER mysqltest_1@localhost; +set global sql_mode=default; diff --git a/mysql-test/r/create_w_max_indexes_128.result b/mysql-test/r/create_w_max_indexes_128.result new file mode 100644 index 00000000000..d11ed47c2f4 --- /dev/null +++ b/mysql-test/r/create_w_max_indexes_128.result @@ -0,0 +1,1250 @@ +create table t1 ( +c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, c8 int, +c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int, +key a001_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a002_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a003_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a004_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a005_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a006_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a007_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a008_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a009_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a010_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a011_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a012_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a013_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a014_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a015_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a016_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a017_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a018_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a019_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a020_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a021_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a022_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a023_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a024_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a025_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a026_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a027_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a028_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a029_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a030_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a031_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a032_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a033_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a034_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a035_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a036_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a037_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a038_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a039_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a040_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a041_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a042_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a043_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a044_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a045_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a046_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a047_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a048_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a049_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a050_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a051_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a052_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a053_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a054_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a055_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a056_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a057_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a058_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a059_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a060_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a061_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a062_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a063_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a064_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a065_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a066_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a067_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a068_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a069_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a070_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a071_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a072_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a073_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a074_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a075_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a076_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a077_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a078_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a079_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a080_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a081_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a082_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a083_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a084_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a085_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a086_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a087_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a088_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a089_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a090_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a091_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a092_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a093_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a094_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a095_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a096_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a097_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a098_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a099_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a100_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a101_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a102_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a103_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a104_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a105_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a106_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a107_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a108_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a109_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a110_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a111_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a112_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a113_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a114_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a115_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a116_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a117_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a118_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a119_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a120_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a121_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a122_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a123_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a124_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a125_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a126_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a127_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a128_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16) +); +Warnings: +Note 1831 Duplicate index 'a002_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a003_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a004_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a005_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a006_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a007_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a008_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a009_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a010_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a011_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a012_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a013_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a014_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a015_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a016_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a017_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a018_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a019_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a020_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a021_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a022_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a023_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a024_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a025_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a026_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a027_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a028_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a029_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a030_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a031_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a032_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a033_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a034_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a035_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a036_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a037_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a038_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a039_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a040_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a041_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a042_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a043_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a044_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a045_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a046_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a047_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a048_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a049_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a050_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a051_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a052_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a053_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a054_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a055_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a056_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a057_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a058_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a059_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a060_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a061_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a062_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a063_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a064_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a065_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + `c4` int(11) DEFAULT NULL, + `c5` int(11) DEFAULT NULL, + `c6` int(11) DEFAULT NULL, + `c7` int(11) DEFAULT NULL, + `c8` int(11) DEFAULT NULL, + `c9` int(11) DEFAULT NULL, + `c10` int(11) DEFAULT NULL, + `c11` int(11) DEFAULT NULL, + `c12` int(11) DEFAULT NULL, + `c13` int(11) DEFAULT NULL, + `c14` int(11) DEFAULT NULL, + `c15` int(11) DEFAULT NULL, + `c16` int(11) DEFAULT NULL, + KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a065_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a066_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a067_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a068_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a069_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a070_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a071_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a072_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a073_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a074_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a075_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a076_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a077_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a078_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a079_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a080_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a081_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a082_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a083_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a084_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a085_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a086_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a087_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a088_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a089_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a090_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a091_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a092_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a093_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a094_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a095_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a096_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a097_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a098_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a099_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a100_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a101_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a102_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a103_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a104_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a105_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a106_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a107_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a108_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a109_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a110_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a111_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a112_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a113_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a114_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a115_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a116_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a117_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a118_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a119_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a120_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a121_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a122_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a123_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a124_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a125_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a126_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a127_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a128_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +flush tables; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + `c4` int(11) DEFAULT NULL, + `c5` int(11) DEFAULT NULL, + `c6` int(11) DEFAULT NULL, + `c7` int(11) DEFAULT NULL, + `c8` int(11) DEFAULT NULL, + `c9` int(11) DEFAULT NULL, + `c10` int(11) DEFAULT NULL, + `c11` int(11) DEFAULT NULL, + `c12` int(11) DEFAULT NULL, + `c13` int(11) DEFAULT NULL, + `c14` int(11) DEFAULT NULL, + `c15` int(11) DEFAULT NULL, + `c16` int(11) DEFAULT NULL, + KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a065_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a066_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a067_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a068_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a069_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a070_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a071_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a072_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a073_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a074_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a075_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a076_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a077_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a078_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a079_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a080_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a081_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a082_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a083_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a084_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a085_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a086_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a087_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a088_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a089_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a090_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a091_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a092_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a093_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a094_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a095_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a096_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a097_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a098_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a099_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a100_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a101_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a102_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a103_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a104_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a105_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a106_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a107_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a108_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a109_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a110_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a111_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a112_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a113_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a114_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a115_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a116_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a117_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a118_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a119_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a120_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a121_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a122_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a123_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a124_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a125_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a126_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a127_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a128_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, +c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int); +alter table t1 +add key a001_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a002_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a003_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a004_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a005_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a006_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a007_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a008_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a009_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a010_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a011_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a012_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a013_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a014_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a015_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a016_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a017_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a018_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a019_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a020_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a021_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a022_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a023_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a024_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a025_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a026_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a027_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a028_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a029_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a030_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a031_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a032_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a033_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a034_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a035_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a036_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a037_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a038_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a039_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a040_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a041_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a042_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a043_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a044_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a045_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a046_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a047_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a048_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a049_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a050_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a051_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a052_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a053_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a054_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a055_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a056_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a057_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a058_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a059_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a060_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a061_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a062_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a063_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a064_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a065_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a066_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a067_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a068_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a069_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a070_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a071_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a072_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a073_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a074_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a075_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a076_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a077_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a078_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a079_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a080_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a081_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a082_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a083_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a084_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a085_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a086_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a087_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a088_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a089_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a090_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a091_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a092_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a093_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a094_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a095_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a096_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a097_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a098_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a099_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a100_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a101_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a102_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a103_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a104_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a105_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a106_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a107_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a108_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a109_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a110_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a111_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a112_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a113_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a114_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a115_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a116_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a117_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a118_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a119_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a120_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a121_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a122_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a123_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a124_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a125_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a126_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a127_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a128_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16); +Warnings: +Note 1831 Duplicate index 'a002_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a003_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a004_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a005_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a006_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a007_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a008_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a009_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a010_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a011_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a012_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a013_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a014_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a015_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a016_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a017_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a018_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a019_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a020_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a021_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a022_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a023_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a024_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a025_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a026_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a027_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a028_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a029_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a030_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a031_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a032_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a033_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a034_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a035_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a036_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a037_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a038_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a039_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a040_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a041_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a042_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a043_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a044_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a045_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a046_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a047_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a048_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a049_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a050_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a051_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a052_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a053_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a054_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a055_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a056_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a057_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a058_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a059_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a060_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a061_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a062_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a063_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a064_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a065_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + `c4` int(11) DEFAULT NULL, + `c5` int(11) DEFAULT NULL, + `c6` int(11) DEFAULT NULL, + `c7` int(11) DEFAULT NULL, + `c8` int(11) DEFAULT NULL, + `c9` int(11) DEFAULT NULL, + `c10` int(11) DEFAULT NULL, + `c11` int(11) DEFAULT NULL, + `c12` int(11) DEFAULT NULL, + `c13` int(11) DEFAULT NULL, + `c14` int(11) DEFAULT NULL, + `c15` int(11) DEFAULT NULL, + `c16` int(11) DEFAULT NULL, + KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a065_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a066_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a067_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a068_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a069_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a070_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a071_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a072_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a073_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a074_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a075_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a076_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a077_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a078_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a079_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a080_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a081_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a082_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a083_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a084_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a085_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a086_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a087_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a088_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a089_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a090_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a091_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a092_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a093_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a094_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a095_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a096_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a097_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a098_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a099_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a100_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a101_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a102_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a103_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a104_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a105_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a106_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a107_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a108_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a109_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a110_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a111_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a112_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a113_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a114_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a115_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a116_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a117_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a118_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a119_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a120_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a121_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a122_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a123_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a124_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a125_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a126_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a127_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a128_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +flush tables; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + `c4` int(11) DEFAULT NULL, + `c5` int(11) DEFAULT NULL, + `c6` int(11) DEFAULT NULL, + `c7` int(11) DEFAULT NULL, + `c8` int(11) DEFAULT NULL, + `c9` int(11) DEFAULT NULL, + `c10` int(11) DEFAULT NULL, + `c11` int(11) DEFAULT NULL, + `c12` int(11) DEFAULT NULL, + `c13` int(11) DEFAULT NULL, + `c14` int(11) DEFAULT NULL, + `c15` int(11) DEFAULT NULL, + `c16` int(11) DEFAULT NULL, + KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a065_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a066_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a067_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a068_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a069_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a070_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a071_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a072_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a073_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a074_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a075_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a076_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a077_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a078_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a079_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a080_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a081_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a082_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a083_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a084_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a085_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a086_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a087_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a088_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a089_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a090_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a091_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a092_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a093_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a094_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a095_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a096_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a097_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a098_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a099_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a100_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a101_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a102_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a103_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a104_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a105_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a106_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a107_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a108_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a109_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a110_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a111_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a112_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a113_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a114_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a115_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a116_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a117_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a118_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a119_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a120_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a121_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a122_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a123_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a124_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a125_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a126_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a127_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a128_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +alter table t1 add key +a129_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16); +ERROR 42000: Too many keys specified; max 128 keys allowed +drop table t1; +"End of tests" diff --git a/mysql-test/r/create_w_max_indexes_64.result b/mysql-test/r/create_w_max_indexes_64.result new file mode 100644 index 00000000000..ada78af7fb9 --- /dev/null +++ b/mysql-test/r/create_w_max_indexes_64.result @@ -0,0 +1,783 @@ +create table t1 ( +c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, c8 int, +c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int, +key a001_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a002_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a003_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a004_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a005_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a006_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a007_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a008_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a009_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a010_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a011_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a012_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a013_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a014_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a015_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a016_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a017_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a018_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a019_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a020_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a021_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a022_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a023_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a024_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a025_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a026_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a027_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a028_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a029_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a030_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a031_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a032_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a033_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a034_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a035_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a036_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a037_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a038_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a039_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a040_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a041_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a042_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a043_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a044_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a045_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a046_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a047_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a048_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a049_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a050_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a051_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a052_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a053_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a054_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a055_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a056_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a057_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a058_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a059_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a060_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a061_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a062_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a063_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a064_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16) +); +Warnings: +Note 1831 Duplicate index 'a002_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a003_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a004_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a005_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a006_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a007_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a008_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a009_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a010_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a011_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a012_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a013_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a014_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a015_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a016_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a017_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a018_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a019_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a020_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a021_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a022_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a023_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a024_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a025_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a026_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a027_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a028_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a029_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a030_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a031_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a032_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a033_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a034_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a035_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a036_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a037_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a038_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a039_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a040_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a041_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a042_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a043_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a044_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a045_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a046_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a047_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a048_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a049_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a050_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a051_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a052_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a053_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a054_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a055_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a056_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a057_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a058_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a059_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a060_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a061_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a062_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a063_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a064_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + `c4` int(11) DEFAULT NULL, + `c5` int(11) DEFAULT NULL, + `c6` int(11) DEFAULT NULL, + `c7` int(11) DEFAULT NULL, + `c8` int(11) DEFAULT NULL, + `c9` int(11) DEFAULT NULL, + `c10` int(11) DEFAULT NULL, + `c11` int(11) DEFAULT NULL, + `c12` int(11) DEFAULT NULL, + `c13` int(11) DEFAULT NULL, + `c14` int(11) DEFAULT NULL, + `c15` int(11) DEFAULT NULL, + `c16` int(11) DEFAULT NULL, + KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +flush tables; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + `c4` int(11) DEFAULT NULL, + `c5` int(11) DEFAULT NULL, + `c6` int(11) DEFAULT NULL, + `c7` int(11) DEFAULT NULL, + `c8` int(11) DEFAULT NULL, + `c9` int(11) DEFAULT NULL, + `c10` int(11) DEFAULT NULL, + `c11` int(11) DEFAULT NULL, + `c12` int(11) DEFAULT NULL, + `c13` int(11) DEFAULT NULL, + `c14` int(11) DEFAULT NULL, + `c15` int(11) DEFAULT NULL, + `c16` int(11) DEFAULT NULL, + KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, +c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int); +alter table t1 +add key a001_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a002_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a003_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a004_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a005_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a006_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a007_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a008_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a009_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a010_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a011_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a012_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a013_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a014_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a015_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a016_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a017_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a018_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a019_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a020_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a021_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a022_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a023_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a024_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a025_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a026_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a027_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a028_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a029_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a030_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a031_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a032_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a033_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a034_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a035_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a036_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a037_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a038_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a039_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a040_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a041_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a042_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a043_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a044_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a045_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a046_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a047_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a048_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a049_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a050_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a051_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a052_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a053_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a054_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a055_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a056_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a057_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a058_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a059_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a060_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a061_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a062_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a063_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a064_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16); +Warnings: +Note 1831 Duplicate index 'a002_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a003_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a004_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a005_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a006_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a007_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a008_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a009_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a010_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a011_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a012_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a013_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a014_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a015_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a016_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a017_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a018_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a019_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a020_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a021_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a022_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a023_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a024_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a025_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a026_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a027_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a028_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a029_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a030_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a031_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a032_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a033_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a034_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a035_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a036_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a037_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a038_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a039_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a040_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a041_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a042_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a043_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a044_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a045_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a046_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a047_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a048_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a049_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a050_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a051_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a052_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a053_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a054_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a055_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a056_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a057_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a058_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a059_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a060_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a061_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a062_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a063_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +Note 1831 Duplicate index 'a064_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + `c4` int(11) DEFAULT NULL, + `c5` int(11) DEFAULT NULL, + `c6` int(11) DEFAULT NULL, + `c7` int(11) DEFAULT NULL, + `c8` int(11) DEFAULT NULL, + `c9` int(11) DEFAULT NULL, + `c10` int(11) DEFAULT NULL, + `c11` int(11) DEFAULT NULL, + `c12` int(11) DEFAULT NULL, + `c13` int(11) DEFAULT NULL, + `c14` int(11) DEFAULT NULL, + `c15` int(11) DEFAULT NULL, + `c16` int(11) DEFAULT NULL, + KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +flush tables; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + `c4` int(11) DEFAULT NULL, + `c5` int(11) DEFAULT NULL, + `c6` int(11) DEFAULT NULL, + `c7` int(11) DEFAULT NULL, + `c8` int(11) DEFAULT NULL, + `c9` int(11) DEFAULT NULL, + `c10` int(11) DEFAULT NULL, + `c11` int(11) DEFAULT NULL, + `c12` int(11) DEFAULT NULL, + `c13` int(11) DEFAULT NULL, + `c14` int(11) DEFAULT NULL, + `c15` int(11) DEFAULT NULL, + `c16` int(11) DEFAULT NULL, + KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +alter table t1 add key +a065_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16); +ERROR 42000: Too many keys specified; max 64 keys allowed +drop table t1; +create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, +c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, +c16 int, c17 int, c18 int,c19 int,c20 int,c21 int,c22 int,c23 int,c24 int,c25 int,c26 int,c27 int,c28 int,c29 int,c30 int,c31 int,c32 int, c33 int); +alter table t1 add key i1 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16, c17,c18,c19,c20,c21,c22,c23,c24,c25,c26,c27,c28,c29,c30,c31,c32,c33); +ERROR 42000: Too many key parts specified; max 32 parts allowed +alter table t1 add key +a001_long_123456789_123456789_123456789_123456789_123456789_12345 (c1); +ERROR 42000: Identifier name 'a001_long_123456789_123456789_123456789_123456789_123456789_12345' is too long +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + `c4` int(11) DEFAULT NULL, + `c5` int(11) DEFAULT NULL, + `c6` int(11) DEFAULT NULL, + `c7` int(11) DEFAULT NULL, + `c8` int(11) DEFAULT NULL, + `c9` int(11) DEFAULT NULL, + `c10` int(11) DEFAULT NULL, + `c11` int(11) DEFAULT NULL, + `c12` int(11) DEFAULT NULL, + `c13` int(11) DEFAULT NULL, + `c14` int(11) DEFAULT NULL, + `c15` int(11) DEFAULT NULL, + `c16` int(11) DEFAULT NULL, + `c17` int(11) DEFAULT NULL, + `c18` int(11) DEFAULT NULL, + `c19` int(11) DEFAULT NULL, + `c20` int(11) DEFAULT NULL, + `c21` int(11) DEFAULT NULL, + `c22` int(11) DEFAULT NULL, + `c23` int(11) DEFAULT NULL, + `c24` int(11) DEFAULT NULL, + `c25` int(11) DEFAULT NULL, + `c26` int(11) DEFAULT NULL, + `c27` int(11) DEFAULT NULL, + `c28` int(11) DEFAULT NULL, + `c29` int(11) DEFAULT NULL, + `c30` int(11) DEFAULT NULL, + `c31` int(11) DEFAULT NULL, + `c32` int(11) DEFAULT NULL, + `c33` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +"End of tests" diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result index 175bbf0f09f..f97d060d26a 100644 --- a/mysql-test/r/ctype_big5.result +++ b/mysql-test/r/ctype_big5.result @@ -224,9 +224,21 @@ CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value SELECT hex(concat(repeat(0xF1F2, 10), '%')); hex(concat(repeat(0xF1F2, 10), '%')) F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 @@ -439,9 +451,21 @@ CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value SELECT hex(concat(repeat(0xF1F2, 10), '%')); hex(concat(repeat(0xF1F2, 10), '%')) F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 @@ -487,6 +511,8 @@ drop table t1; select hex(convert(_big5 0xC84041 using ucs2)); hex(convert(_big5 0xC84041 using ucs2)) 003F0041 +Warnings: +Warning 1977 Cannot convert 'big5' character 0xC840 to 'ucs2' End of 4.1 tests set names big5; create table t1 (a blob); @@ -526,7 +552,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `code` varchar(8) DEFAULT NULL, - `a` varchar(1) CHARACTER SET big5 NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET big5 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT COUNT(*) FROM t1; COUNT(*) @@ -597,7 +623,7 @@ Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61 Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62 Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63 Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 -SELECT COUNT(*) FROM t1 WHERE a<>''; +SELECT COUNT(*) FROM t1 WHERE a<>'?'; COUNT(*) 13973 SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)); @@ -762,6 +788,71 @@ A2BF â…¦ A2C0 â…§ A2C1 â…¨ A2C2 â…© +Warnings: +Warning 1977 Cannot convert 'big5' character 0xA3C0 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C0 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C1 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C1 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C2 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C2 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C3 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C3 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C4 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C4 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C5 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C5 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C6 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C6 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C7 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C7 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C8 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C8 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C9 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C9 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CA to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CA to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CB to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CB to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CC to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CC to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CD to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CD to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CE to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CE to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CF to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CF to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D0 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D0 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D1 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D1 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D2 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D2 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D3 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D3 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D4 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D4 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D5 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D5 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D6 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D6 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D7 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D7 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D8 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D8 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D9 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D9 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DA to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DA to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DB to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DB to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DC to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DC to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DD to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DD to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DE to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DE to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DF to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DF to 'utf8' SELECT * FROM t1 WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; @@ -776,6 +867,71 @@ C7D8 п C7D9 Ñ€ C7DA Ñ C7DB Ñ‚ +Warnings: +Warning 1977 Cannot convert 'big5' character 0xA3C0 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C0 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C1 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C1 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C2 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C2 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C3 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C3 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C4 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C4 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C5 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C5 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C6 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C6 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C7 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C7 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C8 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C8 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C9 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3C9 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CA to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CA to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CB to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CB to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CC to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CC to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CD to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CD to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CE to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CE to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CF to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3CF to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D0 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D0 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D1 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D1 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D2 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D2 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D3 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D3 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D4 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D4 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D5 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D5 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D6 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D6 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D7 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D7 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D8 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D8 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D9 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3D9 to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DA to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DA to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DB to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DB to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DC to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DC to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DD to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DD to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DE to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DE to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DF to 'utf8' +Warning 1977 Cannot convert 'big5' character 0xA3DF to 'utf8' DROP TABLE t1; # # End of 5.5 tests @@ -794,7 +950,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET big5 NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET big5 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -814,7 +970,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET big5 NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET big5 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -1053,7 +1209,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET big5 COLLATE big5_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET big5 COLLATE big5_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -1073,7 +1229,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET big5 COLLATE big5_bin NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET big5 COLLATE big5_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -4416,7 +4572,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ',10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET big5 NOT NULL DEFAULT '' + `a` varchar(10) CHARACTER SET big5 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('à\'),('à\t'); INSERT INTO t1 VALUES ('\\à\'),('\\à\t'),('\\à\t\t'); @@ -4455,7 +4611,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET big5 NOT NULL DEFAULT '' + `a` varchar(10) CHARACTER SET big5 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (BINARY('à\')),(BINARY('à\t')); INSERT INTO t1 VALUES (BINARY('\\à\')),(BINARY('\\à\t')),(BINARY('\\à\t\t')); @@ -4494,7 +4650,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET big5 NOT NULL DEFAULT '' + `a` varchar(10) CHARACTER SET big5 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (_BINARY'à\'),(_BINARY'à\t'); INSERT INTO t1 VALUES (_BINARY'\\à\'),(_BINARY'\\à\t'),(_BINARY'\\à\t\t'); @@ -4540,7 +4696,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET big5 NOT NULL DEFAULT '' + `a` varchar(10) CHARACTER SET big5 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('à\['),('\à\['); SELECT HEX(a) FROM t1; @@ -4560,7 +4716,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varbinary(10) NOT NULL DEFAULT '' + `a` varbinary(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('à\['),('\à\['); SELECT HEX(a) FROM t1; diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result index 48b481883ca..512368a2d26 100644 --- a/mysql-test/r/ctype_binary.result +++ b/mysql-test/r/ctype_binary.result @@ -13,7 +13,7 @@ create table t1 as select concat(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select hex(c1) from t1; hex(c1) @@ -26,7 +26,7 @@ create table t1 as select concat(18446744073709551615) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(20) NOT NULL DEFAULT '' + `c1` varbinary(20) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select hex(c1) from t1; hex(c1) @@ -39,7 +39,7 @@ create table t1 as select concat(1.1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(4) NOT NULL DEFAULT '' + `c1` varbinary(4) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select hex(c1) from t1; hex(c1) @@ -52,7 +52,7 @@ create table t1 as select concat(1+2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(3) NOT NULL DEFAULT '' + `c1` varbinary(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1-2)); @@ -62,7 +62,7 @@ create table t1 as select concat(1-2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(3) NOT NULL DEFAULT '' + `c1` varbinary(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1*2)); @@ -72,7 +72,7 @@ create table t1 as select concat(1*2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(3) NOT NULL DEFAULT '' + `c1` varbinary(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1/2)); @@ -112,7 +112,7 @@ create table t1 as select concat(-1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(2) NOT NULL DEFAULT '' + `c1` varbinary(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(-(1+2))); @@ -122,7 +122,7 @@ create table t1 as select concat(-(1+2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(4) NOT NULL DEFAULT '' + `c1` varbinary(4) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1|2)); @@ -132,7 +132,7 @@ create table t1 as select concat(1|2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(21) NOT NULL DEFAULT '' + `c1` varbinary(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1&2)); @@ -142,7 +142,7 @@ create table t1 as select concat(1&2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(21) NOT NULL DEFAULT '' + `c1` varbinary(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(bit_count(12))); @@ -152,7 +152,7 @@ create table t1 as select concat(bit_count(12)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(2) NOT NULL DEFAULT '' + `c1` varbinary(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(2<<1)); @@ -162,7 +162,7 @@ create table t1 as select concat(2<<1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(21) NOT NULL DEFAULT '' + `c1` varbinary(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(2>>1)); @@ -172,7 +172,7 @@ create table t1 as select concat(2>>1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(21) NOT NULL DEFAULT '' + `c1` varbinary(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(~0)); @@ -182,7 +182,7 @@ create table t1 as select concat(~0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(21) NOT NULL DEFAULT '' + `c1` varbinary(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(3^2)); @@ -192,7 +192,7 @@ create table t1 as select concat(3^2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(21) NOT NULL DEFAULT '' + `c1` varbinary(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(abs(-2))); @@ -202,7 +202,7 @@ create table t1 as select concat(abs(-2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(2) NOT NULL DEFAULT '' + `c1` varbinary(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(left(concat(exp(2)),1)); @@ -332,7 +332,7 @@ create table t1 as select concat(degrees(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(23) NOT NULL DEFAULT '' + `c1` varbinary(23) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(radians(0))); @@ -342,7 +342,7 @@ create table t1 as select concat(radians(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(23) NOT NULL DEFAULT '' + `c1` varbinary(23) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ceiling(0.5))); @@ -352,7 +352,7 @@ create table t1 as select concat(ceiling(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(4) NOT NULL DEFAULT '' + `c1` varbinary(4) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(floor(0.5))); @@ -362,7 +362,7 @@ create table t1 as select concat(floor(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(4) NOT NULL DEFAULT '' + `c1` varbinary(4) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(round(0.5))); @@ -372,7 +372,7 @@ create table t1 as select concat(round(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(3) NOT NULL DEFAULT '' + `c1` varbinary(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(sign(0.5))); @@ -382,14 +382,14 @@ create table t1 as select concat(sign(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(21) NOT NULL DEFAULT '' + `c1` varbinary(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(rand()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(23) NOT NULL DEFAULT '' + `c1` varbinary(23) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(length('a'))); @@ -399,7 +399,7 @@ create table t1 as select concat(length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(10) NOT NULL DEFAULT '' + `c1` varbinary(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(char_length('a'))); @@ -409,7 +409,7 @@ create table t1 as select concat(char_length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(10) NOT NULL DEFAULT '' + `c1` varbinary(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(bit_length('a'))); @@ -419,7 +419,7 @@ create table t1 as select concat(bit_length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(10) NOT NULL DEFAULT '' + `c1` varbinary(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(coercibility('a'))); @@ -429,7 +429,7 @@ create table t1 as select concat(coercibility('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(10) NOT NULL DEFAULT '' + `c1` varbinary(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(locate('a','a'))); @@ -439,7 +439,7 @@ create table t1 as select concat(locate('a','a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(11) NOT NULL DEFAULT '' + `c1` varbinary(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(field('c','a','b','c'))); @@ -449,7 +449,7 @@ create table t1 as select concat(field('c','a','b','c')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(3) NOT NULL DEFAULT '' + `c1` varbinary(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ascii(61))); @@ -459,7 +459,7 @@ create table t1 as select concat(ascii(61)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(3) NOT NULL DEFAULT '' + `c1` varbinary(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ord(61))); @@ -469,7 +469,7 @@ create table t1 as select concat(ord(61)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(21) NOT NULL DEFAULT '' + `c1` varbinary(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(find_in_set('b','a,b,c,d'))); @@ -479,7 +479,7 @@ create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(3) NOT NULL DEFAULT '' + `c1` varbinary(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select md5('a'), hex(md5('a')); @@ -489,7 +489,7 @@ create table t1 as select md5('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(32) NOT NULL DEFAULT '' + `c1` varbinary(32) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select old_password('a'), hex(old_password('a')); @@ -499,7 +499,7 @@ create table t1 as select old_password('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(16) NOT NULL DEFAULT '' + `c1` varbinary(16) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select password('a'), hex(password('a')); @@ -509,7 +509,7 @@ create table t1 as select password('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(41) NOT NULL DEFAULT '' + `c1` varbinary(41) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select sha('a'), hex(sha('a')); @@ -519,7 +519,7 @@ create table t1 as select sha('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(40) NOT NULL DEFAULT '' + `c1` varbinary(40) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select sha1('a'), hex(sha1('a')); @@ -529,7 +529,7 @@ create table t1 as select sha1('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(40) NOT NULL DEFAULT '' + `c1` varbinary(40) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(cast('-1' as signed))); @@ -539,7 +539,7 @@ create table t1 as select concat(cast('-1' as signed)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(2) NOT NULL DEFAULT '' + `c1` varbinary(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(cast('1' as unsigned))); @@ -549,7 +549,7 @@ create table t1 as select concat(cast('1' as unsigned)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(cast(1/2 as decimal(5,5)))); @@ -608,7 +608,7 @@ create table t1 as select concat(least(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(2) NOT NULL DEFAULT '' + `c1` varbinary(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(greatest(1,2))); @@ -618,7 +618,7 @@ create table t1 as select concat(greatest(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(2) NOT NULL DEFAULT '' + `c1` varbinary(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(case when 11 then 22 else 33 end)); @@ -628,7 +628,7 @@ create table t1 as select concat(case when 11 then 22 else 33 end) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(2) NOT NULL DEFAULT '' + `c1` varbinary(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(coalesce(1,2))); @@ -638,7 +638,7 @@ create table t1 as select concat(coalesce(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat_ws(1,2,3)); @@ -648,7 +648,7 @@ create table t1 as select concat_ws(1,2,3) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(3) NOT NULL DEFAULT '' + `c1` varbinary(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(group_concat(1,2,3)); @@ -676,7 +676,7 @@ create table t1 as select concat(last_insert_id()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(21) NOT NULL DEFAULT '' + `c1` varbinary(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(benchmark(0,0))); @@ -686,7 +686,7 @@ create table t1 as select concat(benchmark(0,0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(sleep(0))); @@ -696,7 +696,7 @@ create table t1 as select concat(sleep(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(21) NOT NULL DEFAULT '' + `c1` varbinary(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(is_free_lock('xxxx'))); @@ -730,7 +730,7 @@ create table t1 as select concat(crc32('')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(10) NOT NULL DEFAULT '' + `c1` varbinary(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(uncompressed_length(''))); @@ -747,7 +747,7 @@ create table t1 as select concat(connection_id()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(10) NOT NULL DEFAULT '' + `c1` varbinary(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(inet_aton('127.1.1.1'))); @@ -783,7 +783,7 @@ create table t1 as select concat(row_count()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(21) NOT NULL DEFAULT '' + `c1` varbinary(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(found_rows())); @@ -793,21 +793,21 @@ create table t1 as select concat(found_rows()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(21) NOT NULL DEFAULT '' + `c1` varbinary(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(uuid_short()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(21) NOT NULL DEFAULT '' + `c1` varbinary(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(uuid()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(36) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select coercibility(uuid()), coercibility(cast('a' as char character set latin1)); @@ -820,7 +820,7 @@ create table t1 as select concat(uuid(), cast('a' as char character set latin1)) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(37) NOT NULL DEFAULT '' + `c1` varchar(37) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1; @@ -840,8 +840,8 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '', - `c2` int(1) NOT NULL DEFAULT '0' + `c1` varbinary(1) NOT NULL, + `c2` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; set @a2=1; @@ -898,8 +898,8 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(4) NOT NULL DEFAULT '', - `c2` decimal(2,1) NOT NULL DEFAULT '0.0' + `c1` varbinary(4) NOT NULL, + `c2` decimal(2,1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; set @a2=1.1; @@ -937,7 +937,7 @@ create table t1 as select concat('a'='a' IS TRUE) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a'='a' IS NOT TRUE)); @@ -947,7 +947,7 @@ create table t1 as select concat('a'='a' IS NOT TRUE) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(NOT 'a'='a')); @@ -957,7 +957,7 @@ create table t1 as select concat(NOT 'a'='a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' IS NULL)); @@ -967,7 +967,7 @@ create table t1 as select concat('a' IS NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' IS NOT NULL)); @@ -977,7 +977,7 @@ create table t1 as select concat('a' IS NOT NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' rlike 'a')); @@ -987,7 +987,7 @@ create table t1 as select concat('a' IS NOT NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(strcmp('a','b'))); @@ -997,7 +997,7 @@ create table t1 as select concat(strcmp('a','b')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(2) NOT NULL DEFAULT '' + `c1` varbinary(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' like 'a')); @@ -1007,7 +1007,7 @@ create table t1 as select concat('a' like 'b') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' between 'b' and 'c')); @@ -1017,7 +1017,7 @@ create table t1 as select concat('a' between 'b' and 'c') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' in ('a','b'))); @@ -1027,7 +1027,7 @@ create table t1 as select concat('a' in ('a','b')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(interval(23, 1, 15, 17, 30, 44, 200))); @@ -1037,7 +1037,7 @@ create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(2) NOT NULL DEFAULT '' + `c1` varbinary(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a varchar(10), fulltext key(a)); @@ -1059,7 +1059,7 @@ create table t1 as select ifnull(1,'a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ifnull(1,1))); @@ -1069,7 +1069,7 @@ create table t1 as select concat(ifnull(1,1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ifnull(1.1,1.1))); @@ -1079,7 +1079,7 @@ create table t1 as select concat(ifnull(1.1,1.1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(4) NOT NULL DEFAULT '' + `c1` varbinary(4) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(if(1,'b',1)); @@ -1089,7 +1089,7 @@ create table t1 as select if(1,'b',1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(if(1,1,'b')); @@ -1099,7 +1099,7 @@ create table t1 as select if(1,1,'b') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(if(1,1,1))); @@ -1109,7 +1109,7 @@ create table t1 as select concat(if(1,1,1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(nullif(1,2))); @@ -1189,7 +1189,7 @@ create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(21) DEFAULT NULL + `c1` varbinary(2) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); @@ -1199,7 +1199,7 @@ create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(21) DEFAULT NULL + `c1` varbinary(2) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); @@ -1274,7 +1274,7 @@ create table t1 as select concat(period_add(200902, 2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(6) NOT NULL DEFAULT '' + `c1` varbinary(6) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(period_diff(200902, 200802))); @@ -1286,7 +1286,7 @@ Warning 1265 Data truncated for column 'c1' at row 1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(6) NOT NULL DEFAULT '' + `c1` varbinary(6) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(to_days(20090224))); @@ -1483,21 +1483,21 @@ create table t1 as select concat(curdate()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(10) NOT NULL DEFAULT '' + `c1` varbinary(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(utc_date()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(10) NOT NULL DEFAULT '' + `c1` varbinary(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(curtime()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(10) NOT NULL DEFAULT '' + `c1` varbinary(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select repeat('a',20) as c1 limit 0; @@ -1513,7 +1513,7 @@ create table t1 as select concat(utc_time()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(10) NOT NULL DEFAULT '' + `c1` varbinary(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(sec_to_time(2378))); @@ -1606,21 +1606,21 @@ create table t1 as select concat(now()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(19) NOT NULL DEFAULT '' + `c1` varbinary(19) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(utc_timestamp()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(19) NOT NULL DEFAULT '' + `c1` varbinary(19) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(sysdate()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(19) NOT NULL DEFAULT '' + `c1` varbinary(19) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(addtime('00:00:00','11:22:33'))); @@ -1660,7 +1660,7 @@ create table t1 as select export_set(1,2,3,4,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(127) NOT NULL DEFAULT '' + `c1` varbinary(127) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(insert(1133,3,0,22)); @@ -1670,7 +1670,7 @@ create table t1 as select insert(1133,3,0,22) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(6) NOT NULL DEFAULT '' + `c1` varbinary(6) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(lcase(123)); @@ -1680,7 +1680,7 @@ create table t1 as select lcase(123) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(3) NOT NULL DEFAULT '' + `c1` varbinary(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(left(123,1)); @@ -1690,7 +1690,7 @@ create table t1 as select left(123,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(lower(123)); @@ -1700,7 +1700,7 @@ create table t1 as select lower(123) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(3) NOT NULL DEFAULT '' + `c1` varbinary(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(lpad(1,2,0)); @@ -1710,7 +1710,7 @@ create table t1 as select lpad(1,2,0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(2) NOT NULL DEFAULT '' + `c1` varbinary(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(ltrim(1)); @@ -1720,7 +1720,7 @@ create table t1 as select ltrim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(mid(1,1,1)); @@ -1730,7 +1730,7 @@ create table t1 as select mid(1,1,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(repeat(1,2)); @@ -1740,7 +1740,7 @@ create table t1 as select repeat(1,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(2) NOT NULL DEFAULT '' + `c1` varbinary(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(replace(1,1,2)); @@ -1750,7 +1750,7 @@ create table t1 as select replace(1,1,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(reverse(12)); @@ -1760,7 +1760,7 @@ create table t1 as select reverse(12) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(2) NOT NULL DEFAULT '' + `c1` varbinary(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(right(123,1)); @@ -1770,7 +1770,7 @@ create table t1 as select right(123,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(rpad(1,2,0)); @@ -1780,7 +1780,7 @@ create table t1 as select rpad(1,2,0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(2) NOT NULL DEFAULT '' + `c1` varbinary(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(rtrim(1)); @@ -1790,7 +1790,7 @@ create table t1 as select rtrim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(soundex(1)); @@ -1800,7 +1800,7 @@ create table t1 as select soundex(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(4) NOT NULL DEFAULT '' + `c1` varbinary(4) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(substring(1,1,1)); @@ -1810,7 +1810,7 @@ create table t1 as select substring(1,1,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(trim(1)); @@ -1820,7 +1820,7 @@ create table t1 as select trim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(ucase(1)); @@ -1830,7 +1830,7 @@ create table t1 as select ucase(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(upper(1)); @@ -1840,14 +1840,14 @@ create table t1 as select upper(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) NOT NULL DEFAULT '' + `c1` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select repeat(' ', 64) as a limit 0; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varbinary(64) NOT NULL DEFAULT '' + `a` varbinary(64) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ("1.1"), ("2.1"); select a, hex(a) from t1; @@ -2076,7 +2076,7 @@ t2 CREATE TABLE `t2` ( `concat(a)` varbinary(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1, t2; -create table t1 (a timestamp); +create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values (0); insert into t1 values (20010203040506); insert into t1 values (19800203040506); @@ -2097,7 +2097,7 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varbinary(19) NOT NULL DEFAULT '' + `concat(a)` varbinary(19) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1, t2; create table t1 (a date); @@ -2388,7 +2388,7 @@ hex(a) 0000000000000001 drop table t1; drop view v1; -create table t1 (a timestamp); +create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values (0); insert into t1 values (20010203040506); insert into t1 values (19800203040506); @@ -2637,7 +2637,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `CONCAT(a)` varbinary(9) DEFAULT NULL, - `IFNULL(a,'')` varbinary(9) NOT NULL DEFAULT '', + `IFNULL(a,'')` varbinary(9) NOT NULL, `IF(a,a,'')` varbinary(9) DEFAULT NULL, `CASE WHEN a THEN a ELSE '' END` varbinary(9) DEFAULT NULL, `COALESCE(a,'')` varbinary(9) DEFAULT NULL @@ -2647,14 +2647,14 @@ CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `CONCAT_WS(1,2,3)` varbinary(3) NOT NULL DEFAULT '' + `CONCAT_WS(1,2,3)` varbinary(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `INSERT(1133,3,0,22)` varbinary(6) NOT NULL DEFAULT '' + `INSERT(1133,3,0,22)` varbinary(6) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT LCASE(a) FROM t1; @@ -2675,35 +2675,35 @@ CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `REPEAT(1,2)` varbinary(2) NOT NULL DEFAULT '' + `REPEAT(1,2)` varbinary(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `LEFT(123,2)` varbinary(2) NOT NULL DEFAULT '' + `LEFT(123,2)` varbinary(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `RIGHT(123,2)` varbinary(2) NOT NULL DEFAULT '' + `RIGHT(123,2)` varbinary(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `LTRIM(123)` varbinary(3) NOT NULL DEFAULT '' + `LTRIM(123)` varbinary(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `RTRIM(123)` varbinary(3) NOT NULL DEFAULT '' + `RTRIM(123)` varbinary(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1; @@ -2717,35 +2717,35 @@ CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `REPLACE(111,2,3)` varbinary(3) NOT NULL DEFAULT '' + `REPLACE(111,2,3)` varbinary(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `SUBSTRING_INDEX(111,111,1)` varbinary(3) NOT NULL DEFAULT '' + `SUBSTRING_INDEX(111,111,1)` varbinary(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `MAKE_SET(111,222,3)` varbinary(5) NOT NULL DEFAULT '' + `MAKE_SET(111,222,3)` varbinary(5) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `SOUNDEX(1)` varbinary(4) NOT NULL DEFAULT '' + `SOUNDEX(1)` varbinary(4) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8); SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `EXPORT_SET(1,'Y','N','',8)` varbinary(64) NOT NULL DEFAULT '' + `EXPORT_SET(1,'Y','N','',8)` varbinary(64) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; DROP TABLE t1; @@ -2769,7 +2769,7 @@ id select_type table type possible_keys key key_len ref rows Extra ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL; EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range date_column date_column 9 NULL 1 Using index condition +1 SIMPLE t1 range date_column date_column 6 NULL 1 Using index condition DROP TABLE t1; # # Bug #31384 DATE_ADD() and DATE_SUB() return binary data @@ -2909,7 +2909,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `d` date DEFAULT NULL, - `bad` varbinary(10) DEFAULT NULL + `bad` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1, t2; SET NAMES latin1; @@ -2935,7 +2935,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(10) NOT NULL DEFAULT '' + `c1` varbinary(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; @@ -2956,7 +2956,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(10) NOT NULL DEFAULT '' + `c1` varbinary(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); @@ -2977,7 +2977,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(10) NOT NULL DEFAULT '' + `c1` varbinary(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); @@ -2998,7 +2998,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(10) NOT NULL DEFAULT '' + `c1` varbinary(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); @@ -3017,6 +3017,31 @@ Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ('%' = concat(`test`.`t1`.`c1`)) DROP TABLE t1; # +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varbinary(10) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 1 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 1 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where (`test`.`t1`.`a` = 'a') +DROP TABLE t1; +# +# End of MDEV-8694 +# +# # MDEV-7629 Regression: Bit and hex string literals changed column names in 10.0.14 # SELECT _binary 0x7E, _binary X'7E', _binary B'01111110'; @@ -3025,3 +3050,103 @@ _binary 0x7E _binary X'7E' _binary B'01111110' # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-8695 Wrong result for SELECT..WHERE varchar_column='a' AND CRC32(varchar_column)=3904355907 +# +CREATE TABLE t1 (a VARBINARY(10)); +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE CRC32(a)=3904355907; +a LENGTH(a) CRC32(a) +a 1 3904355907 +SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=3904355907; +a LENGTH(a) CRC32(a) +a 1 3904355907 +# Okey to propagate 'a' into CRC32(a) +EXPLAIN EXTENDED SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=3904355907; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)`,crc32(`test`.`t1`.`a`) AS `CRC32(a)` from `test`.`t1` where (`test`.`t1`.`a` = 'a') +SELECT a, HEX(a) FROM t1 WHERE HEX(a)='61'; +a HEX(a) +a 61 +SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61'; +a HEX(a) +a 61 +# Okey to propagate 'a' into HEX(a) +EXPLAIN EXTENDED SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,hex(`test`.`t1`.`a`) AS `HEX(a)` from `test`.`t1` where (`test`.`t1`.`a` = 'a') +SELECT * FROM t1 WHERE a='a'; +a +a +SELECT * FROM t1 WHERE LENGTH(a)=2; +a +a +SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2; +a +# Okey to propagate 'a' into LENGTH(a) +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 +SELECT * FROM t1 WHERE a='a '; +a +a +SELECT * FROM t1 WHERE a='a ' AND LENGTH(a)=2; +a +a +# Okey to propagate 'a ' into LENGTH(a) +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a ' AND LENGTH(a)=2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a ') +DROP TABLE t1; +# +# MDEV-8723 Wrong result for SELECT..WHERE COLLATION(a)='binary' AND a='a' +# +CREATE TABLE t1 (a VARBINARY(10)); +INSERT INTO t1 VALUES ('a'),('A'); +SELECT * FROM t1 WHERE COLLATION(a)='binary' AND a='a'; +a +a +SELECT * FROM t1 WHERE CHARSET(a)='binary' AND a='a'; +a +a +SELECT * FROM t1 WHERE COERCIBILITY(a)=2 AND a='a'; +a +a +SELECT * FROM t1 WHERE WEIGHT_STRING(a)='a' AND a='a'; +a +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE COLLATION(a)='binary' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a') +EXPLAIN EXTENDED SELECT * FROM t1 WHERE CHARSET(a)='binary' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a') +EXPLAIN EXTENDED SELECT * FROM t1 WHERE COERCIBILITY(a)=2 AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a') +EXPLAIN EXTENDED SELECT * FROM t1 WHERE WEIGHT_STRING(a)='a' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (weight_string(`test`.`t1`.`a`) = 'a')) +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result index 6cb1876c3ad..f84613e086f 100644 --- a/mysql-test/r/ctype_collate.result +++ b/mysql-test/r/ctype_collate.result @@ -649,7 +649,7 @@ select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `f1` varchar(1) CHARACTER SET latin5 NOT NULL DEFAULT '' + `f1` varchar(1) CHARACTER SET latin5 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate diff --git a/mysql-test/r/ctype_cp1250_ch.result b/mysql-test/r/ctype_cp1250_ch.result index 063cec289ab..f2eeb4dda79 100644 --- a/mysql-test/r/ctype_cp1250_ch.result +++ b/mysql-test/r/ctype_cp1250_ch.result @@ -105,6 +105,126 @@ SET character_set_server= @safe_character_set_server; SET collation_server= @safe_collation_server; SET character_set_client= @safe_character_set_client; SET character_set_results= @safe_character_set_results; +# +# MDEV-7149 Constant condition propagation erroneously applied for LIKE +# +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE CONCAT(c1)='a'; +c1 +a +a +SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'a '; +c1 +a +SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a ')) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE 'a'=CONCAT(c1); +c1 +a +a +SELECT * FROM t1 WHERE 'a ' LIKE CONCAT(c1); +c1 +a +SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`))) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '% '=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '%'=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +DROP TABLE t1; +# +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET utf8 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 1 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 1 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((not((`test`.`t1`.`a` like 'a '))) and (`test`.`t1`.`a` = 'a')) +DROP TABLE t1; +# +# End of MDEV-8694 +# SET @test_character_set= 'cp1250'; SET @test_collation= 'cp1250_czech_cs'; SET @safe_character_set_server= @@character_set_server; @@ -351,7 +471,7 @@ a DROP TABLE t1; set global LC_MESSAGES=convert((@@global.log_bin_trust_function_creators) using cp1250); -ERROR HY000: Unknown locale: '1' +ERROR HY000: Unknown locale: 'ON' # # Start of 5.6 tests # @@ -370,7 +490,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET cp1250 COLLATE cp1250_czech_cs NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET cp1250 COLLATE cp1250_czech_cs NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -390,7 +510,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET cp1250 COLLATE cp1250_czech_cs NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET cp1250 COLLATE cp1250_czech_cs NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result index 9d5dea2f286..09344a50ee9 100644 --- a/mysql-test/r/ctype_cp1251.result +++ b/mysql-test/r/ctype_cp1251.result @@ -385,6 +385,8 @@ FC FC FC D18C FC FD FD FD D18D FD FE FE FE D18E FE FF FF FF D18F FF +Warnings: +Warning 1977 Cannot convert 'cp1251' character 0x98 to 'utf8' DROP TABLE t1; set global LC_TIME_NAMES=convert((-8388608) using cp1251); ERROR HY000: Unknown locale: '-8388608' @@ -405,7 +407,7 @@ create table t1 as select concat(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select hex(c1) from t1; hex(c1) @@ -418,7 +420,7 @@ create table t1 as select concat(18446744073709551615) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(20) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(20) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select hex(c1) from t1; hex(c1) @@ -431,7 +433,7 @@ create table t1 as select concat(1.1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(4) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select hex(c1) from t1; hex(c1) @@ -444,7 +446,7 @@ create table t1 as select concat(1+2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1-2)); @@ -454,7 +456,7 @@ create table t1 as select concat(1-2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1*2)); @@ -464,7 +466,7 @@ create table t1 as select concat(1*2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1/2)); @@ -504,7 +506,7 @@ create table t1 as select concat(-1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(-(1+2))); @@ -514,7 +516,7 @@ create table t1 as select concat(-(1+2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(4) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1|2)); @@ -524,7 +526,7 @@ create table t1 as select concat(1|2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1&2)); @@ -534,7 +536,7 @@ create table t1 as select concat(1&2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(bit_count(12))); @@ -544,7 +546,7 @@ create table t1 as select concat(bit_count(12)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(2<<1)); @@ -554,7 +556,7 @@ create table t1 as select concat(2<<1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(2>>1)); @@ -564,7 +566,7 @@ create table t1 as select concat(2>>1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(~0)); @@ -574,7 +576,7 @@ create table t1 as select concat(~0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(3^2)); @@ -584,7 +586,7 @@ create table t1 as select concat(3^2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(abs(-2))); @@ -594,7 +596,7 @@ create table t1 as select concat(abs(-2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(left(concat(exp(2)),1)); @@ -724,7 +726,7 @@ create table t1 as select concat(degrees(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(23) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(radians(0))); @@ -734,7 +736,7 @@ create table t1 as select concat(radians(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(23) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ceiling(0.5))); @@ -744,7 +746,7 @@ create table t1 as select concat(ceiling(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(4) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(floor(0.5))); @@ -754,7 +756,7 @@ create table t1 as select concat(floor(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(4) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(round(0.5))); @@ -764,7 +766,7 @@ create table t1 as select concat(round(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(sign(0.5))); @@ -774,14 +776,14 @@ create table t1 as select concat(sign(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(rand()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(23) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(length('a'))); @@ -791,7 +793,7 @@ create table t1 as select concat(length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(char_length('a'))); @@ -801,7 +803,7 @@ create table t1 as select concat(char_length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(bit_length('a'))); @@ -811,7 +813,7 @@ create table t1 as select concat(bit_length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(coercibility('a'))); @@ -821,7 +823,7 @@ create table t1 as select concat(coercibility('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(locate('a','a'))); @@ -831,7 +833,7 @@ create table t1 as select concat(locate('a','a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(11) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(11) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(field('c','a','b','c'))); @@ -841,7 +843,7 @@ create table t1 as select concat(field('c','a','b','c')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ascii(61))); @@ -851,7 +853,7 @@ create table t1 as select concat(ascii(61)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ord(61))); @@ -861,7 +863,7 @@ create table t1 as select concat(ord(61)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(find_in_set('b','a,b,c,d'))); @@ -871,7 +873,7 @@ create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select md5('a'), hex(md5('a')); @@ -881,7 +883,7 @@ create table t1 as select md5('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(32) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(32) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select old_password('a'), hex(old_password('a')); @@ -891,7 +893,7 @@ create table t1 as select old_password('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(16) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(16) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select password('a'), hex(password('a')); @@ -901,7 +903,7 @@ create table t1 as select password('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(41) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(41) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select sha('a'), hex(sha('a')); @@ -911,7 +913,7 @@ create table t1 as select sha('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(40) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(40) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select sha1('a'), hex(sha1('a')); @@ -921,7 +923,7 @@ create table t1 as select sha1('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(40) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(40) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(cast('-1' as signed))); @@ -931,7 +933,7 @@ create table t1 as select concat(cast('-1' as signed)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(cast('1' as unsigned))); @@ -941,7 +943,7 @@ create table t1 as select concat(cast('1' as unsigned)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(cast(1/2 as decimal(5,5)))); @@ -1000,7 +1002,7 @@ create table t1 as select concat(least(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(greatest(1,2))); @@ -1010,7 +1012,7 @@ create table t1 as select concat(greatest(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(case when 11 then 22 else 33 end)); @@ -1020,7 +1022,7 @@ create table t1 as select concat(case when 11 then 22 else 33 end) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(coalesce(1,2))); @@ -1030,7 +1032,7 @@ create table t1 as select concat(coalesce(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat_ws(1,2,3)); @@ -1040,7 +1042,7 @@ create table t1 as select concat_ws(1,2,3) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(group_concat(1,2,3)); @@ -1068,7 +1070,7 @@ create table t1 as select concat(last_insert_id()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(benchmark(0,0))); @@ -1078,7 +1080,7 @@ create table t1 as select concat(benchmark(0,0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(sleep(0))); @@ -1088,7 +1090,7 @@ create table t1 as select concat(sleep(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(is_free_lock('xxxx'))); @@ -1122,7 +1124,7 @@ create table t1 as select concat(crc32('')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(uncompressed_length(''))); @@ -1139,7 +1141,7 @@ create table t1 as select concat(connection_id()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(inet_aton('127.1.1.1'))); @@ -1175,7 +1177,7 @@ create table t1 as select concat(row_count()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(found_rows())); @@ -1185,21 +1187,21 @@ create table t1 as select concat(found_rows()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(uuid_short()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(uuid()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(36) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select coercibility(uuid()), coercibility(cast('a' as char character set latin1)); @@ -1212,7 +1214,7 @@ create table t1 as select concat(uuid(), cast('a' as char character set latin1)) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(37) NOT NULL DEFAULT '' + `c1` varchar(37) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1; @@ -1232,8 +1234,8 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '', - `c2` int(1) NOT NULL DEFAULT '0' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL, + `c2` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; set @a2=1; @@ -1290,8 +1292,8 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT '', - `c2` decimal(2,1) NOT NULL DEFAULT '0.0' + `c1` varchar(4) CHARACTER SET cp1251 NOT NULL, + `c2` decimal(2,1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; set @a2=1.1; @@ -1329,7 +1331,7 @@ create table t1 as select concat('a'='a' IS TRUE) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a'='a' IS NOT TRUE)); @@ -1339,7 +1341,7 @@ create table t1 as select concat('a'='a' IS NOT TRUE) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(NOT 'a'='a')); @@ -1349,7 +1351,7 @@ create table t1 as select concat(NOT 'a'='a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' IS NULL)); @@ -1359,7 +1361,7 @@ create table t1 as select concat('a' IS NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' IS NOT NULL)); @@ -1369,7 +1371,7 @@ create table t1 as select concat('a' IS NOT NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' rlike 'a')); @@ -1379,7 +1381,7 @@ create table t1 as select concat('a' IS NOT NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(strcmp('a','b'))); @@ -1389,7 +1391,7 @@ create table t1 as select concat(strcmp('a','b')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' like 'a')); @@ -1399,7 +1401,7 @@ create table t1 as select concat('a' like 'b') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' between 'b' and 'c')); @@ -1409,7 +1411,7 @@ create table t1 as select concat('a' between 'b' and 'c') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' in ('a','b'))); @@ -1419,7 +1421,7 @@ create table t1 as select concat('a' in ('a','b')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(interval(23, 1, 15, 17, 30, 44, 200))); @@ -1429,7 +1431,7 @@ create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a varchar(10), fulltext key(a)); @@ -1451,7 +1453,7 @@ create table t1 as select ifnull(1,'a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ifnull(1,1))); @@ -1461,7 +1463,7 @@ create table t1 as select concat(ifnull(1,1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ifnull(1.1,1.1))); @@ -1471,7 +1473,7 @@ create table t1 as select concat(ifnull(1.1,1.1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(4) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(if(1,'b',1)); @@ -1481,7 +1483,7 @@ create table t1 as select if(1,'b',1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(if(1,1,'b')); @@ -1491,7 +1493,7 @@ create table t1 as select if(1,1,'b') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(if(1,1,1))); @@ -1501,7 +1503,7 @@ create table t1 as select concat(if(1,1,1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(nullif(1,2))); @@ -1581,7 +1583,7 @@ create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL + `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); @@ -1591,7 +1593,7 @@ create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL + `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); @@ -1666,7 +1668,7 @@ create table t1 as select concat(period_add(200902, 2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(6) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(period_diff(200902, 200802))); @@ -1678,7 +1680,7 @@ Warning 1265 Data truncated for column 'c1' at row 1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(6) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(to_days(20090224))); @@ -1875,21 +1877,21 @@ create table t1 as select concat(curdate()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(utc_date()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(curtime()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select repeat('a',20) as c1 limit 0; @@ -1905,7 +1907,7 @@ create table t1 as select concat(utc_time()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(sec_to_time(2378))); @@ -1998,21 +2000,21 @@ create table t1 as select concat(now()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(19) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(utc_timestamp()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(19) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(sysdate()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(19) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(addtime('00:00:00','11:22:33'))); @@ -2052,7 +2054,7 @@ create table t1 as select export_set(1,2,3,4,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(127) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(127) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(insert(1133,3,0,22)); @@ -2062,7 +2064,7 @@ create table t1 as select insert(1133,3,0,22) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(6) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(lcase(123)); @@ -2072,7 +2074,7 @@ create table t1 as select lcase(123) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(left(123,1)); @@ -2082,7 +2084,7 @@ create table t1 as select left(123,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(lower(123)); @@ -2092,7 +2094,7 @@ create table t1 as select lower(123) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(lpad(1,2,0)); @@ -2102,7 +2104,7 @@ create table t1 as select lpad(1,2,0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(ltrim(1)); @@ -2112,7 +2114,7 @@ create table t1 as select ltrim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(mid(1,1,1)); @@ -2122,7 +2124,7 @@ create table t1 as select mid(1,1,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(repeat(1,2)); @@ -2132,7 +2134,7 @@ create table t1 as select repeat(1,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(replace(1,1,2)); @@ -2142,7 +2144,7 @@ create table t1 as select replace(1,1,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(reverse(12)); @@ -2152,7 +2154,7 @@ create table t1 as select reverse(12) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(right(123,1)); @@ -2162,7 +2164,7 @@ create table t1 as select right(123,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(rpad(1,2,0)); @@ -2172,7 +2174,7 @@ create table t1 as select rpad(1,2,0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(rtrim(1)); @@ -2182,7 +2184,7 @@ create table t1 as select rtrim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(soundex(1)); @@ -2192,7 +2194,7 @@ create table t1 as select soundex(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(4) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(substring(1,1,1)); @@ -2202,7 +2204,7 @@ create table t1 as select substring(1,1,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(trim(1)); @@ -2212,7 +2214,7 @@ create table t1 as select trim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(ucase(1)); @@ -2222,7 +2224,7 @@ create table t1 as select ucase(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(upper(1)); @@ -2232,14 +2234,14 @@ create table t1 as select upper(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select repeat(' ', 64) as a limit 0; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(64) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `a` varchar(64) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ("1.1"), ("2.1"); select a, hex(a) from t1; @@ -2468,7 +2470,7 @@ t2 CREATE TABLE `t2` ( `concat(a)` varbinary(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1, t2; -create table t1 (a timestamp); +create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values (0); insert into t1 values (20010203040506); insert into t1 values (19800203040506); @@ -2489,7 +2491,7 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(19) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `concat(a)` varchar(19) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1, t2; create table t1 (a date); @@ -2780,7 +2782,7 @@ hex(a) 0000000000000001 drop table t1; drop view v1; -create table t1 (a timestamp); +create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values (0); insert into t1 values (20010203040506); insert into t1 values (19800203040506); @@ -3029,7 +3031,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `CONCAT(a)` varchar(9) CHARACTER SET cp1251 DEFAULT NULL, - `IFNULL(a,'')` varchar(9) CHARACTER SET cp1251 NOT NULL DEFAULT '', + `IFNULL(a,'')` varchar(9) CHARACTER SET cp1251 NOT NULL, `IF(a,a,'')` varchar(9) CHARACTER SET cp1251 DEFAULT NULL, `CASE WHEN a THEN a ELSE '' END` varchar(9) CHARACTER SET cp1251 DEFAULT NULL, `COALESCE(a,'')` varchar(9) CHARACTER SET cp1251 DEFAULT NULL @@ -3039,14 +3041,14 @@ CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT LCASE(a) FROM t1; @@ -3067,35 +3069,35 @@ CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `REPEAT(1,2)` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `REPEAT(1,2)` varchar(2) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `LEFT(123,2)` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `LEFT(123,2)` varchar(2) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `RIGHT(123,2)` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `RIGHT(123,2)` varchar(2) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `LTRIM(123)` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `LTRIM(123)` varchar(3) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `RTRIM(123)` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `RTRIM(123)` varchar(3) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1; @@ -3109,35 +3111,35 @@ CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `REPLACE(111,2,3)` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `REPLACE(111,2,3)` varchar(3) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `SOUNDEX(1)` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `SOUNDEX(1)` varchar(4) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8); SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET cp1251 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; DROP TABLE t1; @@ -3161,7 +3163,7 @@ id select_type table type possible_keys key key_len ref rows Extra ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL; EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range date_column date_column 9 NULL 1 Using index condition +1 SIMPLE t1 range date_column date_column 6 NULL 1 Using index condition DROP TABLE t1; # # Bug #31384 DATE_ADD() and DATE_SUB() return binary data @@ -3301,7 +3303,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `d` date DEFAULT NULL, - `bad` varchar(10) CHARACTER SET cp1251 DEFAULT NULL + `bad` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1, t2; SET NAMES latin1; @@ -3341,3 +3343,66 @@ DROP TABLE t1; # # End of 5.5 tests # +# +# Start of 10.1 tests +# +# +# MDEV-8688 Wrong result for SELECT..WHERE varchar_column IN (1,2,3) AND varchar_column=' 1'; +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET cp1251 COLLATE cp1251_ukrainian_ci); +INSERT INTO t1 VALUES (' 1'),('`1'); +SELECT * FROM t1 WHERE a IN (1,2,3); +a + 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '`1' +SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1'; +a + 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '`1' +SELECT * FROM t1 WHERE a IN (1,2,3,'4') AND a=' 1'; +a + 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '`1' +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = ' 1') and (`test`.`t1`.`a` in (1,2,3))) +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,3,'x') AND a=' 1'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = ' 1') and (`test`.`t1`.`a` in (1,2,3,'x'))) +DROP TABLE t1; +# +# MDEV-8671 Wrong result for SELECT..WHERE varchar_column=' 1' AND (varchar_column XOR '1') +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET cp1251 COLLATE cp1251_ukrainian_ci); +INSERT INTO t1 VALUES (' 1'),('`1'); +SELECT * FROM t1 WHERE a=' 1'; +a + 1 +`1 +SELECT * FROM t1 WHERE (a XOR '0'); +a + 1 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '`1' +SELECT * FROM t1 WHERE a=' 1' AND (a XOR '0'); +a + 1 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '`1' +# ' 1' should not be propagated into (a XIR '0') +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=' 1' AND (a XOR '0'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = ' 1') and (`test`.`t1`.`a` xor '0')) +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result index 0e6ae25a395..75d05aa9f0a 100644 --- a/mysql-test/r/ctype_cp932_binlog_stm.result +++ b/mysql-test/r/ctype_cp932_binlog_stm.result @@ -94,7 +94,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `code` varchar(8) DEFAULT NULL, - `a` varchar(1) CHARACTER SET cp932 NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET cp932 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 UPDATE t1 SET a=unhex(code) ORDER BY code; Warnings: @@ -165,7 +165,7 @@ Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 SELECT COUNT(*) FROM t1; COUNT(*) 14623 -SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=1; +SELECT COUNT(*) FROM t1 WHERE a<>'?' AND OCTET_LENGTH(a)=1; COUNT(*) 63 SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=2; @@ -386,10 +386,140 @@ WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; code a 81F0 â„« +Warnings: +Warning 1977 Cannot convert 'cp932' character 0x81AD to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81AD to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81AE to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81AE to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81AF to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81AF to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B0 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B0 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B1 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B1 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B2 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B2 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B3 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B3 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B4 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B4 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B5 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B5 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B6 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B6 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B7 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B7 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C0 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C0 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C1 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C1 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C2 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C2 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C3 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C3 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C4 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C4 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C5 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C5 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C6 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C6 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C7 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C7 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81CF to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81CF to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D0 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D0 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D1 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D1 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D2 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D2 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D3 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D3 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D4 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D4 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D5 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D5 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D6 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D6 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D7 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D7 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D8 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D8 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D9 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D9 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81E9 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81E9 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81EA to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81EA to 'utf8' SELECT * FROM t1 WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; code a +Warnings: +Warning 1977 Cannot convert 'cp932' character 0x81AD to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81AD to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81AE to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81AE to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81AF to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81AF to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B0 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B0 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B1 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B1 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B2 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B2 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B3 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B3 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B4 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B4 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B5 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B5 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B6 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B6 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B7 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B7 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C0 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C0 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C1 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C1 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C2 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C2 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C3 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C3 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C4 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C4 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C5 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C5 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C6 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C6 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C7 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C7 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81CF to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81CF to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D0 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D0 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D1 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D1 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D2 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D2 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D3 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D3 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D4 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D4 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D5 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D5 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D6 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D6 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D7 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D7 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D8 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D8 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D9 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D9 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81E9 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81E9 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81EA to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81EA to 'utf8' # # WL#3090 Japanese Character Set adjustments # Test cp932->Unicode conversion @@ -10064,6 +10194,71 @@ FC48 E9B5AB FC49 EFA8AD FC4A E9B899 FC4B E9BB91 +Warnings: +Warning 1977 Cannot convert 'cp932' character 0x81AD to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81AE to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81AF to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B0 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B1 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B2 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B3 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B4 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B5 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B6 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81B7 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C0 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C1 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C2 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C3 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C4 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C5 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C6 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81C7 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81CF to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D0 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D1 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D2 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D3 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D4 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D5 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D6 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D7 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D8 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81D9 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81E9 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81EA to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81EB to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81EC to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81ED to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81EE to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81EF to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81F8 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81F9 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81FA to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x81FB to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x8240 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x8241 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x8242 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x8243 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x8244 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x8245 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x8246 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x8247 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x8248 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x8249 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x824A to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x824B to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x824C to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x824D to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x824E to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x8259 to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x825A to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x825B to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x825C to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x825D to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x825E to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x825F to 'utf8' +Warning 1977 Cannot convert 'cp932' character 0x827A to 'utf8' DROP TABLE t1; # # WL#3090 Japanese Character Set adjustments @@ -19547,7 +19742,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET cp932 NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET cp932 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -19567,7 +19762,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET cp932 NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET cp932 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -19806,7 +20001,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET cp932 COLLATE cp932_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET cp932 COLLATE cp932_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -19826,7 +20021,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET cp932 COLLATE cp932_bin NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET cp932 COLLATE cp932_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -20105,7 +20300,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ',10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET cp932 NOT NULL DEFAULT '' + `a` varchar(10) CHARACTER SET cp932 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('à\'),('à\t'); INSERT INTO t1 VALUES ('\\à\'),('\\à\t'),('\\à\t\t'); @@ -20144,7 +20339,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET cp932 NOT NULL DEFAULT '' + `a` varchar(10) CHARACTER SET cp932 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (BINARY('à\')),(BINARY('à\t')); INSERT INTO t1 VALUES (BINARY('\\à\')),(BINARY('\\à\t')),(BINARY('\\à\t\t')); @@ -20183,7 +20378,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET cp932 NOT NULL DEFAULT '' + `a` varchar(10) CHARACTER SET cp932 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (_BINARY'à\'),(_BINARY'à\t'); INSERT INTO t1 VALUES (_BINARY'\\à\'),(_BINARY'\\à\t'),(_BINARY'\\à\t\t'); @@ -20229,7 +20424,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET cp932 NOT NULL DEFAULT '' + `a` varchar(10) CHARACTER SET cp932 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('à\['),('\à\['); SELECT HEX(a) FROM t1; @@ -20249,7 +20444,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varbinary(10) NOT NULL DEFAULT '' + `a` varbinary(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('à\['),('\à\['); SELECT HEX(a) FROM t1; diff --git a/mysql-test/r/ctype_eucjpms.result b/mysql-test/r/ctype_eucjpms.result index a1232c115e9..f9cb4f1eecc 100644 --- a/mysql-test/r/ctype_eucjpms.result +++ b/mysql-test/r/ctype_eucjpms.result @@ -9881,9 +9881,21 @@ CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value SELECT hex(concat(repeat(0xF1F2, 10), '%')); hex(concat(repeat(0xF1F2, 10), '%')) F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 @@ -9976,9 +9988,21 @@ CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value SELECT hex(concat(repeat(0xF1F2, 10), '%')); hex(concat(repeat(0xF1F2, 10), '%')) F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 @@ -9992,9 +10016,13 @@ DROP TABLE t1; select hex(convert(_eucjpms 0xA5FE41 using ucs2)); hex(convert(_eucjpms 0xA5FE41 using ucs2)) 003F0041 +Warnings: +Warning 1977 Cannot convert 'eucjpms' character 0xA5FE to 'ucs2' select hex(convert(_eucjpms 0x8FABF841 using ucs2)); hex(convert(_eucjpms 0x8FABF841 using ucs2)) 003F0041 +Warnings: +Warning 1977 Cannot convert 'eucjpms' character 0x8FABF8 to 'ucs2' set global LC_TIME_NAMES=convert((convert((0x63) using eucjpms)) using utf8); ERROR HY000: Unknown locale: 'c' # @@ -10014,21 +10042,27 @@ DROP TABLE t1; CREATE TABLE t1 AS SELECT 'XXXXXX' AS code, ' ' AS a LIMIT 0; INSERT INTO t1 (code) SELECT concat('8E', head) FROM head WHERE (head BETWEEN 'A1' AND 'DF') ORDER BY head; +Warnings: +Warning 1364 Field 'a' doesn't have a default value INSERT INTO t1 (code) SELECT concat(head, tail) FROM head, tail WHERE (head BETWEEN '80' AND 'FF') AND (head NOT BETWEEN '8E' AND '8F') AND (tail BETWEEN '20' AND 'FF') ORDER BY head, tail; +Warnings: +Warning 1364 Field 'a' doesn't have a default value INSERT INTO t1 (code) SELECT concat('8F', head, tail) FROM head, tail WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '20' AND 'FF') ORDER BY head, tail; +Warnings: +Warning 1364 Field 'a' doesn't have a default value DROP TEMPORARY TABLE head, tail; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `code` varchar(6) CHARACTER SET eucjpms NOT NULL DEFAULT '', - `a` varchar(1) CHARACTER SET eucjpms NOT NULL DEFAULT '' + `code` varchar(6) CHARACTER SET eucjpms NOT NULL, + `a` varchar(1) CHARACTER SET eucjpms NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 UPDATE t1 SET a=unhex(code) ORDER BY code; Warnings: @@ -10101,6 +10135,9 @@ COUNT(*) 56959 SELECT COUNT(*) FROM t1 WHERE a<>''; COUNT(*) +56959 +SELECT COUNT(*) FROM t1 WHERE a<>'' AND a<>'?'; +COUNT(*) 17735 SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=2; COUNT(*) @@ -10551,12 +10588,142 @@ WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; code a 8FAABC Ä¢ +Warnings: +Warning 1977 Cannot convert 'eucjpms' character 0xA2AF to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2AF to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B0 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B0 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B1 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B1 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B2 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B2 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B3 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B3 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B4 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B4 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B5 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B5 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B6 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B6 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B7 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B7 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B8 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B8 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B9 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B9 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C2 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C2 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C3 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C3 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C4 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C4 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C5 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C5 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C6 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C6 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C7 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C7 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C8 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C8 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C9 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C9 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D1 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D1 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D2 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D2 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D3 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D3 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D4 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D4 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D5 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D5 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D6 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D6 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D7 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D7 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D8 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D8 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D9 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D9 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2DA to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2DA to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2DB to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2DB to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2EB to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2EB to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2EC to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2EC to 'utf8' SELECT * FROM t1 WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; code a 8FA9C3 ð 8FABB9 ǵ +Warnings: +Warning 1977 Cannot convert 'eucjpms' character 0xA2AF to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2AF to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B0 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B0 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B1 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B1 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B2 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B2 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B3 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B3 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B4 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B4 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B5 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B5 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B6 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B6 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B7 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B7 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B8 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B8 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B9 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B9 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C2 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C2 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C3 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C3 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C4 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C4 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C5 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C5 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C6 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C6 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C7 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C7 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C8 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C8 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C9 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C9 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D1 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D1 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D2 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D2 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D3 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D3 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D4 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D4 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D5 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D5 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D6 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D6 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D7 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D7 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D8 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D8 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D9 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D9 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2DA to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2DA to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2DB to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2DB to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2EB to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2EB to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2EC to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2EC to 'utf8' # # WL#3090 Japanese Character Set adjustments # Test sjis->Unicode conversion @@ -25642,6 +25809,71 @@ FEFB EE8EA8 FEFC EE8EA9 FEFD EE8EAA FEFE EE8EAB +Warnings: +Warning 1977 Cannot convert 'eucjpms' character 0xA2AF to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B0 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B1 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B2 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B3 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B4 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B5 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B6 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B7 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B8 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2B9 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C2 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C3 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C4 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C5 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C6 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C7 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C8 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2C9 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D1 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D2 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D3 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D4 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D5 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D6 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D7 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D8 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2D9 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2DA to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2DB to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2EB to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2EC to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2ED to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2EE to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2EF to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2F0 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2F1 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2FA to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2FB to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2FC to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA2FD to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3A1 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3A2 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3A3 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3A4 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3A5 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3A6 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3A7 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3A8 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3A9 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3AA to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3AB to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3AC to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3AD to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3AE to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3AF to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3BA to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3BB to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3BC to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3BD to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3BE to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3BF to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3C0 to 'utf8' +Warning 1977 Cannot convert 'eucjpms' character 0xA3DB to 'utf8' DROP TABLE t1; # # WL#3090 Japanese Character Set adjustments @@ -32761,7 +32993,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET eucjpms NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET eucjpms NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -32781,7 +33013,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET eucjpms NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET eucjpms NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -33194,7 +33426,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET eucjpms COLLATE eucjpms_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET eucjpms COLLATE eucjpms_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -33214,7 +33446,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET eucjpms COLLATE eucjpms_bin NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET eucjpms COLLATE eucjpms_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -33632,10 +33864,52 @@ CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET eucjpms); INSERT INTO t1 VALUES (0x8EA0); SELECT HEX(a), CHAR_LENGTH(a) FROM t1; HEX(a) CHAR_LENGTH(a) - 0 +3F3F 2 DROP TABLE t1; SELECT _eucjpms 0x8EA0; ERROR HY000: Invalid eucjpms character string: '8EA0' # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-8215 Asian MB3 charsets: compare broken bytes as "greater than any non-broken character" +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET eucjpms, KEY(a)); +INSERT INTO t1 VALUES ('a'),(0x7F); +INSERT INTO t1 VALUES (0x8EA1),(0x8EDF); +INSERT INTO t1 VALUES (0x8FA1A1),(0x8FFEFE); +INSERT INTO t1 VALUES (0xA1A1),(0xDEDE),(0xDFDF),(0xE0E0),(0xFEFE); +SELECT HEX(a) FROM t1 ORDER BY a; +HEX(a) +61 +7F +8EA1 +8EDF +8FA1A1 +8FFEFE +A1A1 +DEDE +DFDF +E0E0 +FEFE +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET eucjpms COLLATE eucjpms_bin; +SELECT HEX(a) FROM t1 ORDER BY a; +HEX(a) +61 +7F +8EA1 +8EDF +8FA1A1 +8FFEFE +A1A1 +DEDE +DFDF +E0E0 +FEFE +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ctype_euckr.result b/mysql-test/r/ctype_euckr.result index dcb68cfe60b..90353c6af2a 100644 --- a/mysql-test/r/ctype_euckr.result +++ b/mysql-test/r/ctype_euckr.result @@ -224,9 +224,21 @@ CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value SELECT hex(concat(repeat(0xF1F2, 10), '%')); hex(concat(repeat(0xF1F2, 10), '%')) F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 @@ -359,9 +371,21 @@ CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value SELECT hex(concat(repeat(0xF1F2, 10), '%')); hex(concat(repeat(0xF1F2, 10), '%')) F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 @@ -407,12 +431,12 @@ Warnings: Warning 1366 Incorrect string value: '\xA1\xFF' for column 's1' at row 1 select hex(s1), hex(convert(s1 using utf8)) from t1 order by binary s1; hex(s1) hex(convert(s1 using utf8)) - - - - - - +3F3F 3F3F +3F3F 3F3F +3F40 3F40 +3F5B 3F5B +3F60 3F60 +3F7B 3F7B A141 ECA2A5 A15A ECA381 A161 ECA382 @@ -445,7 +469,7 @@ FROM t1 t11, t1 t12 WHERE t11.a >= 0x81 AND t11.a <= 0xFE AND t12.a >= 0x41 AND t12.a <= 0xFE ORDER BY t11.a, t12.a; -SELECT s as bad_code FROM t2 WHERE a='' ORDER BY s; +SELECT s as bad_code FROM t2 WHERE a='?' ORDER BY s; bad_code 815B 815C @@ -1959,7 +1983,7 @@ FE7D FE7E FE7F FE80 -DELETE FROM t2 WHERE a=''; +DELETE FROM t2 WHERE a='?'; ALTER TABLE t2 ADD u VARCHAR(1) CHARACTER SET utf8, ADD a2 VARCHAR(1) CHARACTER SET euckr; UPDATE t2 SET u=a, a2=u; SELECT s as unassigned_code FROM t2 WHERE u='?'; @@ -24424,7 +24448,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `code` varchar(8) DEFAULT NULL, - `a` varchar(1) CHARACTER SET euckr NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET euckr NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 UPDATE t1 SET a=unhex(code) ORDER BY code; Warnings: @@ -24492,7 +24516,7 @@ Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61 Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62 Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63 Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 -SELECT COUNT(*) FROM t1 WHERE a<>''; +SELECT COUNT(*) FROM t1 WHERE a<>'?'; COUNT(*) 22428 SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)); @@ -24712,6 +24736,71 @@ WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; code a A1CA â„« +Warnings: +Warning 1977 Cannot convert 'euckr' character 0xA2E8 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2E8 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2E9 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2E9 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2EA to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2EA to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2EB to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2EB to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2EC to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2EC to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2ED to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2ED to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2EE to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2EE to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2EF to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2EF to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F0 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F0 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F1 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F1 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F2 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F2 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F3 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F3 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F4 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F4 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F5 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F5 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F6 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F6 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F7 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F7 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F8 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F8 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F9 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F9 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2FA to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2FA to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2FB to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2FB to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2FC to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2FC to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2FD to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2FD to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2FE to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2FE to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5AB to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5AB to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5AC to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5AC to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5AD to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5AD to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5AE to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5AE to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5AF to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5AF to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5BA to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5BA to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5BB to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5BB to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5BC to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5BC to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5BD to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5BD to 'utf8' SELECT * FROM t1 WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; @@ -24743,6 +24832,71 @@ A8E4 ⓧ A8E5 ⓨ A8E6 â“© A9A2 Ä‘ +Warnings: +Warning 1977 Cannot convert 'euckr' character 0xA2E8 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2E8 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2E9 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2E9 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2EA to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2EA to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2EB to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2EB to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2EC to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2EC to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2ED to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2ED to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2EE to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2EE to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2EF to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2EF to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F0 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F0 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F1 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F1 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F2 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F2 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F3 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F3 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F4 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F4 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F5 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F5 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F6 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F6 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F7 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F7 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F8 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F8 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F9 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2F9 to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2FA to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2FA to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2FB to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2FB to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2FC to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2FC to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2FD to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2FD to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2FE to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA2FE to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5AB to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5AB to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5AC to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5AC to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5AD to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5AD to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5AE to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5AE to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5AF to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5AF to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5BA to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5BA to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5BB to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5BB to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5BC to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5BC to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5BD to 'utf8' +Warning 1977 Cannot convert 'euckr' character 0xA5BD to 'utf8' DROP TABLE t1; # # End of 5.5 tests @@ -24761,7 +24915,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET euckr NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET euckr NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -24781,7 +24935,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET euckr NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET euckr NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -25020,7 +25174,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET euckr COLLATE euckr_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET euckr COLLATE euckr_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -25040,7 +25194,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET euckr COLLATE euckr_bin NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET euckr COLLATE euckr_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; diff --git a/mysql-test/r/ctype_filename.result b/mysql-test/r/ctype_filename.result index ac8df476137..c6d7d1e39b9 100644 --- a/mysql-test/r/ctype_filename.result +++ b/mysql-test/r/ctype_filename.result @@ -14,3 +14,10 @@ drop table `clock$`; select convert(convert(',' using filename) using binary); convert(convert(',' using filename) using binary) @002c +# +# MDEV-7677 my_charset_handler_filename has a wrong "ismbchar" member +# +SET NAMES utf8; +SELECT @a:=CONVERT('aÑ' USING filename) AS `@a`, BINARY @a, REVERSE(@a), HEX(@a), HEX(REVERSE(@a)); +@a BINARY @a REVERSE(@a) HEX(@a) HEX(REVERSE(@a)) +aÑ a@r1 Ña 61407231 40723161 diff --git a/mysql-test/r/ctype_gb2312.result b/mysql-test/r/ctype_gb2312.result index 5db6e2d3035..f9f37c00a79 100644 --- a/mysql-test/r/ctype_gb2312.result +++ b/mysql-test/r/ctype_gb2312.result @@ -224,9 +224,21 @@ CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value SELECT hex(concat(repeat(0xF1F2, 10), '%')); hex(concat(repeat(0xF1F2, 10), '%')) F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 @@ -440,9 +452,21 @@ CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value SELECT hex(concat(repeat(0xF1F2, 10), '%')); hex(concat(repeat(0xF1F2, 10), '%')) F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 @@ -485,7 +509,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `code` varchar(8) DEFAULT NULL, - `a` varchar(1) CHARACTER SET gb2312 NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET gb2312 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 UPDATE t1 SET a=unhex(code) ORDER BY code; Warnings: @@ -553,7 +577,7 @@ Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61 Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62 Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63 Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 -SELECT COUNT(*) FROM t1 WHERE a<>''; +SELECT COUNT(*) FROM t1 WHERE a<>'?'; COUNT(*) 8178 SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)); @@ -740,6 +764,71 @@ A2F9 â…¨ A2FA â…© A2FB â…ª A2FC â…« +Warnings: +Warning 1977 Cannot convert 'gb2312' character 0xA2A1 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A1 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A2 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A2 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A3 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A3 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A4 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A4 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A5 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A5 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A6 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A6 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A7 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A7 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A8 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A8 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A9 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A9 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AA to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AA to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AB to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AB to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AC to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AC to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AD to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AD to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AE to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AE to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AF to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AF to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2B0 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2B0 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2E3 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2E3 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2E4 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2E4 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2EF to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2EF to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2F0 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2F0 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2FD to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2FD to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2FE to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2FE to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F4 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F4 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F5 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F5 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F6 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F6 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F7 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F7 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F8 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F8 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F9 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F9 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4FA to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4FA to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4FB to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4FB to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4FC to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4FC to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4FD to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4FD to 'utf8' SELECT * FROM t1 WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; @@ -770,6 +859,71 @@ A8B7 Çš A8B8 Çœ A8B9 ü A8BA ê +Warnings: +Warning 1977 Cannot convert 'gb2312' character 0xA2A1 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A1 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A2 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A2 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A3 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A3 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A4 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A4 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A5 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A5 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A6 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A6 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A7 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A7 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A8 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A8 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A9 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2A9 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AA to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AA to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AB to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AB to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AC to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AC to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AD to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AD to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AE to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AE to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AF to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2AF to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2B0 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2B0 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2E3 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2E3 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2E4 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2E4 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2EF to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2EF to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2F0 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2F0 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2FD to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2FD to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2FE to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA2FE to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F4 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F4 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F5 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F5 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F6 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F6 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F7 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F7 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F8 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F8 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F9 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4F9 to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4FA to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4FA to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4FB to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4FB to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4FC to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4FC to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4FD to 'utf8' +Warning 1977 Cannot convert 'gb2312' character 0xA4FD to 'utf8' DROP TABLE t1; # # End of 5.5 tests @@ -788,7 +942,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET gb2312 NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET gb2312 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -808,7 +962,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET gb2312 NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET gb2312 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -1047,7 +1201,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET gb2312 COLLATE gb2312_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET gb2312 COLLATE gb2312_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -1067,7 +1221,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET gb2312 COLLATE gb2312_bin NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET gb2312 COLLATE gb2312_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; diff --git a/mysql-test/r/ctype_gbk.result b/mysql-test/r/ctype_gbk.result index c5d997b0213..b5774548d85 100644 --- a/mysql-test/r/ctype_gbk.result +++ b/mysql-test/r/ctype_gbk.result @@ -224,9 +224,21 @@ CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value SELECT hex(concat(repeat(0xF1F2, 10), '%')); hex(concat(repeat(0xF1F2, 10), '%')) F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 @@ -440,9 +452,21 @@ CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value SELECT hex(concat(repeat(0xF1F2, 10), '%')); hex(concat(repeat(0xF1F2, 10), '%')) F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 @@ -464,6 +488,8 @@ DROP TABLE t1; select hex(convert(_gbk 0xA14041 using ucs2)); hex(convert(_gbk 0xA14041 using ucs2)) 003F0041 +Warnings: +Warning 1977 Cannot convert 'gbk' character 0xA140 to 'ucs2' create table t1 (c1 text not null, c2 text not null) character set gbk; alter table t1 change c1 c1 mediumtext character set gbk not null; show create table t1; @@ -505,7 +531,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `code` varchar(8) DEFAULT NULL, - `a` varchar(1) CHARACTER SET gbk NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET gbk NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 UPDATE t1 SET a=unhex(code) ORDER BY code; Warnings: @@ -573,7 +599,7 @@ Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61 Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62 Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63 Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 -SELECT COUNT(*) FROM t1 WHERE a<>''; +SELECT COUNT(*) FROM t1 WHERE a<>'?'; COUNT(*) 23940 SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)); @@ -770,6 +796,71 @@ HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; code a A2FB â…ª A2FC â…« +Warnings: +Warning 1977 Cannot convert 'gbk' character 0xA140 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA140 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA141 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA141 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA142 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA142 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA143 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA143 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA144 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA144 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA145 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA145 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA146 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA146 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA147 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA147 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA148 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA148 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA149 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA149 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14A to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14A to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14B to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14B to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14C to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14C to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14D to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14D to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14E to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14E to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14F to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14F to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA150 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA150 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA151 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA151 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA152 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA152 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA153 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA153 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA154 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA154 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA155 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA155 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA156 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA156 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA157 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA157 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA158 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA158 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA159 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA159 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15A to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15A to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15B to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15B to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15C to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15C to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15D to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15D to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15E to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15E to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15F to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15F to 'utf8' SELECT * FROM t1 WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; @@ -802,6 +893,71 @@ A8B9 ü A8BA ê A8BD Å„ A8BE ň +Warnings: +Warning 1977 Cannot convert 'gbk' character 0xA140 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA140 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA141 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA141 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA142 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA142 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA143 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA143 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA144 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA144 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA145 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA145 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA146 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA146 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA147 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA147 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA148 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA148 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA149 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA149 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14A to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14A to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14B to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14B to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14C to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14C to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14D to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14D to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14E to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14E to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14F to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA14F to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA150 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA150 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA151 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA151 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA152 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA152 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA153 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA153 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA154 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA154 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA155 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA155 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA156 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA156 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA157 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA157 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA158 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA158 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA159 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA159 to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15A to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15A to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15B to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15B to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15C to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15C to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15D to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15D to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15E to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15E to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15F to 'utf8' +Warning 1977 Cannot convert 'gbk' character 0xA15F to 'utf8' DROP TABLE t1; # # End of 5.5 tests @@ -820,7 +976,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET gbk NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET gbk NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -840,7 +996,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET gbk NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET gbk NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -1253,7 +1409,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET gbk COLLATE gbk_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET gbk COLLATE gbk_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -1273,7 +1429,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET gbk COLLATE gbk_bin NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET gbk COLLATE gbk_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -4790,7 +4946,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ',10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET gbk NOT NULL DEFAULT '' + `a` varchar(10) CHARACTER SET gbk NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('à\'),('à\t'); INSERT INTO t1 VALUES ('\\à\'),('\\à\t'),('\\à\t\t'); @@ -4829,7 +4985,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET gbk NOT NULL DEFAULT '' + `a` varchar(10) CHARACTER SET gbk NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (BINARY('à\')),(BINARY('à\t')); INSERT INTO t1 VALUES (BINARY('\\à\')),(BINARY('\\à\t')),(BINARY('\\à\t\t')); @@ -4868,7 +5024,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET gbk NOT NULL DEFAULT '' + `a` varchar(10) CHARACTER SET gbk NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (_BINARY'à\'),(_BINARY'à\t'); INSERT INTO t1 VALUES (_BINARY'\\à\'),(_BINARY'\\à\t'),(_BINARY'\\à\t\t'); @@ -4914,7 +5070,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET gbk NOT NULL DEFAULT '' + `a` varchar(10) CHARACTER SET gbk NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('à\['),('\à\['); SELECT HEX(a) FROM t1; @@ -4934,7 +5090,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varbinary(10) NOT NULL DEFAULT '' + `a` varbinary(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('à\['),('\à\['); SELECT HEX(a) FROM t1; @@ -4946,3 +5102,827 @@ DROP TABLE t1; # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-6566 Different INSERT behaviour on bad bytes with and without character set conversion +# +CREATE TABLE t1 ( +id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +b VARBINARY(16), +type SET('ascii','bad','head','tail','mb2','unassigned') +); +INSERT INTO t1 (b, type) VALUES (0x40, 'ascii,tail'); +INSERT INTO t1 (b, type) VALUES (0x80, 'tail'); +INSERT INTO t1 (b, type) VALUES (0x81, 'head,tail'); +INSERT INTO t1 (b, type) VALUES (0xFF, 'bad'); +INSERT INTO t1 (b, type) VALUES (0xA140, 'mb2,unassigned'); +INSERT INTO t1 (b, type) VALUES (0xA1A3, 'mb2'); +INSERT INTO t1 (b, type) VALUES (0xFE40, 'mb2'); +CREATE TABLE t2 AS SELECT +CONCAT(t1.b,t2.b) AS b, +t1.type AS type1, +t2.type AS type2, +CONCAT('[',t1.type,'][',t2.type,']') AS comment +FROM t1, t1 t2; +CREATE TABLE t3 +( +b VARBINARY(16), +c VARCHAR(16) CHARACTER SET gbk, +comment VARCHAR(128) +); +# +# A combination of two valid characters, should give no warnings +# +INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 +WHERE +(FIND_IN_SET('ascii',type1) OR FIND_IN_SET('mb2',type1)) AND +(FIND_IN_SET('ascii',type2) OR FIND_IN_SET('mb2',type2)) +ORDER BY b; +SELECT COUNT(*) FROM t3; +COUNT(*) +16 +SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b; +HEX(c) comment +4040 [ascii,tail][ascii,tail] +40A140 [ascii,tail][mb2,unassigned] +40A1A3 [ascii,tail][mb2] +40FE40 [ascii,tail][mb2] +A14040 [mb2,unassigned][ascii,tail] +A140A140 [mb2,unassigned][mb2,unassigned] +A140A1A3 [mb2,unassigned][mb2] +A140FE40 [mb2,unassigned][mb2] +A1A340 [mb2][ascii,tail] +A1A3A140 [mb2][mb2,unassigned] +A1A3A1A3 [mb2][mb2] +A1A3FE40 [mb2][mb2] +FE4040 [mb2][ascii,tail] +FE40A140 [mb2][mb2,unassigned] +FE40A1A3 [mb2][mb2] +FE40FE40 [mb2][mb2] +SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b; +HEX(c) HEX(b) comment +DELETE FROM t2 WHERE b IN (SELECT b FROM t3); +DELETE FROM t3; +# +# Sequences that start with a tail or a bad byte, +# or end with a bad byte, all should be fixed. +# +INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 +WHERE type1='tail' OR type1='bad' OR type2='bad' +ORDER BY b; +Warnings: +Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 1 +Warning 1366 Incorrect string value: '\x80@' for column 'c' at row 2 +Warning 1366 Incorrect string value: '\x80\x80' for column 'c' at row 3 +Warning 1366 Incorrect string value: '\x80\x81' for column 'c' at row 4 +Warning 1366 Incorrect string value: '\x80\xA1@' for column 'c' at row 5 +Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column 'c' at row 6 +Warning 1366 Incorrect string value: '\x80\xFE@' for column 'c' at row 7 +Warning 1366 Incorrect string value: '\x80\xFF' for column 'c' at row 8 +Warning 1366 Incorrect string value: '\x81\xFF' for column 'c' at row 9 +Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 10 +Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 11 +Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 12 +Warning 1366 Incorrect string value: '\xFF@' for column 'c' at row 13 +Warning 1366 Incorrect string value: '\xFF\x80' for column 'c' at row 14 +Warning 1366 Incorrect string value: '\xFF\x81' for column 'c' at row 15 +Warning 1366 Incorrect string value: '\xFF\xA1@' for column 'c' at row 16 +Warning 1366 Incorrect string value: '\xFF\xA1\xA3' for column 'c' at row 17 +Warning 1366 Incorrect string value: '\xFF\xFE@' for column 'c' at row 18 +Warning 1366 Incorrect string value: '\xFF\xFF' for column 'c' at row 19 +SELECT COUNT(*) FROM t3; +COUNT(*) +19 +SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b; +HEX(c) comment +SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b; +HEX(c) HEX(b) comment +403F 40FF [ascii,tail][bad] +3F40 8040 [tail][ascii,tail] +3F3F 8080 [tail][tail] +3F3F 8081 [tail][head,tail] +3FA140 80A140 [tail][mb2,unassigned] +3FA1A3 80A1A3 [tail][mb2] +3FFE40 80FE40 [tail][mb2] +3F3F 80FF [tail][bad] +3F3F 81FF [head,tail][bad] +A1403F A140FF [mb2,unassigned][bad] +A1A33F A1A3FF [mb2][bad] +FE403F FE40FF [mb2][bad] +3F40 FF40 [bad][ascii,tail] +3F3F FF80 [bad][tail] +3F3F FF81 [bad][head,tail] +3FA140 FFA140 [bad][mb2,unassigned] +3FA1A3 FFA1A3 [bad][mb2] +3FFE40 FFFE40 [bad][mb2] +3F3F FFFF [bad][bad] +DELETE FROM t2 WHERE b IN (SELECT b FROM t3); +DELETE FROM t3; +# +# Sequences that start with an ASCII or an MB2 character, +# followed by a non-ASCII tail, all should be fixed. +# +INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 +WHERE (FIND_IN_SET('mb2',type1) OR FIND_IN_SET('ascii',type1)) +AND (FIND_IN_SET('tail',type2) AND NOT FIND_IN_SET('ascii',type2)) +ORDER BY b; +Warnings: +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 1 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 2 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 3 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 4 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 5 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 6 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 7 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 8 +SELECT COUNT(*) FROM t3; +COUNT(*) +8 +SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b; +HEX(c) comment +SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b; +HEX(c) HEX(b) comment +403F 4080 [ascii,tail][tail] +403F 4081 [ascii,tail][head,tail] +A1403F A14080 [mb2,unassigned][tail] +A1403F A14081 [mb2,unassigned][head,tail] +A1A33F A1A380 [mb2][tail] +A1A33F A1A381 [mb2][head,tail] +FE403F FE4080 [mb2][tail] +FE403F FE4081 [mb2][head,tail] +DELETE FROM t2 WHERE b IN (SELECT b FROM t3); +DELETE FROM t3; +# +# Other sequences +# +INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 ORDER BY b; +Warnings: +Warning 1366 Incorrect string value: '\xA3' for column 'c' at row 5 +SELECT COUNT(*) FROM t3; +COUNT(*) +6 +SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b; +HEX(c) comment +8140 [head,tail][ascii,tail] +8180 [head,tail][tail] +8181 [head,tail][head,tail] +81A140 [head,tail][mb2,unassigned] +81FE40 [head,tail][mb2] +SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b; +HEX(c) HEX(b) comment +81A13F 81A1A3 [head,tail][mb2] +DELETE FROM t3; +DROP TABLE t3; +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +CONCAT(t1.b,t2.b,t3.b) AS b, +t1.type AS type1, +t2.type AS type2, +t3.type AS type3, +CONCAT('[',t1.type,'][',t2.type,'][',t3.type,']') AS comment +FROM t1, t1 t2,t1 t3; +SELECT COUNT(*) FROM t2; +COUNT(*) +343 +CREATE TABLE t3 +( +b VARBINARY(16), +c VARCHAR(16) CHARACTER SET gbk, +comment VARCHAR(128) +); +# +# A combination of three valid characters, should give no warnings +# +INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 +WHERE +(FIND_IN_SET('ascii',type1) OR FIND_IN_SET('mb2',type1)) AND +(FIND_IN_SET('ascii',type2) OR FIND_IN_SET('mb2',type2)) AND +(FIND_IN_SET('ascii',type3) OR FIND_IN_SET('mb2',type3)) +ORDER BY b; +SELECT COUNT(*) FROM t3; +COUNT(*) +64 +SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b; +HEX(c) comment +404040 [ascii,tail][ascii,tail][ascii,tail] +4040A140 [ascii,tail][ascii,tail][mb2,unassigned] +4040A1A3 [ascii,tail][ascii,tail][mb2] +4040FE40 [ascii,tail][ascii,tail][mb2] +40A14040 [ascii,tail][mb2,unassigned][ascii,tail] +40A140A140 [ascii,tail][mb2,unassigned][mb2,unassigned] +40A140A1A3 [ascii,tail][mb2,unassigned][mb2] +40A140FE40 [ascii,tail][mb2,unassigned][mb2] +40A1A340 [ascii,tail][mb2][ascii,tail] +40A1A3A140 [ascii,tail][mb2][mb2,unassigned] +40A1A3A1A3 [ascii,tail][mb2][mb2] +40A1A3FE40 [ascii,tail][mb2][mb2] +40FE4040 [ascii,tail][mb2][ascii,tail] +40FE40A140 [ascii,tail][mb2][mb2,unassigned] +40FE40A1A3 [ascii,tail][mb2][mb2] +40FE40FE40 [ascii,tail][mb2][mb2] +A1404040 [mb2,unassigned][ascii,tail][ascii,tail] +A14040A140 [mb2,unassigned][ascii,tail][mb2,unassigned] +A14040A1A3 [mb2,unassigned][ascii,tail][mb2] +A14040FE40 [mb2,unassigned][ascii,tail][mb2] +A140A14040 [mb2,unassigned][mb2,unassigned][ascii,tail] +A140A140A140 [mb2,unassigned][mb2,unassigned][mb2,unassigned] +A140A140A1A3 [mb2,unassigned][mb2,unassigned][mb2] +A140A140FE40 [mb2,unassigned][mb2,unassigned][mb2] +A140A1A340 [mb2,unassigned][mb2][ascii,tail] +A140A1A3A140 [mb2,unassigned][mb2][mb2,unassigned] +A140A1A3A1A3 [mb2,unassigned][mb2][mb2] +A140A1A3FE40 [mb2,unassigned][mb2][mb2] +A140FE4040 [mb2,unassigned][mb2][ascii,tail] +A140FE40A140 [mb2,unassigned][mb2][mb2,unassigned] +A140FE40A1A3 [mb2,unassigned][mb2][mb2] +A140FE40FE40 [mb2,unassigned][mb2][mb2] +A1A34040 [mb2][ascii,tail][ascii,tail] +A1A340A140 [mb2][ascii,tail][mb2,unassigned] +A1A340A1A3 [mb2][ascii,tail][mb2] +A1A340FE40 [mb2][ascii,tail][mb2] +A1A3A14040 [mb2][mb2,unassigned][ascii,tail] +A1A3A140A140 [mb2][mb2,unassigned][mb2,unassigned] +A1A3A140A1A3 [mb2][mb2,unassigned][mb2] +A1A3A140FE40 [mb2][mb2,unassigned][mb2] +A1A3A1A340 [mb2][mb2][ascii,tail] +A1A3A1A3A140 [mb2][mb2][mb2,unassigned] +A1A3A1A3A1A3 [mb2][mb2][mb2] +A1A3A1A3FE40 [mb2][mb2][mb2] +A1A3FE4040 [mb2][mb2][ascii,tail] +A1A3FE40A140 [mb2][mb2][mb2,unassigned] +A1A3FE40A1A3 [mb2][mb2][mb2] +A1A3FE40FE40 [mb2][mb2][mb2] +FE404040 [mb2][ascii,tail][ascii,tail] +FE4040A140 [mb2][ascii,tail][mb2,unassigned] +FE4040A1A3 [mb2][ascii,tail][mb2] +FE4040FE40 [mb2][ascii,tail][mb2] +FE40A14040 [mb2][mb2,unassigned][ascii,tail] +FE40A140A140 [mb2][mb2,unassigned][mb2,unassigned] +FE40A140A1A3 [mb2][mb2,unassigned][mb2] +FE40A140FE40 [mb2][mb2,unassigned][mb2] +FE40A1A340 [mb2][mb2][ascii,tail] +FE40A1A3A140 [mb2][mb2][mb2,unassigned] +FE40A1A3A1A3 [mb2][mb2][mb2] +FE40A1A3FE40 [mb2][mb2][mb2] +FE40FE4040 [mb2][mb2][ascii,tail] +FE40FE40A140 [mb2][mb2][mb2,unassigned] +FE40FE40A1A3 [mb2][mb2][mb2] +FE40FE40FE40 [mb2][mb2][mb2] +SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b; +HEX(c) HEX(b) comment +DELETE FROM t2 WHERE b IN (SELECT b FROM t3); +DELETE FROM t3; +# +# Sequences that start with a tail or a bad byte, +# or have a bad byte, all should be fixed. +# +INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 +WHERE type1='tail' OR type1='bad' OR type2='bad' OR type3='bad' +ORDER BY b; +Warnings: +Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 1 +Warning 1366 Incorrect string value: '\x80\xFF' for column 'c' at row 2 +Warning 1366 Incorrect string value: '\x81\xFF' for column 'c' at row 3 +Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 4 +Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 5 +Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 6 +Warning 1366 Incorrect string value: '\xFF@' for column 'c' at row 7 +Warning 1366 Incorrect string value: '\xFF\x80' for column 'c' at row 8 +Warning 1366 Incorrect string value: '\xFF\x81' for column 'c' at row 9 +Warning 1366 Incorrect string value: '\xFF\xA1@' for column 'c' at row 10 +Warning 1366 Incorrect string value: '\xFF\xA1\xA3' for column 'c' at row 11 +Warning 1366 Incorrect string value: '\xFF\xFE@' for column 'c' at row 12 +Warning 1366 Incorrect string value: '\xFF\xFF' for column 'c' at row 13 +Warning 1366 Incorrect string value: '\x80@@' for column 'c' at row 14 +Warning 1366 Incorrect string value: '\x80@\x80' for column 'c' at row 15 +Warning 1366 Incorrect string value: '\x80@\x81' for column 'c' at row 16 +Warning 1366 Incorrect string value: '\x80@\xA1@' for column 'c' at row 17 +Warning 1366 Incorrect string value: '\x80@\xA1\xA3' for column 'c' at row 18 +Warning 1366 Incorrect string value: '\x80@\xFE@' for column 'c' at row 19 +Warning 1366 Incorrect string value: '\x80@\xFF' for column 'c' at row 20 +Warning 1366 Incorrect string value: '\x80\x80@' for column 'c' at row 21 +Warning 1366 Incorrect string value: '\x80\x80\x80' for column 'c' at row 22 +Warning 1366 Incorrect string value: '\x80\x80\x81' for column 'c' at row 23 +Warning 1366 Incorrect string value: '\x80\x80\xA1@' for column 'c' at row 24 +Warning 1366 Incorrect string value: '\x80\x80\xA1\xA3' for column 'c' at row 25 +Warning 1366 Incorrect string value: '\x80\x80\xFE@' for column 'c' at row 26 +Warning 1366 Incorrect string value: '\x80\x80\xFF' for column 'c' at row 27 +Warning 1366 Incorrect string value: '\x80\x81@' for column 'c' at row 28 +Warning 1366 Incorrect string value: '\x80\x81\x80' for column 'c' at row 29 +Warning 1366 Incorrect string value: '\x80\x81\x81' for column 'c' at row 30 +Warning 1366 Incorrect string value: '\x80\x81\xA1@' for column 'c' at row 31 +Warning 1366 Incorrect string value: '\x80\x81\xA1\xA3' for column 'c' at row 32 +Warning 1366 Incorrect string value: '\x80\x81\xFE@' for column 'c' at row 33 +Warning 1366 Incorrect string value: '\x80\x81\xFF' for column 'c' at row 34 +Warning 1366 Incorrect string value: '\x80\xA1@@' for column 'c' at row 35 +Warning 1366 Incorrect string value: '\x80\xA1@\x80' for column 'c' at row 36 +Warning 1366 Incorrect string value: '\x80\xA1@\x81' for column 'c' at row 37 +Warning 1366 Incorrect string value: '\x80\xA1@\xA1@' for column 'c' at row 38 +Warning 1366 Incorrect string value: '\x80\xA1@\xA1\xA3' for column 'c' at row 39 +Warning 1366 Incorrect string value: '\x80\xA1@\xFE@' for column 'c' at row 40 +Warning 1366 Incorrect string value: '\x80\xA1@\xFF' for column 'c' at row 41 +Warning 1366 Incorrect string value: '\x80\xA1\xA3@' for column 'c' at row 42 +Warning 1366 Incorrect string value: '\x80\xA1\xA3\x80' for column 'c' at row 43 +Warning 1366 Incorrect string value: '\x80\xA1\xA3\x81' for column 'c' at row 44 +Warning 1366 Incorrect string value: '\x80\xA1\xA3\xA1@' for column 'c' at row 45 +Warning 1366 Incorrect string value: '\x80\xA1\xA3\xA1\xA3' for column 'c' at row 46 +Warning 1366 Incorrect string value: '\x80\xA1\xA3\xFE@' for column 'c' at row 47 +Warning 1366 Incorrect string value: '\x80\xA1\xA3\xFF' for column 'c' at row 48 +Warning 1366 Incorrect string value: '\x80\xFE@@' for column 'c' at row 49 +Warning 1366 Incorrect string value: '\x80\xFE@\x80' for column 'c' at row 50 +Warning 1366 Incorrect string value: '\x80\xFE@\x81' for column 'c' at row 51 +Warning 1366 Incorrect string value: '\x80\xFE@\xA1@' for column 'c' at row 52 +Warning 1366 Incorrect string value: '\x80\xFE@\xA1\xA3' for column 'c' at row 53 +Warning 1366 Incorrect string value: '\x80\xFE@\xFE@' for column 'c' at row 54 +Warning 1366 Incorrect string value: '\x80\xFE@\xFF' for column 'c' at row 55 +Warning 1366 Incorrect string value: '\x80\xFF@' for column 'c' at row 56 +Warning 1366 Incorrect string value: '\x80\xFF\x80' for column 'c' at row 57 +Warning 1366 Incorrect string value: '\x80\xFF\x81' for column 'c' at row 58 +Warning 1366 Incorrect string value: '\x80\xFF\xA1@' for column 'c' at row 59 +Warning 1366 Incorrect string value: '\x80\xFF\xA1\xA3' for column 'c' at row 60 +Warning 1366 Incorrect string value: '\x80\xFF\xFE@' for column 'c' at row 61 +Warning 1366 Incorrect string value: '\x80\xFF\xFF' for column 'c' at row 62 +Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 63 +Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 64 +SELECT COUNT(*) FROM t3; +COUNT(*) +163 +SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b; +HEX(c) comment +SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b; +HEX(c) HEX(b) comment +40403F 4040FF [ascii,tail][ascii,tail][bad] +403F3F 4080FF [ascii,tail][tail][bad] +403F3F 4081FF [ascii,tail][head,tail][bad] +40A1403F 40A140FF [ascii,tail][mb2,unassigned][bad] +40A1A33F 40A1A3FF [ascii,tail][mb2][bad] +40FE403F 40FE40FF [ascii,tail][mb2][bad] +403F40 40FF40 [ascii,tail][bad][ascii,tail] +403F3F 40FF80 [ascii,tail][bad][tail] +403F3F 40FF81 [ascii,tail][bad][head,tail] +403FA140 40FFA140 [ascii,tail][bad][mb2,unassigned] +403FA1A3 40FFA1A3 [ascii,tail][bad][mb2] +403FFE40 40FFFE40 [ascii,tail][bad][mb2] +403F3F 40FFFF [ascii,tail][bad][bad] +3F4040 804040 [tail][ascii,tail][ascii,tail] +3F403F 804080 [tail][ascii,tail][tail] +3F403F 804081 [tail][ascii,tail][head,tail] +3F40A140 8040A140 [tail][ascii,tail][mb2,unassigned] +3F40A1A3 8040A1A3 [tail][ascii,tail][mb2] +3F40FE40 8040FE40 [tail][ascii,tail][mb2] +3F403F 8040FF [tail][ascii,tail][bad] +3F3F40 808040 [tail][tail][ascii,tail] +3F3F3F 808080 [tail][tail][tail] +3F3F3F 808081 [tail][tail][head,tail] +3F3FA140 8080A140 [tail][tail][mb2,unassigned] +3F3FA1A3 8080A1A3 [tail][tail][mb2] +3F3FFE40 8080FE40 [tail][tail][mb2] +3F3F3F 8080FF [tail][tail][bad] +3F8140 808140 [tail][head,tail][ascii,tail] +3F8180 808180 [tail][head,tail][tail] +3F8181 808181 [tail][head,tail][head,tail] +3F81A140 8081A140 [tail][head,tail][mb2,unassigned] +3F81A13F 8081A1A3 [tail][head,tail][mb2] +3F81FE40 8081FE40 [tail][head,tail][mb2] +3F3F3F 8081FF [tail][head,tail][bad] +3FA14040 80A14040 [tail][mb2,unassigned][ascii,tail] +3FA1403F 80A14080 [tail][mb2,unassigned][tail] +3FA1403F 80A14081 [tail][mb2,unassigned][head,tail] +3FA140A140 80A140A140 [tail][mb2,unassigned][mb2,unassigned] +3FA140A1A3 80A140A1A3 [tail][mb2,unassigned][mb2] +3FA140FE40 80A140FE40 [tail][mb2,unassigned][mb2] +3FA1403F 80A140FF [tail][mb2,unassigned][bad] +3FA1A340 80A1A340 [tail][mb2][ascii,tail] +3FA1A33F 80A1A380 [tail][mb2][tail] +3FA1A33F 80A1A381 [tail][mb2][head,tail] +3FA1A3A140 80A1A3A140 [tail][mb2][mb2,unassigned] +3FA1A3A1A3 80A1A3A1A3 [tail][mb2][mb2] +3FA1A3FE40 80A1A3FE40 [tail][mb2][mb2] +3FA1A33F 80A1A3FF [tail][mb2][bad] +3FFE4040 80FE4040 [tail][mb2][ascii,tail] +3FFE403F 80FE4080 [tail][mb2][tail] +3FFE403F 80FE4081 [tail][mb2][head,tail] +3FFE40A140 80FE40A140 [tail][mb2][mb2,unassigned] +3FFE40A1A3 80FE40A1A3 [tail][mb2][mb2] +3FFE40FE40 80FE40FE40 [tail][mb2][mb2] +3FFE403F 80FE40FF [tail][mb2][bad] +3F3F40 80FF40 [tail][bad][ascii,tail] +3F3F3F 80FF80 [tail][bad][tail] +3F3F3F 80FF81 [tail][bad][head,tail] +3F3FA140 80FFA140 [tail][bad][mb2,unassigned] +3F3FA1A3 80FFA1A3 [tail][bad][mb2] +3F3FFE40 80FFFE40 [tail][bad][mb2] +3F3F3F 80FFFF [tail][bad][bad] +81403F 8140FF [head,tail][ascii,tail][bad] +81803F 8180FF [head,tail][tail][bad] +81813F 8181FF [head,tail][head,tail][bad] +81A1403F 81A140FF [head,tail][mb2,unassigned][bad] +81A13F3F 81A1A3FF [head,tail][mb2][bad] +81FE403F 81FE40FF [head,tail][mb2][bad] +3F3F40 81FF40 [head,tail][bad][ascii,tail] +3F3F3F 81FF80 [head,tail][bad][tail] +3F3F3F 81FF81 [head,tail][bad][head,tail] +3F3FA140 81FFA140 [head,tail][bad][mb2,unassigned] +3F3FA1A3 81FFA1A3 [head,tail][bad][mb2] +3F3FFE40 81FFFE40 [head,tail][bad][mb2] +3F3F3F 81FFFF [head,tail][bad][bad] +A140403F A14040FF [mb2,unassigned][ascii,tail][bad] +A1403F3F A14080FF [mb2,unassigned][tail][bad] +A1403F3F A14081FF [mb2,unassigned][head,tail][bad] +A140A1403F A140A140FF [mb2,unassigned][mb2,unassigned][bad] +A140A1A33F A140A1A3FF [mb2,unassigned][mb2][bad] +A140FE403F A140FE40FF [mb2,unassigned][mb2][bad] +A1403F40 A140FF40 [mb2,unassigned][bad][ascii,tail] +A1403F3F A140FF80 [mb2,unassigned][bad][tail] +A1403F3F A140FF81 [mb2,unassigned][bad][head,tail] +A1403FA140 A140FFA140 [mb2,unassigned][bad][mb2,unassigned] +A1403FA1A3 A140FFA1A3 [mb2,unassigned][bad][mb2] +A1403FFE40 A140FFFE40 [mb2,unassigned][bad][mb2] +A1403F3F A140FFFF [mb2,unassigned][bad][bad] +A1A3403F A1A340FF [mb2][ascii,tail][bad] +A1A33F3F A1A380FF [mb2][tail][bad] +A1A33F3F A1A381FF [mb2][head,tail][bad] +A1A3A1403F A1A3A140FF [mb2][mb2,unassigned][bad] +A1A3A1A33F A1A3A1A3FF [mb2][mb2][bad] +A1A3FE403F A1A3FE40FF [mb2][mb2][bad] +A1A33F40 A1A3FF40 [mb2][bad][ascii,tail] +A1A33F3F A1A3FF80 [mb2][bad][tail] +A1A33F3F A1A3FF81 [mb2][bad][head,tail] +A1A33FA140 A1A3FFA140 [mb2][bad][mb2,unassigned] +A1A33FA1A3 A1A3FFA1A3 [mb2][bad][mb2] +A1A33FFE40 A1A3FFFE40 [mb2][bad][mb2] +A1A33F3F A1A3FFFF [mb2][bad][bad] +FE40403F FE4040FF [mb2][ascii,tail][bad] +FE403F3F FE4080FF [mb2][tail][bad] +FE403F3F FE4081FF [mb2][head,tail][bad] +FE40A1403F FE40A140FF [mb2][mb2,unassigned][bad] +FE40A1A33F FE40A1A3FF [mb2][mb2][bad] +FE40FE403F FE40FE40FF [mb2][mb2][bad] +FE403F40 FE40FF40 [mb2][bad][ascii,tail] +FE403F3F FE40FF80 [mb2][bad][tail] +FE403F3F FE40FF81 [mb2][bad][head,tail] +FE403FA140 FE40FFA140 [mb2][bad][mb2,unassigned] +FE403FA1A3 FE40FFA1A3 [mb2][bad][mb2] +FE403FFE40 FE40FFFE40 [mb2][bad][mb2] +FE403F3F FE40FFFF [mb2][bad][bad] +3F4040 FF4040 [bad][ascii,tail][ascii,tail] +3F403F FF4080 [bad][ascii,tail][tail] +3F403F FF4081 [bad][ascii,tail][head,tail] +3F40A140 FF40A140 [bad][ascii,tail][mb2,unassigned] +3F40A1A3 FF40A1A3 [bad][ascii,tail][mb2] +3F40FE40 FF40FE40 [bad][ascii,tail][mb2] +3F403F FF40FF [bad][ascii,tail][bad] +3F3F40 FF8040 [bad][tail][ascii,tail] +3F3F3F FF8080 [bad][tail][tail] +3F3F3F FF8081 [bad][tail][head,tail] +3F3FA140 FF80A140 [bad][tail][mb2,unassigned] +3F3FA1A3 FF80A1A3 [bad][tail][mb2] +3F3FFE40 FF80FE40 [bad][tail][mb2] +3F3F3F FF80FF [bad][tail][bad] +3F8140 FF8140 [bad][head,tail][ascii,tail] +3F8180 FF8180 [bad][head,tail][tail] +3F8181 FF8181 [bad][head,tail][head,tail] +3F81A140 FF81A140 [bad][head,tail][mb2,unassigned] +3F81A13F FF81A1A3 [bad][head,tail][mb2] +3F81FE40 FF81FE40 [bad][head,tail][mb2] +3F3F3F FF81FF [bad][head,tail][bad] +3FA14040 FFA14040 [bad][mb2,unassigned][ascii,tail] +3FA1403F FFA14080 [bad][mb2,unassigned][tail] +3FA1403F FFA14081 [bad][mb2,unassigned][head,tail] +3FA140A140 FFA140A140 [bad][mb2,unassigned][mb2,unassigned] +3FA140A1A3 FFA140A1A3 [bad][mb2,unassigned][mb2] +3FA140FE40 FFA140FE40 [bad][mb2,unassigned][mb2] +3FA1403F FFA140FF [bad][mb2,unassigned][bad] +3FA1A340 FFA1A340 [bad][mb2][ascii,tail] +3FA1A33F FFA1A380 [bad][mb2][tail] +3FA1A33F FFA1A381 [bad][mb2][head,tail] +3FA1A3A140 FFA1A3A140 [bad][mb2][mb2,unassigned] +3FA1A3A1A3 FFA1A3A1A3 [bad][mb2][mb2] +3FA1A3FE40 FFA1A3FE40 [bad][mb2][mb2] +3FA1A33F FFA1A3FF [bad][mb2][bad] +3FFE4040 FFFE4040 [bad][mb2][ascii,tail] +3FFE403F FFFE4080 [bad][mb2][tail] +3FFE403F FFFE4081 [bad][mb2][head,tail] +3FFE40A140 FFFE40A140 [bad][mb2][mb2,unassigned] +3FFE40A1A3 FFFE40A1A3 [bad][mb2][mb2] +3FFE40FE40 FFFE40FE40 [bad][mb2][mb2] +3FFE403F FFFE40FF [bad][mb2][bad] +3F3F40 FFFF40 [bad][bad][ascii,tail] +3F3F3F FFFF80 [bad][bad][tail] +3F3F3F FFFF81 [bad][bad][head,tail] +3F3FA140 FFFFA140 [bad][bad][mb2,unassigned] +3F3FA1A3 FFFFA1A3 [bad][bad][mb2] +3F3FFE40 FFFFFE40 [bad][bad][mb2] +3F3F3F FFFFFF [bad][bad][bad] +DELETE FROM t2 WHERE b IN (SELECT b FROM t3); +DELETE FROM t3; +# +# Sequences that start with an ASCII or an MB2 character, +# followed by a pure non-ASCII tail, all should be fixed. +# +INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 +WHERE (FIND_IN_SET('mb2',type1) OR FIND_IN_SET('ascii',type1)) +AND type2='tail' +ORDER BY b; +Warnings: +Warning 1366 Incorrect string value: '\x80@' for column 'c' at row 1 +Warning 1366 Incorrect string value: '\x80\x80' for column 'c' at row 2 +Warning 1366 Incorrect string value: '\x80\x81' for column 'c' at row 3 +Warning 1366 Incorrect string value: '\x80\xA1@' for column 'c' at row 4 +Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column 'c' at row 5 +Warning 1366 Incorrect string value: '\x80\xFE@' for column 'c' at row 6 +Warning 1366 Incorrect string value: '\x80@' for column 'c' at row 7 +Warning 1366 Incorrect string value: '\x80\x80' for column 'c' at row 8 +Warning 1366 Incorrect string value: '\x80\x81' for column 'c' at row 9 +Warning 1366 Incorrect string value: '\x80\xA1@' for column 'c' at row 10 +Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column 'c' at row 11 +Warning 1366 Incorrect string value: '\x80\xFE@' for column 'c' at row 12 +Warning 1366 Incorrect string value: '\x80@' for column 'c' at row 13 +Warning 1366 Incorrect string value: '\x80\x80' for column 'c' at row 14 +Warning 1366 Incorrect string value: '\x80\x81' for column 'c' at row 15 +Warning 1366 Incorrect string value: '\x80\xA1@' for column 'c' at row 16 +Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column 'c' at row 17 +Warning 1366 Incorrect string value: '\x80\xFE@' for column 'c' at row 18 +Warning 1366 Incorrect string value: '\x80@' for column 'c' at row 19 +Warning 1366 Incorrect string value: '\x80\x80' for column 'c' at row 20 +Warning 1366 Incorrect string value: '\x80\x81' for column 'c' at row 21 +Warning 1366 Incorrect string value: '\x80\xA1@' for column 'c' at row 22 +Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column 'c' at row 23 +Warning 1366 Incorrect string value: '\x80\xFE@' for column 'c' at row 24 +SELECT COUNT(*) FROM t3; +COUNT(*) +24 +SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b; +HEX(c) comment +SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b; +HEX(c) HEX(b) comment +403F40 408040 [ascii,tail][tail][ascii,tail] +403F3F 408080 [ascii,tail][tail][tail] +403F3F 408081 [ascii,tail][tail][head,tail] +403FA140 4080A140 [ascii,tail][tail][mb2,unassigned] +403FA1A3 4080A1A3 [ascii,tail][tail][mb2] +403FFE40 4080FE40 [ascii,tail][tail][mb2] +A1403F40 A1408040 [mb2,unassigned][tail][ascii,tail] +A1403F3F A1408080 [mb2,unassigned][tail][tail] +A1403F3F A1408081 [mb2,unassigned][tail][head,tail] +A1403FA140 A14080A140 [mb2,unassigned][tail][mb2,unassigned] +A1403FA1A3 A14080A1A3 [mb2,unassigned][tail][mb2] +A1403FFE40 A14080FE40 [mb2,unassigned][tail][mb2] +A1A33F40 A1A38040 [mb2][tail][ascii,tail] +A1A33F3F A1A38080 [mb2][tail][tail] +A1A33F3F A1A38081 [mb2][tail][head,tail] +A1A33FA140 A1A380A140 [mb2][tail][mb2,unassigned] +A1A33FA1A3 A1A380A1A3 [mb2][tail][mb2] +A1A33FFE40 A1A380FE40 [mb2][tail][mb2] +FE403F40 FE408040 [mb2][tail][ascii,tail] +FE403F3F FE408080 [mb2][tail][tail] +FE403F3F FE408081 [mb2][tail][head,tail] +FE403FA140 FE4080A140 [mb2][tail][mb2,unassigned] +FE403FA1A3 FE4080A1A3 [mb2][tail][mb2] +FE403FFE40 FE4080FE40 [mb2][tail][mb2] +DELETE FROM t2 WHERE b IN (SELECT b FROM t3); +DELETE FROM t3; +# +# Sequences that consist of two ASCII or MB2 characters, +# followed by a pure non-ASCII tail, all should be fixed. +# +INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 +WHERE (FIND_IN_SET('mb2',type1) OR FIND_IN_SET('ascii',type1)) AND +(FIND_IN_SET('mb2',type2) OR FIND_IN_SET('ascii',type2)) AND +type3='tail' +ORDER BY b; +Warnings: +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 1 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 2 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 3 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 4 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 5 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 6 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 7 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 8 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 9 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 10 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 11 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 12 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 13 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 14 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 15 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 16 +SELECT COUNT(*) FROM t3; +COUNT(*) +16 +SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b; +HEX(c) comment +SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b; +HEX(c) HEX(b) comment +40403F 404080 [ascii,tail][ascii,tail][tail] +40A1403F 40A14080 [ascii,tail][mb2,unassigned][tail] +40A1A33F 40A1A380 [ascii,tail][mb2][tail] +40FE403F 40FE4080 [ascii,tail][mb2][tail] +A140403F A1404080 [mb2,unassigned][ascii,tail][tail] +A140A1403F A140A14080 [mb2,unassigned][mb2,unassigned][tail] +A140A1A33F A140A1A380 [mb2,unassigned][mb2][tail] +A140FE403F A140FE4080 [mb2,unassigned][mb2][tail] +A1A3403F A1A34080 [mb2][ascii,tail][tail] +A1A3A1403F A1A3A14080 [mb2][mb2,unassigned][tail] +A1A3A1A33F A1A3A1A380 [mb2][mb2][tail] +A1A3FE403F A1A3FE4080 [mb2][mb2][tail] +FE40403F FE404080 [mb2][ascii,tail][tail] +FE40A1403F FE40A14080 [mb2][mb2,unassigned][tail] +FE40A1A33F FE40A1A380 [mb2][mb2][tail] +FE40FE403F FE40FE4080 [mb2][mb2][tail] +DELETE FROM t2 WHERE b IN (SELECT b FROM t3); +DELETE FROM t3; +# +# Sequences that consist of two MB2 characters, +# followed by a non-ASCII head or tail, all should be fixed. +# +INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 +WHERE FIND_IN_SET('mb2',type1) AND FIND_IN_SET('mb2',type2) +AND NOT FIND_IN_SET('ascii',type3) +AND NOT FIND_IN_SET('mb2',type3) +ORDER BY b; +Warnings: +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 1 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 2 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 3 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 4 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 5 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 6 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 7 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 8 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 9 +SELECT COUNT(*) FROM t3; +COUNT(*) +9 +SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b; +HEX(c) comment +SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b; +HEX(c) HEX(b) comment +A140A1403F A140A14081 [mb2,unassigned][mb2,unassigned][head,tail] +A140A1A33F A140A1A381 [mb2,unassigned][mb2][head,tail] +A140FE403F A140FE4081 [mb2,unassigned][mb2][head,tail] +A1A3A1403F A1A3A14081 [mb2][mb2,unassigned][head,tail] +A1A3A1A33F A1A3A1A381 [mb2][mb2][head,tail] +A1A3FE403F A1A3FE4081 [mb2][mb2][head,tail] +FE40A1403F FE40A14081 [mb2][mb2,unassigned][head,tail] +FE40A1A33F FE40A1A381 [mb2][mb2][head,tail] +FE40FE403F FE40FE4081 [mb2][mb2][head,tail] +DELETE FROM t2 WHERE b IN (SELECT b FROM t3); +DELETE FROM t3; +# +# Sequences that consist of head + tail + MB2 should go without warnings +# +INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 +WHERE FIND_IN_SET('head',type1) +AND FIND_IN_SET('tail',type2) +AND FIND_IN_SET('mb2',type3) +ORDER BY b; +SELECT COUNT(*) FROM t3; +COUNT(*) +9 +SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b; +HEX(c) comment +8140A140 [head,tail][ascii,tail][mb2,unassigned] +8140A1A3 [head,tail][ascii,tail][mb2] +8140FE40 [head,tail][ascii,tail][mb2] +8180A140 [head,tail][tail][mb2,unassigned] +8180A1A3 [head,tail][tail][mb2] +8180FE40 [head,tail][tail][mb2] +8181A140 [head,tail][head,tail][mb2,unassigned] +8181A1A3 [head,tail][head,tail][mb2] +8181FE40 [head,tail][head,tail][mb2] +SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b; +HEX(c) HEX(b) comment +DELETE FROM t2 WHERE b IN (SELECT b FROM t3); +DELETE FROM t3; +# +# Sequences that consist of (ascii or mb2) + head + tail should go without warnings +# +INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 +WHERE (FIND_IN_SET('ascii',type1) OR FIND_IN_SET('mb2',type1)) +AND FIND_IN_SET('head',type2) +AND FIND_IN_SET('tail',type3) +ORDER BY b; +SELECT COUNT(*) FROM t3; +COUNT(*) +12 +SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b; +HEX(c) comment +408140 [ascii,tail][head,tail][ascii,tail] +408180 [ascii,tail][head,tail][tail] +408181 [ascii,tail][head,tail][head,tail] +A1408140 [mb2,unassigned][head,tail][ascii,tail] +A1408180 [mb2,unassigned][head,tail][tail] +A1408181 [mb2,unassigned][head,tail][head,tail] +A1A38140 [mb2][head,tail][ascii,tail] +A1A38180 [mb2][head,tail][tail] +A1A38181 [mb2][head,tail][head,tail] +FE408140 [mb2][head,tail][ascii,tail] +FE408180 [mb2][head,tail][tail] +FE408181 [mb2][head,tail][head,tail] +SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b; +HEX(c) HEX(b) comment +DELETE FROM t2 WHERE b IN (SELECT b FROM t3); +DELETE FROM t3; +INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 ORDER BY b; +Warnings: +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 1 +Warning 1366 Incorrect string value: '\xA3' for column 'c' at row 3 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 5 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 6 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 7 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 9 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 10 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 12 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 13 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 15 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 16 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 18 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 19 +Warning 1366 Incorrect string value: '\xA3' for column 'c' at row 27 +Warning 1366 Incorrect string value: '\x80' for column 'c' at row 30 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 31 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 35 +Warning 1366 Incorrect string value: '\xA3' for column 'c' at row 37 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 39 +Warning 1366 Incorrect string value: '\xA3' for column 'c' at row 41 +Warning 1366 Incorrect string value: '\x81' for column 'c' at row 43 +Warning 1366 Incorrect string value: '\xA3' for column 'c' at row 45 +SELECT COUNT(*) FROM t3; +COUNT(*) +46 +SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b; +HEX(c) comment +4081A140 [ascii,tail][head,tail][mb2,unassigned] +4081FE40 [ascii,tail][head,tail][mb2] +814040 [head,tail][ascii,tail][ascii,tail] +818040 [head,tail][tail][ascii,tail] +818140 [head,tail][head,tail][ascii,tail] +81A14040 [head,tail][mb2,unassigned][ascii,tail] +81A140A140 [head,tail][mb2,unassigned][mb2,unassigned] +81A140A1A3 [head,tail][mb2,unassigned][mb2] +81A140FE40 [head,tail][mb2,unassigned][mb2] +81A1A340 [head,tail][mb2][ascii,tail] +81A1A380 [head,tail][mb2][tail] +81A1A381 [head,tail][mb2][head,tail] +81A1A3A140 [head,tail][mb2][mb2,unassigned] +81A1A3FE40 [head,tail][mb2][mb2] +81FE4040 [head,tail][mb2][ascii,tail] +81FE40A140 [head,tail][mb2][mb2,unassigned] +81FE40A1A3 [head,tail][mb2][mb2] +81FE40FE40 [head,tail][mb2][mb2] +A14081A140 [mb2,unassigned][head,tail][mb2,unassigned] +A14081FE40 [mb2,unassigned][head,tail][mb2] +A1A381A140 [mb2][head,tail][mb2,unassigned] +A1A381FE40 [mb2][head,tail][mb2] +FE4081A140 [mb2][head,tail][mb2,unassigned] +FE4081FE40 [mb2][head,tail][mb2] +SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b; +HEX(c) HEX(b) comment +40403F 404081 [ascii,tail][ascii,tail][head,tail] +4081A13F 4081A1A3 [ascii,tail][head,tail][mb2] +40A1403F 40A14081 [ascii,tail][mb2,unassigned][head,tail] +40A1A33F 40A1A381 [ascii,tail][mb2][head,tail] +40FE403F 40FE4081 [ascii,tail][mb2][head,tail] +81403F 814080 [head,tail][ascii,tail][tail] +81403F 814081 [head,tail][ascii,tail][head,tail] +81803F 818080 [head,tail][tail][tail] +81803F 818081 [head,tail][tail][head,tail] +81813F 818180 [head,tail][head,tail][tail] +81813F 818181 [head,tail][head,tail][head,tail] +81A1403F 81A14080 [head,tail][mb2,unassigned][tail] +81A1403F 81A14081 [head,tail][mb2,unassigned][head,tail] +81A1A3A13F 81A1A3A1A3 [head,tail][mb2][mb2] +81FE403F 81FE4080 [head,tail][mb2][tail] +81FE403F 81FE4081 [head,tail][mb2][head,tail] +A140403F A1404081 [mb2,unassigned][ascii,tail][head,tail] +A14081A13F A14081A1A3 [mb2,unassigned][head,tail][mb2] +A1A3403F A1A34081 [mb2][ascii,tail][head,tail] +A1A381A13F A1A381A1A3 [mb2][head,tail][mb2] +FE40403F FE404081 [mb2][ascii,tail][head,tail] +FE4081A13F FE4081A1A3 [mb2][head,tail][mb2] +DROP TABLE t3; +DROP TABLE t2; +DROP TABLE t1; +# +# END OF MDEV-6566 Different INSERT behaviour on bad bytes with and without character set conversion +# +# +# MDEV-7661 Unexpected result for: CAST(0xHHHH AS CHAR CHARACTER SET xxx) for incorrect byte sequences +# +SELECT HEX(CAST(0xA341 AS CHAR CHARACTER SET gb2312)); +HEX(CAST(0xA341 AS CHAR CHARACTER SET gb2312)) +3F41 +Warnings: +Warning 1300 Invalid gb2312 character string: '\xA3A' +SELECT HEX(CONVERT(CAST(0xA341 AS CHAR CHARACTER SET gb2312) USING utf8)); +HEX(CONVERT(CAST(0xA341 AS CHAR CHARACTER SET gb2312) USING utf8)) +3F41 +Warnings: +Warning 1300 Invalid gb2312 character string: '\xA3A' +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result index eee915267d5..c6f190101f6 100644 --- a/mysql-test/r/ctype_latin1.result +++ b/mysql-test/r/ctype_latin1.result @@ -518,8 +518,8 @@ STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)) CREATE TABLE t1 AS SELECT REPEAT(' ', 64) AS subject, REPEAT(' ',64) AS pattern LIMIT 0; SHOW COLUMNS FROM t1; Field Type Null Key Default Extra -subject varchar(64) NO -pattern varchar(64) NO +subject varchar(64) NO NULL +pattern varchar(64) NO NULL INSERT INTO t1 VALUES (_utf8'2001÷01÷01',_utf8'%Y÷%m÷%d'); SELECT HEX(subject),HEX(pattern),STR_TO_DATE(subject, pattern) FROM t1; HEX(subject) HEX(pattern) STR_TO_DATE(subject, pattern) @@ -689,7 +689,7 @@ create table t1 as select concat(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select hex(c1) from t1; hex(c1) @@ -702,7 +702,7 @@ create table t1 as select concat(18446744073709551615) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(20) NOT NULL DEFAULT '' + `c1` varchar(20) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select hex(c1) from t1; hex(c1) @@ -715,7 +715,7 @@ create table t1 as select concat(1.1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) NOT NULL DEFAULT '' + `c1` varchar(4) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select hex(c1) from t1; hex(c1) @@ -728,7 +728,7 @@ create table t1 as select concat(1+2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) NOT NULL DEFAULT '' + `c1` varchar(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1-2)); @@ -738,7 +738,7 @@ create table t1 as select concat(1-2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) NOT NULL DEFAULT '' + `c1` varchar(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1*2)); @@ -748,7 +748,7 @@ create table t1 as select concat(1*2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) NOT NULL DEFAULT '' + `c1` varchar(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1/2)); @@ -788,7 +788,7 @@ create table t1 as select concat(-1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) NOT NULL DEFAULT '' + `c1` varchar(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(-(1+2))); @@ -798,7 +798,7 @@ create table t1 as select concat(-(1+2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) NOT NULL DEFAULT '' + `c1` varchar(4) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1|2)); @@ -808,7 +808,7 @@ create table t1 as select concat(1|2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) NOT NULL DEFAULT '' + `c1` varchar(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1&2)); @@ -818,7 +818,7 @@ create table t1 as select concat(1&2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) NOT NULL DEFAULT '' + `c1` varchar(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(bit_count(12))); @@ -828,7 +828,7 @@ create table t1 as select concat(bit_count(12)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) NOT NULL DEFAULT '' + `c1` varchar(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(2<<1)); @@ -838,7 +838,7 @@ create table t1 as select concat(2<<1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) NOT NULL DEFAULT '' + `c1` varchar(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(2>>1)); @@ -848,7 +848,7 @@ create table t1 as select concat(2>>1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) NOT NULL DEFAULT '' + `c1` varchar(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(~0)); @@ -858,7 +858,7 @@ create table t1 as select concat(~0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) NOT NULL DEFAULT '' + `c1` varchar(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(3^2)); @@ -868,7 +868,7 @@ create table t1 as select concat(3^2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) NOT NULL DEFAULT '' + `c1` varchar(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(abs(-2))); @@ -878,7 +878,7 @@ create table t1 as select concat(abs(-2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) NOT NULL DEFAULT '' + `c1` varchar(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(left(concat(exp(2)),1)); @@ -1008,7 +1008,7 @@ create table t1 as select concat(degrees(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) NOT NULL DEFAULT '' + `c1` varchar(23) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(radians(0))); @@ -1018,7 +1018,7 @@ create table t1 as select concat(radians(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) NOT NULL DEFAULT '' + `c1` varchar(23) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ceiling(0.5))); @@ -1028,7 +1028,7 @@ create table t1 as select concat(ceiling(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) NOT NULL DEFAULT '' + `c1` varchar(4) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(floor(0.5))); @@ -1038,7 +1038,7 @@ create table t1 as select concat(floor(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) NOT NULL DEFAULT '' + `c1` varchar(4) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(round(0.5))); @@ -1048,7 +1048,7 @@ create table t1 as select concat(round(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) NOT NULL DEFAULT '' + `c1` varchar(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(sign(0.5))); @@ -1058,14 +1058,14 @@ create table t1 as select concat(sign(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) NOT NULL DEFAULT '' + `c1` varchar(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(rand()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) NOT NULL DEFAULT '' + `c1` varchar(23) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(length('a'))); @@ -1075,7 +1075,7 @@ create table t1 as select concat(length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) NOT NULL DEFAULT '' + `c1` varchar(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(char_length('a'))); @@ -1085,7 +1085,7 @@ create table t1 as select concat(char_length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) NOT NULL DEFAULT '' + `c1` varchar(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(bit_length('a'))); @@ -1095,7 +1095,7 @@ create table t1 as select concat(bit_length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) NOT NULL DEFAULT '' + `c1` varchar(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(coercibility('a'))); @@ -1105,7 +1105,7 @@ create table t1 as select concat(coercibility('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) NOT NULL DEFAULT '' + `c1` varchar(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(locate('a','a'))); @@ -1115,7 +1115,7 @@ create table t1 as select concat(locate('a','a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(11) NOT NULL DEFAULT '' + `c1` varchar(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(field('c','a','b','c'))); @@ -1125,7 +1125,7 @@ create table t1 as select concat(field('c','a','b','c')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) NOT NULL DEFAULT '' + `c1` varchar(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ascii(61))); @@ -1135,7 +1135,7 @@ create table t1 as select concat(ascii(61)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) NOT NULL DEFAULT '' + `c1` varchar(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ord(61))); @@ -1145,7 +1145,7 @@ create table t1 as select concat(ord(61)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) NOT NULL DEFAULT '' + `c1` varchar(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(find_in_set('b','a,b,c,d'))); @@ -1155,7 +1155,7 @@ create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) NOT NULL DEFAULT '' + `c1` varchar(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select md5('a'), hex(md5('a')); @@ -1165,7 +1165,7 @@ create table t1 as select md5('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(32) NOT NULL DEFAULT '' + `c1` varchar(32) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select old_password('a'), hex(old_password('a')); @@ -1175,7 +1175,7 @@ create table t1 as select old_password('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(16) NOT NULL DEFAULT '' + `c1` varchar(16) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select password('a'), hex(password('a')); @@ -1185,7 +1185,7 @@ create table t1 as select password('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(41) NOT NULL DEFAULT '' + `c1` varchar(41) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select sha('a'), hex(sha('a')); @@ -1195,7 +1195,7 @@ create table t1 as select sha('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(40) NOT NULL DEFAULT '' + `c1` varchar(40) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select sha1('a'), hex(sha1('a')); @@ -1205,7 +1205,7 @@ create table t1 as select sha1('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(40) NOT NULL DEFAULT '' + `c1` varchar(40) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(cast('-1' as signed))); @@ -1215,7 +1215,7 @@ create table t1 as select concat(cast('-1' as signed)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) NOT NULL DEFAULT '' + `c1` varchar(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(cast('1' as unsigned))); @@ -1225,7 +1225,7 @@ create table t1 as select concat(cast('1' as unsigned)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(cast(1/2 as decimal(5,5)))); @@ -1284,7 +1284,7 @@ create table t1 as select concat(least(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) NOT NULL DEFAULT '' + `c1` varchar(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(greatest(1,2))); @@ -1294,7 +1294,7 @@ create table t1 as select concat(greatest(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) NOT NULL DEFAULT '' + `c1` varchar(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(case when 11 then 22 else 33 end)); @@ -1304,7 +1304,7 @@ create table t1 as select concat(case when 11 then 22 else 33 end) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) NOT NULL DEFAULT '' + `c1` varchar(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(coalesce(1,2))); @@ -1314,7 +1314,7 @@ create table t1 as select concat(coalesce(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat_ws(1,2,3)); @@ -1324,7 +1324,7 @@ create table t1 as select concat_ws(1,2,3) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) NOT NULL DEFAULT '' + `c1` varchar(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(group_concat(1,2,3)); @@ -1352,7 +1352,7 @@ create table t1 as select concat(last_insert_id()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) NOT NULL DEFAULT '' + `c1` varchar(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(benchmark(0,0))); @@ -1362,7 +1362,7 @@ create table t1 as select concat(benchmark(0,0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(sleep(0))); @@ -1372,7 +1372,7 @@ create table t1 as select concat(sleep(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) NOT NULL DEFAULT '' + `c1` varchar(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(is_free_lock('xxxx'))); @@ -1406,7 +1406,7 @@ create table t1 as select concat(crc32('')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) NOT NULL DEFAULT '' + `c1` varchar(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(uncompressed_length(''))); @@ -1423,7 +1423,7 @@ create table t1 as select concat(connection_id()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) NOT NULL DEFAULT '' + `c1` varchar(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(inet_aton('127.1.1.1'))); @@ -1459,7 +1459,7 @@ create table t1 as select concat(row_count()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) NOT NULL DEFAULT '' + `c1` varchar(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(found_rows())); @@ -1469,21 +1469,21 @@ create table t1 as select concat(found_rows()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) NOT NULL DEFAULT '' + `c1` varchar(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(uuid_short()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) NOT NULL DEFAULT '' + `c1` varchar(21) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(uuid()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(36) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select coercibility(uuid()), coercibility(cast('a' as char character set latin1)); @@ -1496,7 +1496,7 @@ create table t1 as select concat(uuid(), cast('a' as char character set latin1)) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(37) NOT NULL DEFAULT '' + `c1` varchar(37) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1; @@ -1516,8 +1516,8 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '', - `c2` int(1) NOT NULL DEFAULT '0' + `c1` varchar(1) NOT NULL, + `c2` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; set @a2=1; @@ -1574,8 +1574,8 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) NOT NULL DEFAULT '', - `c2` decimal(2,1) NOT NULL DEFAULT '0.0' + `c1` varchar(4) NOT NULL, + `c2` decimal(2,1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; set @a2=1.1; @@ -1613,7 +1613,7 @@ create table t1 as select concat('a'='a' IS TRUE) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a'='a' IS NOT TRUE)); @@ -1623,7 +1623,7 @@ create table t1 as select concat('a'='a' IS NOT TRUE) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(NOT 'a'='a')); @@ -1633,7 +1633,7 @@ create table t1 as select concat(NOT 'a'='a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' IS NULL)); @@ -1643,7 +1643,7 @@ create table t1 as select concat('a' IS NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' IS NOT NULL)); @@ -1653,7 +1653,7 @@ create table t1 as select concat('a' IS NOT NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' rlike 'a')); @@ -1663,7 +1663,7 @@ create table t1 as select concat('a' IS NOT NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(strcmp('a','b'))); @@ -1673,7 +1673,7 @@ create table t1 as select concat(strcmp('a','b')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) NOT NULL DEFAULT '' + `c1` varchar(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' like 'a')); @@ -1683,7 +1683,7 @@ create table t1 as select concat('a' like 'b') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' between 'b' and 'c')); @@ -1693,7 +1693,7 @@ create table t1 as select concat('a' between 'b' and 'c') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' in ('a','b'))); @@ -1703,7 +1703,7 @@ create table t1 as select concat('a' in ('a','b')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(interval(23, 1, 15, 17, 30, 44, 200))); @@ -1713,7 +1713,7 @@ create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) NOT NULL DEFAULT '' + `c1` varchar(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a varchar(10), fulltext key(a)); @@ -1735,7 +1735,7 @@ create table t1 as select ifnull(1,'a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ifnull(1,1))); @@ -1745,7 +1745,7 @@ create table t1 as select concat(ifnull(1,1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ifnull(1.1,1.1))); @@ -1755,7 +1755,7 @@ create table t1 as select concat(ifnull(1.1,1.1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) NOT NULL DEFAULT '' + `c1` varchar(4) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(if(1,'b',1)); @@ -1765,7 +1765,7 @@ create table t1 as select if(1,'b',1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(if(1,1,'b')); @@ -1775,7 +1775,7 @@ create table t1 as select if(1,1,'b') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(if(1,1,1))); @@ -1785,7 +1785,7 @@ create table t1 as select concat(if(1,1,1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(nullif(1,2))); @@ -1865,7 +1865,7 @@ create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) DEFAULT NULL + `c1` varchar(2) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); @@ -1875,7 +1875,7 @@ create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) DEFAULT NULL + `c1` varchar(2) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); @@ -1950,7 +1950,7 @@ create table t1 as select concat(period_add(200902, 2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) NOT NULL DEFAULT '' + `c1` varchar(6) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(period_diff(200902, 200802))); @@ -1962,7 +1962,7 @@ Warning 1265 Data truncated for column 'c1' at row 1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) NOT NULL DEFAULT '' + `c1` varchar(6) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(to_days(20090224))); @@ -2159,21 +2159,21 @@ create table t1 as select concat(curdate()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) NOT NULL DEFAULT '' + `c1` varchar(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(utc_date()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) NOT NULL DEFAULT '' + `c1` varchar(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(curtime()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) NOT NULL DEFAULT '' + `c1` varchar(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select repeat('a',20) as c1 limit 0; @@ -2189,7 +2189,7 @@ create table t1 as select concat(utc_time()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) NOT NULL DEFAULT '' + `c1` varchar(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(sec_to_time(2378))); @@ -2282,21 +2282,21 @@ create table t1 as select concat(now()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) NOT NULL DEFAULT '' + `c1` varchar(19) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(utc_timestamp()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) NOT NULL DEFAULT '' + `c1` varchar(19) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(sysdate()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) NOT NULL DEFAULT '' + `c1` varchar(19) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(addtime('00:00:00','11:22:33'))); @@ -2336,7 +2336,7 @@ create table t1 as select export_set(1,2,3,4,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(127) NOT NULL DEFAULT '' + `c1` varchar(127) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(insert(1133,3,0,22)); @@ -2346,7 +2346,7 @@ create table t1 as select insert(1133,3,0,22) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) NOT NULL DEFAULT '' + `c1` varchar(6) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(lcase(123)); @@ -2356,7 +2356,7 @@ create table t1 as select lcase(123) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) NOT NULL DEFAULT '' + `c1` varchar(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(left(123,1)); @@ -2366,7 +2366,7 @@ create table t1 as select left(123,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(lower(123)); @@ -2376,7 +2376,7 @@ create table t1 as select lower(123) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) NOT NULL DEFAULT '' + `c1` varchar(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(lpad(1,2,0)); @@ -2386,7 +2386,7 @@ create table t1 as select lpad(1,2,0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) NOT NULL DEFAULT '' + `c1` varchar(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(ltrim(1)); @@ -2396,7 +2396,7 @@ create table t1 as select ltrim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(mid(1,1,1)); @@ -2406,7 +2406,7 @@ create table t1 as select mid(1,1,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(repeat(1,2)); @@ -2416,7 +2416,7 @@ create table t1 as select repeat(1,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) NOT NULL DEFAULT '' + `c1` varchar(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(replace(1,1,2)); @@ -2426,7 +2426,7 @@ create table t1 as select replace(1,1,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(reverse(12)); @@ -2436,7 +2436,7 @@ create table t1 as select reverse(12) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) NOT NULL DEFAULT '' + `c1` varchar(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(right(123,1)); @@ -2446,7 +2446,7 @@ create table t1 as select right(123,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(rpad(1,2,0)); @@ -2456,7 +2456,7 @@ create table t1 as select rpad(1,2,0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) NOT NULL DEFAULT '' + `c1` varchar(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(rtrim(1)); @@ -2466,7 +2466,7 @@ create table t1 as select rtrim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(soundex(1)); @@ -2476,7 +2476,7 @@ create table t1 as select soundex(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) NOT NULL DEFAULT '' + `c1` varchar(4) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(substring(1,1,1)); @@ -2486,7 +2486,7 @@ create table t1 as select substring(1,1,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(trim(1)); @@ -2496,7 +2496,7 @@ create table t1 as select trim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(ucase(1)); @@ -2506,7 +2506,7 @@ create table t1 as select ucase(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(upper(1)); @@ -2516,14 +2516,14 @@ create table t1 as select upper(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) NOT NULL DEFAULT '' + `c1` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select repeat(' ', 64) as a limit 0; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(64) NOT NULL DEFAULT '' + `a` varchar(64) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ("1.1"), ("2.1"); select a, hex(a) from t1; @@ -2752,7 +2752,7 @@ t2 CREATE TABLE `t2` ( `concat(a)` varbinary(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1, t2; -create table t1 (a timestamp); +create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values (0); insert into t1 values (20010203040506); insert into t1 values (19800203040506); @@ -2773,7 +2773,7 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(19) NOT NULL DEFAULT '' + `concat(a)` varchar(19) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1, t2; create table t1 (a date); @@ -3064,7 +3064,7 @@ hex(a) 0000000000000001 drop table t1; drop view v1; -create table t1 (a timestamp); +create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values (0); insert into t1 values (20010203040506); insert into t1 values (19800203040506); @@ -3313,7 +3313,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `CONCAT(a)` varchar(9) DEFAULT NULL, - `IFNULL(a,'')` varchar(9) NOT NULL DEFAULT '', + `IFNULL(a,'')` varchar(9) NOT NULL, `IF(a,a,'')` varchar(9) DEFAULT NULL, `CASE WHEN a THEN a ELSE '' END` varchar(9) DEFAULT NULL, `COALESCE(a,'')` varchar(9) DEFAULT NULL @@ -3323,14 +3323,14 @@ CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `CONCAT_WS(1,2,3)` varchar(3) NOT NULL DEFAULT '' + `CONCAT_WS(1,2,3)` varchar(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `INSERT(1133,3,0,22)` varchar(6) NOT NULL DEFAULT '' + `INSERT(1133,3,0,22)` varchar(6) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT LCASE(a) FROM t1; @@ -3351,35 +3351,35 @@ CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `REPEAT(1,2)` varchar(2) NOT NULL DEFAULT '' + `REPEAT(1,2)` varchar(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `LEFT(123,2)` varchar(2) NOT NULL DEFAULT '' + `LEFT(123,2)` varchar(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `RIGHT(123,2)` varchar(2) NOT NULL DEFAULT '' + `RIGHT(123,2)` varchar(2) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `LTRIM(123)` varchar(3) NOT NULL DEFAULT '' + `LTRIM(123)` varchar(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `RTRIM(123)` varchar(3) NOT NULL DEFAULT '' + `RTRIM(123)` varchar(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1; @@ -3393,35 +3393,35 @@ CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `REPLACE(111,2,3)` varchar(3) NOT NULL DEFAULT '' + `REPLACE(111,2,3)` varchar(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `SUBSTRING_INDEX(111,111,1)` varchar(3) NOT NULL DEFAULT '' + `SUBSTRING_INDEX(111,111,1)` varchar(3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `MAKE_SET(111,222,3)` varchar(5) NOT NULL DEFAULT '' + `MAKE_SET(111,222,3)` varchar(5) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `SOUNDEX(1)` varchar(4) NOT NULL DEFAULT '' + `SOUNDEX(1)` varchar(4) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8); SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `EXPORT_SET(1,'Y','N','',8)` varchar(64) NOT NULL DEFAULT '' + `EXPORT_SET(1,'Y','N','',8)` varchar(64) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; DROP TABLE t1; @@ -3445,7 +3445,7 @@ id select_type table type possible_keys key key_len ref rows Extra ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL; EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range date_column date_column 9 NULL 1 Using index condition +1 SIMPLE t1 range date_column date_column 6 NULL 1 Using index condition DROP TABLE t1; # # Bug #31384 DATE_ADD() and DATE_SUB() return binary data @@ -3585,7 +3585,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `d` date DEFAULT NULL, - `bad` varchar(10) DEFAULT NULL + `bad` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1, t2; SET NAMES latin1; @@ -3629,7 +3629,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) NOT NULL DEFAULT '' + `a` varchar(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -3649,7 +3649,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) NOT NULL DEFAULT '' + `a` varchar(5) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -3873,7 +3873,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -3893,7 +3893,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -4117,7 +4117,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -4137,7 +4137,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -4361,7 +4361,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varbinary(1) NOT NULL DEFAULT '' + `a` varbinary(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -4381,7 +4381,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varbinary(5) NOT NULL DEFAULT '' + `a` varbinary(5) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -7676,7 +7676,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) NOT NULL DEFAULT '' + `c1` varchar(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; @@ -7699,7 +7699,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) NOT NULL DEFAULT '' + `c1` varchar(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); @@ -7722,7 +7722,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) NOT NULL DEFAULT '' + `c1` varchar(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); @@ -7745,7 +7745,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) NOT NULL DEFAULT '' + `c1` varchar(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); @@ -7764,6 +7764,31 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) DROP TABLE t1; +# +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 1 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 1 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a ')))) +DROP TABLE t1; +# +# End of MDEV-8694 +# SET NAMES latin1 COLLATE latin1_bin; # # MDEV-7149 Constant condition propagation erroneously applied for LIKE @@ -7772,7 +7797,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; @@ -7795,7 +7820,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); @@ -7818,7 +7843,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); @@ -7841,7 +7866,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); @@ -7861,6 +7886,31 @@ Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) DROP TABLE t1; # +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 1 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 1 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a ')))) +DROP TABLE t1; +# +# End of MDEV-8694 +# +# # MDEV-6752 Trailing incomplete characters are not replaced to question marks on conversion # SET NAMES utf8, character_set_connection=latin1; @@ -7924,3 +7974,221 @@ _latin1 0x7E _latin1 X'7E' _latin1 B'01111110' # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-8661 Wrong result for SELECT..WHERE a='a' AND a='a' COLLATE latin1_bin +# +SET NAMES latin1; +CREATE TABLE t1 (a CHAR(10)); +INSERT INTO t1 VALUES ('a'),('A'); +SELECT * FROM t1 WHERE a='a' AND a='a' COLLATE latin1_bin; +a +a +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci); +INSERT INTO t1 VALUES ('a'),('A'); +SELECT * FROM t1 WHERE a='a' COLLATE latin1_bin AND a='A' COLLATE latin1_swedish_ci; +a +a +DROP TABLE t1; +# +# MDEV-8679 Equal field propagation is not used for VARCHAR when it safely could +# +CREATE TABLE t1 (a VARCHAR(10)); +INSERT INTO t1 VALUES ('10'),('11'),('12'); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='10' AND IF(a='10',1,0)=1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = '10') +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='10' AND CASE WHEN a='10' THEN 1 ELSE 0 END; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = '10') +DROP TABLE t1; +# +# MDEV-8680 Wrong result for SELECT..WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a' +# +SET NAMES latin1; +CREATE TABLE t1 (a VARCHAR(10)); +INSERT INTO t1 VALUES ('a'),('A'); +SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b'); +a +a +SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a'; +a +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (`test`.`t1`.`a` in (<cache>(('a' collate latin1_bin)),'b'))) +DROP TABLE t1; +# +# MDEV-8698 Wrong result for SELECT..WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin; +# +SET NAMES latin1; +CREATE TABLE t1 (a VARCHAR(10)); +INSERT INTO t1 VALUES ('a'),('A'),('b'),('B'),('c'),('C'); +SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin; +a +a +b +c +SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin AND a='a'; +a +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 6 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (`test`.`t1`.`a` between 'a' and <cache>(('c' collate latin1_bin)))) +DROP TABLE t1; +# +# MDEV-8707 Wrong result for SELECT..WHERE varchar_column=DATE'2001-01-01' AND varchar_column='2001-01-01' +# +SET NAMES latin1; +CREATE TABLE t1 (a VARCHAR(40)); +INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-01x'); +SELECT * FROM t1 WHERE a=DATE'2001-01-01' AND a='2001-01-01'; +a +2001-01-01 +SELECT * FROM t1 WHERE a='2001-01-01' AND a=DATE'2001-01-01'; +a +2001-01-01 +SELECT * FROM t1 WHERE (a,a)=('2001-01-01x',DATE'2001-01-01'); +a +2001-01-01x +Warnings: +Warning 1292 Truncated incorrect date value: '2001-01-01x' +SELECT * FROM t1 WHERE (a,a)=(DATE'2001-01-01','2001-01-01x'); +a +2001-01-01x +Warnings: +Warning 1292 Truncated incorrect date value: '2001-01-01x' +SELECT * FROM t1 WHERE (a,a)=('2001-01-01',DATE'2001-01-01'); +a +2001-01-01 +SELECT * FROM t1 WHERE (a,a)=(DATE'2001-01-01','2001-01-01'); +a +2001-01-01 +DROP TABLE t1; +CREATE TABLE t1 (a ENUM('2001-01-01','2001-01-01x')); +INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-01x'); +SELECT * FROM t1 WHERE a=DATE'2001-01-01' AND a='2001-01-01'; +a +2001-01-01 +SELECT * FROM t1 WHERE a='2001-01-01' AND a=DATE'2001-01-01'; +a +2001-01-01 +SELECT * FROM t1 WHERE (a,a)=('2001-01-01x',DATE'2001-01-01'); +a +2001-01-01x +Warnings: +Warning 1292 Truncated incorrect date value: '2001-01-01x' +SELECT * FROM t1 WHERE (a,a)=(DATE'2001-01-01','2001-01-01x'); +a +2001-01-01x +Warnings: +Warning 1292 Truncated incorrect date value: '2001-01-01x' +SELECT * FROM t1 WHERE (a,a)=('2001-01-01',DATE'2001-01-01'); +a +2001-01-01 +SELECT * FROM t1 WHERE (a,a)=(DATE'2001-01-01','2001-01-01'); +a +2001-01-01 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(40),b VARCHAR(40)); +INSERT INTO t1 VALUES ('2001-01-01','2001-01-01x'); +SELECT * FROM t1 WHERE a=b AND a=DATE'2001-01-01'; +a b +DROP TABLE t1; +CREATE TABLE t1 (a ENUM('2001-01-01','2001-01-01x'),b ENUM('2001-01-01','2001-01-01x')); +INSERT INTO t1 VALUES ('2001-01-01','2001-01-01x'); +SELECT * FROM t1 WHERE a=b AND a=DATE'2001-01-01'; +a b +DROP TABLE t1; +# +# MDEV-8695 Wrong result for SELECT..WHERE varchar_column='a' AND CRC32(varchar_column)=3904355907 +# +CREATE TABLE t1 (a VARCHAR(10) COLLATE latin1_bin); +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE CRC32(a)=3904355907; +a LENGTH(a) CRC32(a) +a 1 3904355907 +SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=3904355907; +a LENGTH(a) CRC32(a) +a 1 3904355907 +# 'a' should not be propagated into CRC32(a) +EXPLAIN EXTENDED SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=3904355907; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)`,crc32(`test`.`t1`.`a`) AS `CRC32(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (crc32(`test`.`t1`.`a`) = 3904355907)) +SELECT a, HEX(a) FROM t1 WHERE HEX(a)='61'; +a HEX(a) +a 61 +SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61'; +a HEX(a) +a 61 +# 'a' should not be propagated into HEX(a) +EXPLAIN EXTENDED SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,hex(`test`.`t1`.`a`) AS `HEX(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (hex(`test`.`t1`.`a`) = '61')) +SELECT * FROM t1 WHERE a='a'; +a +a +a +SELECT * FROM t1 WHERE LENGTH(a)=2; +a +a +SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2; +a +a +# 'a' should not be propagated into LENGTH(a) +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (length(`test`.`t1`.`a`) = 2)) +DROP TABLE t1; +# +# MDEV-8712 Wrong result for SELECT..WHERE latin1_bin_column=_latin1'a' AND latin1_bin_column='A' +# +SET NAMES latin1; +CREATE TABLE t1 (a VARCHAR(20) COLLATE latin1_bin); +INSERT INTO t1 VALUES ('a'),('b'); +SELECT * FROM t1 WHERE a='A'; +a +SELECT * FROM t1 WHERE a='A' AND a=_latin1'a'; +a +SELECT * FROM t1 WHERE a=_latin1'a' AND a='A'; +a +SELECT * FROM t1 WHERE a=_latin1'A'; +a +SELECT * FROM t1 WHERE a=_latin1'A' AND a=_latin1'a'; +a +SELECT * FROM t1 WHERE a=_latin1'a' AND a=_latin1'A'; +a +DROP TABLE t1; +# +# MDEV-8253 EXPLAIN SELECT prints unexpected characters +# +SET NAMES latin1; +CREATE TABLE t1 (a DECIMAL(10,1),b DECIMAL(10,1),c VARCHAR(10),d VARCHAR(10)); +INSERT INTO t1 VALUES (1.5,1.5,'1','1'),(3.5,3.5,'3','3'); +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE COALESCE(c,0)='3 ' AND COALESCE(d,0)=COALESCE(c,0); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where ((coalesce(`test`.`t1`.`c`,0) = '3 ') and (coalesce(`test`.`t1`.`d`,0) = '3 ')) +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ctype_latin1_de.result b/mysql-test/r/ctype_latin1_de.result index d20a9c89349..d34d132e3a9 100644 --- a/mysql-test/r/ctype_latin1_de.result +++ b/mysql-test/r/ctype_latin1_de.result @@ -490,8 +490,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) COLLATE latin1_german2_ci NOT NULL DEFAULT '', - `b` int(1) NOT NULL DEFAULT '0' + `a` varchar(1) COLLATE latin1_german2_ci NOT NULL, + `b` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; @@ -545,7 +545,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) COLLATE latin1_german2_ci NOT NULL DEFAULT '' + `a` varchar(1) COLLATE latin1_german2_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -565,7 +565,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) COLLATE latin1_german2_ci NOT NULL DEFAULT '' + `a` varchar(5) COLLATE latin1_german2_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; diff --git a/mysql-test/r/ctype_latin2.result b/mysql-test/r/ctype_latin2.result index 65aa2368ce4..634640cab1d 100644 --- a/mysql-test/r/ctype_latin2.result +++ b/mysql-test/r/ctype_latin2.result @@ -396,7 +396,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET latin2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -416,7 +416,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET latin2 NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET latin2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -626,7 +626,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 64) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(64) CHARACTER SET latin2 NOT NULL DEFAULT '' + `a` varchar(64) CHARACTER SET latin2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (''); SELECT CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1; @@ -677,7 +677,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET latin2 COLLATE latin2_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET latin2 COLLATE latin2_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -697,7 +697,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET latin2 COLLATE latin2_bin NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET latin2 COLLATE latin2_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; diff --git a/mysql-test/r/ctype_latin2_ch.result b/mysql-test/r/ctype_latin2_ch.result index e54522eec9f..da5c8076fca 100644 --- a/mysql-test/r/ctype_latin2_ch.result +++ b/mysql-test/r/ctype_latin2_ch.result @@ -45,6 +45,126 @@ strcmp('a\t','a' ) SELECT strcmp('a\t','a '); strcmp('a\t','a ') 0 +# +# MDEV-7149 Constant condition propagation erroneously applied for LIKE +# +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE CONCAT(c1)='a'; +c1 +a +a +SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'a '; +c1 +a +SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a ')) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE 'a'=CONCAT(c1); +c1 +a +a +SELECT * FROM t1 WHERE 'a ' LIKE CONCAT(c1); +c1 +a +SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`))) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '% '=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '%'=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +DROP TABLE t1; +# +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 1 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 1 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a ')))) +DROP TABLE t1; +# +# End of MDEV-8694 +# create table t1 ( a varchar(2) character set latin2 collate latin2_czech_cs, primary key(a) @@ -213,6 +333,7 @@ Y z Z DROP TABLE t1; +set sql_mode=""; CREATE TABLE t1 ENGINE=INNODB AS SELECT repeat('a', 5) AS s1 LIMIT 0; INSERT INTO t1 VALUES ('x'),('y'),('z'),('X'),('Y'),('Z'); SELECT * FROM t1 GROUP BY s1; @@ -389,7 +510,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -409,7 +530,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET latin2 COLLATE latin2_czech_cs NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; diff --git a/mysql-test/r/ctype_many.result b/mysql-test/r/ctype_many.result index 3c1c96fc47c..59443a3a2d5 100644 --- a/mysql-test/r/ctype_many.result +++ b/mysql-test/r/ctype_many.result @@ -1694,6 +1694,7 @@ DO CONVERT(CAST(SUBSTRING_INDEX(FORMAT(1,'1111'), FORMAT('','Zpq'),1) AS BINARY(0)) USING utf8); Warnings: Warning 1292 Truncated incorrect INTEGER value: 'Zpq' +Warning 1292 Truncated incorrect DOUBLE value: '' Warning 1292 Truncated incorrect BINARY(0) value: '1.' # # End of 5.1 tests @@ -1787,3 +1788,24 @@ SELECT * FROM t2 WHERE a=(SELECT a FROM t1) AND a=_LATIN1'x'; ERROR 21000: Subquery returns more than 1 row DROP TABLE t2; DROP TABLE t1; +# +# Start of 10.1 tests +# +# +# MDEV-8362 dash '-' is not recognized in charset armscii8 on select where query +# +CREATE TABLE t1 (a VARCHAR(64) CHARACTER SET armscii8); +INSERT INTO t1 VALUES ('abc-def'); +SELECT * FROM t1 WHERE a='abc-def'; +a +abc-def +SELECT * FROM t1 WHERE a LIKE 'abc%'; +a +abc-def +DROP TABLE t1; +SELECT HEX(CONVERT(_utf8 0x2728292C2D2E USING armscii8)); +HEX(CONVERT(_utf8 0x2728292C2D2E USING armscii8)) +2728292C2D2E +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ctype_mb.result b/mysql-test/r/ctype_mb.result index 5c578e3356c..b6e93bae65a 100644 --- a/mysql-test/r/ctype_mb.result +++ b/mysql-test/r/ctype_mb.result @@ -3,16 +3,16 @@ CREATE TABLE t1 SELECT _utf8'test' as c1, _utf8'теÑÑ‚' as c2; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '', - `c2` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(4) CHARACTER SET utf8 NOT NULL, + `c2` varchar(4) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DELETE FROM t1; ALTER TABLE t1 ADD c3 CHAR(4) CHARACTER SET utf8; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '', - `c2` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '', + `c1` varchar(4) CHARACTER SET utf8 NOT NULL, + `c2` varchar(4) CHARACTER SET utf8 NOT NULL, `c3` char(4) CHARACTER SET utf8 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('aaaabbbbccccdddd','aaaabbbbccccdddd','aaaabbbbccccdddd'); diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result index 48456c16705..46686933298 100644 --- a/mysql-test/r/ctype_sjis.result +++ b/mysql-test/r/ctype_sjis.result @@ -193,9 +193,21 @@ CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value SELECT hex(concat(repeat(0xF1F2, 10), '%')); hex(concat(repeat(0xF1F2, 10), '%')) F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 @@ -218,8 +230,8 @@ STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)) CREATE TABLE t1 AS SELECT REPEAT(' ', 64) AS subject, REPEAT(' ',64) AS pattern LIMIT 0; SHOW COLUMNS FROM t1; Field Type Null Key Default Extra -subject varchar(64) NO -pattern varchar(64) NO +subject varchar(64) NO NULL +pattern varchar(64) NO NULL INSERT INTO t1 VALUES (_utf8'2001÷01÷01',_utf8'%Y÷%m÷%d'); SELECT HEX(subject),HEX(pattern),STR_TO_DATE(subject, pattern) FROM t1; HEX(subject) HEX(pattern) STR_TO_DATE(subject, pattern) @@ -347,9 +359,21 @@ CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value SELECT hex(concat(repeat(0xF1F2, 10), '%')); hex(concat(repeat(0xF1F2, 10), '%')) F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 @@ -401,12 +425,14 @@ WHERE (head BETWEEN '80' AND 'FF') AND (head NOT BETWEEN 'A1' AND 'DF') AND (tail BETWEEN '20' AND 'FF') ORDER BY head, tail; INSERT t1 (code) SELECT head FROM head WHERE (head BETWEEN 'A1' AND 'DF'); +Warnings: +Warning 1364 Field 'a' doesn't have a default value DROP TEMPORARY TABLE head, tail; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `code` varchar(8) DEFAULT NULL, - `a` varchar(1) CHARACTER SET sjis NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET sjis NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 UPDATE t1 SET a=unhex(code) ORDER BY code; Warnings: @@ -477,7 +503,7 @@ Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 SELECT COUNT(*) FROM t1; COUNT(*) 14623 -SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=1; +SELECT COUNT(*) FROM t1 WHERE a<>'?' AND OCTET_LENGTH(a)=1; COUNT(*) 63 SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=2; @@ -659,10 +685,140 @@ WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; code a 81F0 â„« +Warnings: +Warning 1977 Cannot convert 'sjis' character 0x81AD to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81AD to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81AE to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81AE to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81AF to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81AF to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B0 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B0 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B1 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B1 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B2 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B2 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B3 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B3 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B4 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B4 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B5 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B5 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B6 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B6 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B7 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B7 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C0 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C0 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C1 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C1 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C2 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C2 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C3 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C3 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C4 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C4 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C5 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C5 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C6 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C6 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C7 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C7 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81CF to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81CF to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D0 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D0 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D1 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D1 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D2 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D2 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D3 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D3 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D4 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D4 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D5 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D5 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D6 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D6 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D7 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D7 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D8 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D8 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D9 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D9 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81E9 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81E9 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81EA to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81EA to 'utf8' SELECT * FROM t1 WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; code a +Warnings: +Warning 1977 Cannot convert 'sjis' character 0x81AD to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81AD to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81AE to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81AE to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81AF to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81AF to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B0 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B0 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B1 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B1 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B2 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B2 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B3 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B3 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B4 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B4 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B5 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B5 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B6 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B6 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B7 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B7 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C0 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C0 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C1 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C1 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C2 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C2 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C3 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C3 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C4 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C4 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C5 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C5 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C6 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C6 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C7 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C7 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81CF to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81CF to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D0 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D0 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D1 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D1 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D2 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D2 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D3 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D3 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D4 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D4 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D5 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D5 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D6 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D6 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D7 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D7 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D8 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D8 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D9 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D9 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81E9 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81E9 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81EA to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81EA to 'utf8' # # WL#3090 Japanese Character Set adjustments # Test sjis->Unicode conversion @@ -7612,6 +7768,71 @@ EAA1 E98199 EAA2 E791A4 EAA3 E5879C EAA4 E78699 +Warnings: +Warning 1977 Cannot convert 'sjis' character 0x81AD to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81AE to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81AF to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B0 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B1 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B2 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B3 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B4 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B5 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B6 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81B7 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C0 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C1 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C2 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C3 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C4 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C5 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C6 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81C7 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81CF to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D0 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D1 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D2 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D3 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D4 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D5 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D6 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D7 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D8 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81D9 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81E9 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81EA to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81EB to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81EC to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81ED to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81EE to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81EF to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81F8 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81F9 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81FA to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x81FB to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x8240 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x8241 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x8242 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x8243 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x8244 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x8245 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x8246 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x8247 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x8248 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x8249 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x824A to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x824B to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x824C to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x824D to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x824E to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x8259 to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x825A to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x825B to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x825C to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x825D to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x825E to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x825F to 'utf8' +Warning 1977 Cannot convert 'sjis' character 0x827A to 'utf8' DROP TABLE t1; # # WL#3090 Japanese Character Set adjustments @@ -14731,7 +14952,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET sjis NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET sjis NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -14751,7 +14972,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET sjis NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET sjis NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -14990,7 +15211,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET sjis COLLATE sjis_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET sjis COLLATE sjis_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -15010,7 +15231,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET sjis COLLATE sjis_bin NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET sjis COLLATE sjis_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -18353,7 +18574,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ',10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET sjis NOT NULL DEFAULT '' + `a` varchar(10) CHARACTER SET sjis NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('à\'),('à\t'); INSERT INTO t1 VALUES ('\\à\'),('\\à\t'),('\\à\t\t'); @@ -18392,7 +18613,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET sjis NOT NULL DEFAULT '' + `a` varchar(10) CHARACTER SET sjis NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (BINARY('à\')),(BINARY('à\t')); INSERT INTO t1 VALUES (BINARY('\\à\')),(BINARY('\\à\t')),(BINARY('\\à\t\t')); @@ -18431,7 +18652,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET sjis NOT NULL DEFAULT '' + `a` varchar(10) CHARACTER SET sjis NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (_BINARY'à\'),(_BINARY'à\t'); INSERT INTO t1 VALUES (_BINARY'\\à\'),(_BINARY'\\à\t'),(_BINARY'\\à\t\t'); @@ -18477,7 +18698,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(10) CHARACTER SET sjis NOT NULL DEFAULT '' + `a` varchar(10) CHARACTER SET sjis NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('à\['),('\à\['); SELECT HEX(a) FROM t1; @@ -18497,7 +18718,7 @@ CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varbinary(10) NOT NULL DEFAULT '' + `a` varbinary(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('à\['),('\à\['); SELECT HEX(a) FROM t1; diff --git a/mysql-test/r/ctype_tis620.result b/mysql-test/r/ctype_tis620.result index 08cf9f1a753..947aeb5ff5b 100644 --- a/mysql-test/r/ctype_tis620.result +++ b/mysql-test/r/ctype_tis620.result @@ -3115,6 +3115,126 @@ Zz 5A,7A ~ 7E 7F drop table t1; +# +# MDEV-7149 Constant condition propagation erroneously applied for LIKE +# +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET tis620 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE CONCAT(c1)='a'; +c1 +a +a +SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'a '; +c1 +a +SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a ')) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET tis620 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE 'a'=CONCAT(c1); +c1 +a +a +SELECT * FROM t1 WHERE 'a ' LIKE CONCAT(c1); +c1 +a +SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`))) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET tis620 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '% '=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET tis620 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '%'=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +DROP TABLE t1; +# +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET tis620 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 1 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 1 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a ')))) +DROP TABLE t1; +# +# End of MDEV-8694 +# SET collation_connection='tis620_bin'; create table t1 select repeat('a',4000) a; delete from t1; @@ -3212,6 +3332,126 @@ c2h ab_def drop table t1; # +# MDEV-7149 Constant condition propagation erroneously applied for LIKE +# +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE CONCAT(c1)='a'; +c1 +a +a +SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'a '; +c1 +a +SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where ((concat(`test`.`t1`.`c1`) = 'a') and (concat(`test`.`t1`.`c1`) like 'a ')) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE 'a'=CONCAT(c1); +c1 +a +a +SELECT * FROM t1 WHERE 'a ' LIKE CONCAT(c1); +c1 +a +SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('a' = concat(`test`.`t1`.`c1`)) and ('a ' like concat(`test`.`t1`.`c1`))) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '% '=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('% ' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '%'=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) +DROP TABLE t1; +# +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 1 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 1 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a ')))) +DROP TABLE t1; +# +# End of MDEV-8694 +# +# # Start of 5.6 tests # # @@ -3226,7 +3466,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET tis620 NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET tis620 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -3246,7 +3486,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET tis620 NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET tis620 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -3404,7 +3644,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -3424,7 +3664,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result index 02809f3be22..2f7cb7156a4 100644 --- a/mysql-test/r/ctype_uca.result +++ b/mysql-test/r/ctype_uca.result @@ -6071,8 +6071,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `b` int(1) NOT NULL DEFAULT '0' + `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, + `b` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; @@ -6265,9 +6265,21 @@ CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value SELECT hex(concat(repeat(0xF1F2, 10), '%')); hex(concat(repeat(0xF1F2, 10), '%')) F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F20025 @@ -6479,7 +6491,7 @@ ADD KEY(ch); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `ch` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `ch` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `ch` (`ch`) @@ -6506,10 +6518,22 @@ SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch; ch SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch; ch +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch; ch Warnings: Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch; ch Warnings: @@ -6552,6 +6576,12 @@ ab az aЀ aÖ€ +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch; ch a @@ -6573,6 +6603,12 @@ aЀ aÖ€ Warnings: Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch; ch a @@ -6600,11 +6636,23 @@ z SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch; ch z +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch; ch z Warnings: Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch; ch z @@ -6687,7 +6735,7 @@ ADD KEY(ch); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `ch` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `ch` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `ch` (`ch`) @@ -6714,10 +6762,22 @@ SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch; ch SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch; ch +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch; ch Warnings: Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch; ch Warnings: @@ -6760,6 +6820,10 @@ ab az aЀ aÖ€ +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch; ch a @@ -6779,6 +6843,10 @@ ab az aЀ aÖ€ +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch; ch a @@ -6804,9 +6872,17 @@ z SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch; ch z +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch; ch z +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch; ch z @@ -6894,7 +6970,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -6914,7 +6990,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -7138,7 +7214,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -7158,7 +7234,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -7786,8 +7862,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL DEFAULT '', - `b` int(1) NOT NULL DEFAULT '0' + `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL, + `b` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; @@ -7816,7 +7892,7 @@ CREATE TABLE t1 AS SELECT repeat('a', 10) as c LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '' + `c` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (_utf32 0x0180),(_utf32 0x023A); INSERT INTO t1 VALUES (_utf32 0x023B),(_utf32 0x023C); @@ -8120,7 +8196,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; @@ -8143,7 +8219,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); @@ -8166,7 +8242,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); @@ -8189,7 +8265,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); @@ -8209,13 +8285,38 @@ Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) DROP TABLE t1; # +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 1 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 1 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((not((`test`.`t1`.`a` like 'a '))) and (`test`.`t1`.`a` = 'a')) +DROP TABLE t1; +# +# End of MDEV-8694 +# +# # MDEV-7149 Constant condition propagation erroneously applied for LIKE # CREATE TABLE t1 AS SELECT REPEAT('a',10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('ae'),('ä'); SELECT * FROM t1 WHERE c1='ä'; @@ -8253,7 +8354,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; @@ -8276,7 +8377,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); @@ -8299,7 +8400,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); @@ -8322,7 +8423,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); @@ -8342,13 +8443,38 @@ Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) DROP TABLE t1; # +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 1 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 1 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((not((`test`.`t1`.`a` like 'a '))) and (`test`.`t1`.`a` = 'a')) +DROP TABLE t1; +# +# End of MDEV-8694 +# +# # MDEV-7149 Constant condition propagation erroneously applied for LIKE # CREATE TABLE t1 AS SELECT REPEAT('a',10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('ae'),('ä'); SELECT * FROM t1 WHERE c1='ä'; @@ -8401,7 +8527,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `s1` varchar(64) CHARACTER SET utf8 COLLATE utf8_myanmar_ci NOT NULL DEFAULT '', + `s1` varchar(64) CHARACTER SET utf8 COLLATE utf8_myanmar_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (s1) VALUES @@ -10977,7 +11103,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `s1` varchar(64) CHARACTER SET ucs2 COLLATE ucs2_myanmar_ci NOT NULL DEFAULT '', + `s1` varchar(64) CHARACTER SET ucs2 COLLATE ucs2_myanmar_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (s1) VALUES @@ -13573,3 +13699,32 @@ DROP TABLE t1; # # End of MariaDB-10.0 tests # +# +# Start of MariaDB-10.1 tests +# +# +# MDEV-6973 XOR aggregates argument collations +# +SELECT '10' COLLATE utf8_general_ci XOR '20' COLLATE utf8_unicode_ci; +'10' COLLATE utf8_general_ci XOR '20' COLLATE utf8_unicode_ci +0 +# +# MDEV-8705 Wrong result for SELECT..WHERE latin1_bin_column='a' AND latin1_bin_column='A' +# +SET NAMES utf8 COLLATE utf8_german2_ci; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin); +INSERT INTO t1 VALUES ('a'),('A'); +SELECT * FROM t1 WHERE a='a'; +a +a +SELECT * FROM t1 WHERE a=_utf8'a'; +a +a +SELECT * FROM t1 WHERE a='a' AND a=_utf8'a'; +a +a +DROP TABLE t1; +SET NAMES utf8; +# +# End of MariaDB-10.1 tests +# diff --git a/mysql-test/r/ctype_uca_innodb.result b/mysql-test/r/ctype_uca_innodb.result index a4e1ae09130..f189e698da1 100644 --- a/mysql-test/r/ctype_uca_innodb.result +++ b/mysql-test/r/ctype_uca_innodb.result @@ -15,7 +15,7 @@ ADD KEY(ch); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `ch` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `ch` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `ch` (`ch`) @@ -42,10 +42,22 @@ SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch; ch SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch; ch +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch; ch Warnings: Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch; ch Warnings: @@ -88,6 +100,12 @@ ab az aЀ aÖ€ +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch; ch a @@ -109,6 +127,12 @@ aЀ aÖ€ Warnings: Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch; ch a @@ -136,11 +160,23 @@ z SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch; ch z +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch; ch z Warnings: Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch; ch z diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 6b3d87b79e1..767e034a0e5 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -196,8 +196,8 @@ RPAD(_ucs2 X'0420',10,_ucs2 X'0421') r; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `l` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '', - `r` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `l` varchar(10) CHARACTER SET ucs2 NOT NULL, + `r` varchar(10) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; # @@ -933,8 +933,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '', - `b` int(1) NOT NULL DEFAULT '0' + `a` varchar(1) CHARACTER SET ucs2 NOT NULL, + `b` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; @@ -959,9 +959,21 @@ CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value SELECT hex(concat(repeat(0xF1F2, 10), '%')); hex(concat(repeat(0xF1F2, 10), '%')) F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F20025 @@ -984,8 +996,8 @@ STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)) CREATE TABLE t1 AS SELECT REPEAT(' ', 64) AS subject, REPEAT(' ',64) AS pattern LIMIT 0; SHOW COLUMNS FROM t1; Field Type Null Key Default Extra -subject varchar(64) NO -pattern varchar(64) NO +subject varchar(64) NO NULL +pattern varchar(64) NO NULL INSERT INTO t1 VALUES (_utf8'2001÷01÷01',_utf8'%Y÷%m÷%d'); SELECT HEX(subject),HEX(pattern),STR_TO_DATE(subject, pattern) FROM t1; HEX(subject) HEX(pattern) STR_TO_DATE(subject, pattern) @@ -1092,9 +1104,21 @@ CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value SELECT hex(concat(repeat(0xF1F2, 10), '%')); hex(concat(repeat(0xF1F2, 10), '%')) F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F20025 @@ -1160,7 +1184,9 @@ hex(a) 005B 803D drop table t1; +set sql_mode=""; create table t1(f1 varchar(5) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL) engine=InnoDB; +set sql_mode=default; insert into t1 values('a'); create index t1f1 on t1(f1); select f1 from t1 where f1 like 'a%'; @@ -1596,7 +1622,7 @@ create table t1 as select concat(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select hex(c1) from t1; hex(c1) @@ -1609,7 +1635,7 @@ create table t1 as select concat(18446744073709551615) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(20) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(20) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select hex(c1) from t1; hex(c1) @@ -1622,7 +1648,7 @@ create table t1 as select concat(1.1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(4) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select hex(c1) from t1; hex(c1) @@ -1635,7 +1661,7 @@ create table t1 as select concat(1+2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1-2)); @@ -1645,7 +1671,7 @@ create table t1 as select concat(1-2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1*2)); @@ -1655,7 +1681,7 @@ create table t1 as select concat(1*2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1/2)); @@ -1695,7 +1721,7 @@ create table t1 as select concat(-1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(-(1+2))); @@ -1705,7 +1731,7 @@ create table t1 as select concat(-(1+2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(4) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1|2)); @@ -1715,7 +1741,7 @@ create table t1 as select concat(1|2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1&2)); @@ -1725,7 +1751,7 @@ create table t1 as select concat(1&2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(bit_count(12))); @@ -1735,7 +1761,7 @@ create table t1 as select concat(bit_count(12)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(2<<1)); @@ -1745,7 +1771,7 @@ create table t1 as select concat(2<<1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(2>>1)); @@ -1755,7 +1781,7 @@ create table t1 as select concat(2>>1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(~0)); @@ -1765,7 +1791,7 @@ create table t1 as select concat(~0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(3^2)); @@ -1775,7 +1801,7 @@ create table t1 as select concat(3^2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(abs(-2))); @@ -1785,7 +1811,7 @@ create table t1 as select concat(abs(-2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(left(concat(exp(2)),1)); @@ -1915,7 +1941,7 @@ create table t1 as select concat(degrees(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(23) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(radians(0))); @@ -1925,7 +1951,7 @@ create table t1 as select concat(radians(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(23) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ceiling(0.5))); @@ -1935,7 +1961,7 @@ create table t1 as select concat(ceiling(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(4) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(floor(0.5))); @@ -1945,7 +1971,7 @@ create table t1 as select concat(floor(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(4) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(round(0.5))); @@ -1955,7 +1981,7 @@ create table t1 as select concat(round(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(sign(0.5))); @@ -1965,14 +1991,14 @@ create table t1 as select concat(sign(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(rand()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(23) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(length('a'))); @@ -1982,7 +2008,7 @@ create table t1 as select concat(length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(char_length('a'))); @@ -1992,7 +2018,7 @@ create table t1 as select concat(char_length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(bit_length('a'))); @@ -2002,7 +2028,7 @@ create table t1 as select concat(bit_length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(coercibility('a'))); @@ -2012,7 +2038,7 @@ create table t1 as select concat(coercibility('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(locate('a','a'))); @@ -2022,7 +2048,7 @@ create table t1 as select concat(locate('a','a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(11) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(11) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(field('c','a','b','c'))); @@ -2032,7 +2058,7 @@ create table t1 as select concat(field('c','a','b','c')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ascii(61))); @@ -2042,7 +2068,7 @@ create table t1 as select concat(ascii(61)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ord(61))); @@ -2052,7 +2078,7 @@ create table t1 as select concat(ord(61)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(find_in_set('b','a,b,c,d'))); @@ -2062,7 +2088,7 @@ create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select md5('a'), hex(md5('a')); @@ -2072,7 +2098,7 @@ create table t1 as select md5('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(32) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(32) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select old_password('a'), hex(old_password('a')); @@ -2082,7 +2108,7 @@ create table t1 as select old_password('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(16) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(16) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select password('a'), hex(password('a')); @@ -2092,7 +2118,7 @@ create table t1 as select password('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(41) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(41) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select sha('a'), hex(sha('a')); @@ -2102,7 +2128,7 @@ create table t1 as select sha('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(40) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(40) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select sha1('a'), hex(sha1('a')); @@ -2112,7 +2138,7 @@ create table t1 as select sha1('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(40) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(40) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(cast('-1' as signed))); @@ -2122,7 +2148,7 @@ create table t1 as select concat(cast('-1' as signed)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(cast('1' as unsigned))); @@ -2132,7 +2158,7 @@ create table t1 as select concat(cast('1' as unsigned)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(cast(1/2 as decimal(5,5)))); @@ -2191,7 +2217,7 @@ create table t1 as select concat(least(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(greatest(1,2))); @@ -2201,7 +2227,7 @@ create table t1 as select concat(greatest(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(case when 11 then 22 else 33 end)); @@ -2211,7 +2237,7 @@ create table t1 as select concat(case when 11 then 22 else 33 end) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(coalesce(1,2))); @@ -2221,7 +2247,7 @@ create table t1 as select concat(coalesce(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat_ws(1,2,3)); @@ -2231,7 +2257,7 @@ create table t1 as select concat_ws(1,2,3) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(group_concat(1,2,3)); @@ -2259,7 +2285,7 @@ create table t1 as select concat(last_insert_id()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(benchmark(0,0))); @@ -2269,7 +2295,7 @@ create table t1 as select concat(benchmark(0,0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(sleep(0))); @@ -2279,7 +2305,7 @@ create table t1 as select concat(sleep(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(is_free_lock('xxxx'))); @@ -2313,7 +2339,7 @@ create table t1 as select concat(crc32('')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(uncompressed_length(''))); @@ -2330,7 +2356,7 @@ create table t1 as select concat(connection_id()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(inet_aton('127.1.1.1'))); @@ -2366,7 +2392,7 @@ create table t1 as select concat(row_count()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(found_rows())); @@ -2376,21 +2402,21 @@ create table t1 as select concat(found_rows()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(uuid_short()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(uuid()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(36) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select coercibility(uuid()), coercibility(cast('a' as char character set latin1)); @@ -2403,7 +2429,7 @@ create table t1 as select concat(uuid(), cast('a' as char character set latin1)) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(37) NOT NULL DEFAULT '' + `c1` varchar(37) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1; @@ -2423,8 +2449,8 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '', - `c2` int(1) NOT NULL DEFAULT '0' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL, + `c2` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; set @a2=1; @@ -2481,8 +2507,8 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET ucs2 NOT NULL DEFAULT '', - `c2` decimal(2,1) NOT NULL DEFAULT '0.0' + `c1` varchar(4) CHARACTER SET ucs2 NOT NULL, + `c2` decimal(2,1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; set @a2=1.1; @@ -2520,7 +2546,7 @@ create table t1 as select concat('a'='a' IS TRUE) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a'='a' IS NOT TRUE)); @@ -2530,7 +2556,7 @@ create table t1 as select concat('a'='a' IS NOT TRUE) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(NOT 'a'='a')); @@ -2540,7 +2566,7 @@ create table t1 as select concat(NOT 'a'='a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' IS NULL)); @@ -2550,7 +2576,7 @@ create table t1 as select concat('a' IS NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' IS NOT NULL)); @@ -2560,7 +2586,7 @@ create table t1 as select concat('a' IS NOT NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' rlike 'a')); @@ -2570,7 +2596,7 @@ create table t1 as select concat('a' IS NOT NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(strcmp('a','b'))); @@ -2580,7 +2606,7 @@ create table t1 as select concat(strcmp('a','b')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' like 'a')); @@ -2590,7 +2616,7 @@ create table t1 as select concat('a' like 'b') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' between 'b' and 'c')); @@ -2600,7 +2626,7 @@ create table t1 as select concat('a' between 'b' and 'c') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' in ('a','b'))); @@ -2610,7 +2636,7 @@ create table t1 as select concat('a' in ('a','b')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(interval(23, 1, 15, 17, 30, 44, 200))); @@ -2620,7 +2646,7 @@ create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a varchar(10), fulltext key(a)); @@ -2642,7 +2668,7 @@ create table t1 as select ifnull(1,'a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ifnull(1,1))); @@ -2652,7 +2678,7 @@ create table t1 as select concat(ifnull(1,1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ifnull(1.1,1.1))); @@ -2662,7 +2688,7 @@ create table t1 as select concat(ifnull(1.1,1.1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(4) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(if(1,'b',1)); @@ -2672,7 +2698,7 @@ create table t1 as select if(1,'b',1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(if(1,1,'b')); @@ -2682,7 +2708,7 @@ create table t1 as select if(1,1,'b') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(if(1,1,1))); @@ -2692,7 +2718,7 @@ create table t1 as select concat(if(1,1,1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(nullif(1,2))); @@ -2772,7 +2798,7 @@ create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); @@ -2782,7 +2808,7 @@ create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); @@ -2857,7 +2883,7 @@ create table t1 as select concat(period_add(200902, 2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(6) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(period_diff(200902, 200802))); @@ -2869,7 +2895,7 @@ Warning 1265 Data truncated for column 'c1' at row 1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(6) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(to_days(20090224))); @@ -3066,21 +3092,21 @@ create table t1 as select concat(curdate()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(utc_date()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(curtime()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select repeat('a',20) as c1 limit 0; @@ -3096,7 +3122,7 @@ create table t1 as select concat(utc_time()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(sec_to_time(2378))); @@ -3189,21 +3215,21 @@ create table t1 as select concat(now()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(19) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(utc_timestamp()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(19) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(sysdate()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(19) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(addtime('00:00:00','11:22:33'))); @@ -3243,7 +3269,7 @@ create table t1 as select export_set(1,2,3,4,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(127) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(127) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(insert(1133,3,0,22)); @@ -3253,7 +3279,7 @@ create table t1 as select insert(1133,3,0,22) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(6) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(lcase(123)); @@ -3263,7 +3289,7 @@ create table t1 as select lcase(123) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(left(123,1)); @@ -3273,7 +3299,7 @@ create table t1 as select left(123,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(lower(123)); @@ -3283,7 +3309,7 @@ create table t1 as select lower(123) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(lpad(1,2,0)); @@ -3293,7 +3319,7 @@ create table t1 as select lpad(1,2,0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(ltrim(1)); @@ -3303,7 +3329,7 @@ create table t1 as select ltrim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(mid(1,1,1)); @@ -3313,7 +3339,7 @@ create table t1 as select mid(1,1,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(repeat(1,2)); @@ -3323,7 +3349,7 @@ create table t1 as select repeat(1,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(replace(1,1,2)); @@ -3333,7 +3359,7 @@ create table t1 as select replace(1,1,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(reverse(12)); @@ -3343,7 +3369,7 @@ create table t1 as select reverse(12) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(right(123,1)); @@ -3353,7 +3379,7 @@ create table t1 as select right(123,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(rpad(1,2,0)); @@ -3363,7 +3389,7 @@ create table t1 as select rpad(1,2,0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(rtrim(1)); @@ -3373,7 +3399,7 @@ create table t1 as select rtrim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(soundex(1)); @@ -3383,7 +3409,7 @@ create table t1 as select soundex(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(4) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(substring(1,1,1)); @@ -3393,7 +3419,7 @@ create table t1 as select substring(1,1,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(trim(1)); @@ -3403,7 +3429,7 @@ create table t1 as select trim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(ucase(1)); @@ -3413,7 +3439,7 @@ create table t1 as select ucase(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(upper(1)); @@ -3423,14 +3449,14 @@ create table t1 as select upper(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select repeat(' ', 64) as a limit 0; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(64) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `a` varchar(64) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ("1.1"), ("2.1"); select a, hex(a) from t1; @@ -3659,7 +3685,7 @@ t2 CREATE TABLE `t2` ( `concat(a)` varbinary(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1, t2; -create table t1 (a timestamp); +create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values (0); insert into t1 values (20010203040506); insert into t1 values (19800203040506); @@ -3680,7 +3706,7 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(19) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `concat(a)` varchar(19) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1, t2; create table t1 (a date); @@ -3971,7 +3997,7 @@ hex(a) 0000000000000001 drop table t1; drop view v1; -create table t1 (a timestamp); +create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values (0); insert into t1 values (20010203040506); insert into t1 values (19800203040506); @@ -4220,7 +4246,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `CONCAT(a)` varchar(9) CHARACTER SET ucs2 DEFAULT NULL, - `IFNULL(a,'')` varchar(9) CHARACTER SET ucs2 NOT NULL DEFAULT '', + `IFNULL(a,'')` varchar(9) CHARACTER SET ucs2 NOT NULL, `IF(a,a,'')` varchar(9) CHARACTER SET ucs2 DEFAULT NULL, `CASE WHEN a THEN a ELSE '' END` varchar(9) CHARACTER SET ucs2 DEFAULT NULL, `COALESCE(a,'')` varchar(9) CHARACTER SET ucs2 DEFAULT NULL @@ -4230,14 +4256,14 @@ CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT LCASE(a) FROM t1; @@ -4258,35 +4284,35 @@ CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `REPEAT(1,2)` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `REPEAT(1,2)` varchar(2) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `LEFT(123,2)` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `LEFT(123,2)` varchar(2) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `RIGHT(123,2)` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `RIGHT(123,2)` varchar(2) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `LTRIM(123)` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `LTRIM(123)` varchar(3) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `RTRIM(123)` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `RTRIM(123)` varchar(3) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1; @@ -4300,35 +4326,35 @@ CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `REPLACE(111,2,3)` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `REPLACE(111,2,3)` varchar(3) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `SOUNDEX(1)` varchar(4) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `SOUNDEX(1)` varchar(4) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8); SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; DROP TABLE t1; @@ -4352,7 +4378,7 @@ id select_type table type possible_keys key key_len ref rows Extra ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL; EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range date_column date_column 9 NULL 1 Using index condition +1 SIMPLE t1 range date_column date_column 6 NULL 1 Using index condition DROP TABLE t1; # # Bug #31384 DATE_ADD() and DATE_SUB() return binary data @@ -4492,7 +4518,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `d` date DEFAULT NULL, - `bad` varchar(10) CHARACTER SET ucs2 DEFAULT NULL + `bad` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1, t2; SET NAMES latin1; @@ -4566,7 +4592,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -4586,7 +4612,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -4810,7 +4836,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -4830,7 +4856,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -5139,7 +5165,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 64) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(64) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `a` varchar(64) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (''); SELECT CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1; @@ -5282,8 +5308,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_german2_ci NOT NULL DEFAULT '', - `b` int(1) NOT NULL DEFAULT '0' + `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_german2_ci NOT NULL, + `b` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; @@ -5323,7 +5349,7 @@ Warning 1292 Truncated incorrect INTEGER value: '' CREATE TABLE t1 (a DECIMAL(2,0)); SET sql_mode='strict_all_tables'; INSERT INTO t1 VALUES (CONVERT('9e99999999' USING ucs2)); -ERROR 22007: Incorrect decimal value: '9e99999999' for column 'a' at row 1 +ERROR 22003: Out of range value for column 'a' at row 1 SET sql_mode=DEFAULT; INSERT INTO t1 VALUES (CONVERT('aaa' USING ucs2)); Warnings: @@ -5343,7 +5369,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; @@ -5366,7 +5392,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); @@ -5389,7 +5415,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); @@ -5412,7 +5438,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); @@ -5431,6 +5457,31 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) DROP TABLE t1; +# +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 2 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 2 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a ')))) +DROP TABLE t1; +# +# End of MDEV-8694 +# SET NAMES latin1, collation_connection=ucs2_general_ci; # # MDEV-7149 Constant condition propagation erroneously applied for LIKE @@ -5439,7 +5490,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; @@ -5462,7 +5513,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); @@ -5485,7 +5536,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); @@ -5508,7 +5559,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET ucs2 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); @@ -5527,6 +5578,31 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) DROP TABLE t1; +# +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET ucs2 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 2 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 2 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a ')))) +DROP TABLE t1; +# +# End of MDEV-8694 +# SET NAMES latin1; # # MDEV-6661 PI() does not work well in UCS2/UTF16/UTF32 context @@ -5544,3 +5620,43 @@ a aa # # End of 10.0 tests # +select collation(cast("a" as char(10) unicode binary)); +collation(cast("a" as char(10) unicode binary)) +ucs2_bin +select collation(cast("a" as char(10) binary unicode)); +collation(cast("a" as char(10) binary unicode)) +ucs2_bin +# +# MDEV-8222 "string_field LIKE int_const" returns a wrong result in case of UCS2 +# +CREATE TABLE t1 (a VARCHAR(10) CHARSET ucs2); +INSERT INTO t1 VALUES ('1'); +SELECT * FROM t1 WHERE a LIKE 1; +a +1 +DROP TABLE t1; +# +# MDEV-8253 EXPLAIN SELECT prints unexpected characters +# +SET NAMES latin1, character_set_connection=ucs2; +CREATE TABLE t1 (a DECIMAL(10,1),b DECIMAL(10,1),c VARCHAR(10),d VARCHAR(10)); +INSERT INTO t1 VALUES (1.5,1.5,'1','1'),(3.5,3.5,'3','3'); +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE COALESCE(c,0)='3 ' AND COALESCE(d,0)=COALESCE(c,0); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where ((coalesce(`test`.`t1`.`c`,0) = '3 ') and (coalesce(`test`.`t1`.`d`,0) = '3 ')) +DROP TABLE t1; +# +# MDEV-9178 Wrong result for CAST(CONVERT('1IJ3' USING ucs2) AS SIGNED) +# +SET NAMES utf8; +SELECT CAST(CONVERT('1IJ3' USING ucs2) AS SIGNED); +CAST(CONVERT('1IJ3' USING ucs2) AS SIGNED) +1 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '1IJ3' +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result index 413ab4efe31..61541ec7678 100644 --- a/mysql-test/r/ctype_ujis.result +++ b/mysql-test/r/ctype_ujis.result @@ -126,6 +126,7 @@ Field Type Null Key Default Extra a char(1) NO b enum('¤¢','¤¤') YES NULL DROP TABLE t1; +set sql_mode=""; CREATE TABLE t1 ( a INTEGER NOT NULL, @@ -133,6 +134,7 @@ b VARCHAR(50) NOT NULL DEFAULT '', PRIMARY KEY (a), KEY b (b(10)) ) ENGINE=InnoDB CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci'; +set sql_mode=default; INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd'); INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh'); INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl'); @@ -2329,9 +2331,21 @@ CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value SELECT hex(concat(repeat(0xF1F2, 10), '%')); hex(concat(repeat(0xF1F2, 10), '%')) F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 @@ -2464,9 +2478,21 @@ CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value SELECT hex(concat(repeat(0xF1F2, 10), '%')); hex(concat(repeat(0xF1F2, 10), '%')) F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 @@ -2480,9 +2506,13 @@ DROP TABLE t1; select hex(convert(_ujis 0xA5FE41 using ucs2)); hex(convert(_ujis 0xA5FE41 using ucs2)) 003F0041 +Warnings: +Warning 1977 Cannot convert 'ujis' character 0xA5FE to 'ucs2' select hex(convert(_ujis 0x8FABF841 using ucs2)); hex(convert(_ujis 0x8FABF841 using ucs2)) 003F0041 +Warnings: +Warning 1977 Cannot convert 'ujis' character 0x8FABF8 to 'ucs2' DROP TABLE IF EXISTS t1, t2; DROP PROCEDURE IF EXISTS sp1; set names ujis; @@ -2541,21 +2571,27 @@ DROP TABLE t1; CREATE TABLE t1 AS SELECT 'XXXXXX' AS code, ' ' AS a LIMIT 0; INSERT INTO t1 (code) SELECT concat('8E', head) FROM head WHERE (head BETWEEN 'A1' AND 'DF') ORDER BY head; +Warnings: +Warning 1364 Field 'a' doesn't have a default value INSERT INTO t1 (code) SELECT concat(head, tail) FROM head, tail WHERE (head BETWEEN '80' AND 'FF') AND (head NOT BETWEEN '8E' AND '8F') AND (tail BETWEEN '20' AND 'FF') ORDER BY head, tail; +Warnings: +Warning 1364 Field 'a' doesn't have a default value INSERT INTO t1 (code) SELECT concat('8F', head, tail) FROM head, tail WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '80' AND 'FF') ORDER BY head, tail; +Warnings: +Warning 1364 Field 'a' doesn't have a default value DROP TEMPORARY TABLE head, tail; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `code` varchar(6) CHARACTER SET ujis NOT NULL DEFAULT '', - `a` varchar(1) CHARACTER SET ujis NOT NULL DEFAULT '' + `code` varchar(6) CHARACTER SET ujis NOT NULL, + `a` varchar(1) CHARACTER SET ujis NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 UPDATE t1 SET a=unhex(code) ORDER BY code; Warnings: @@ -2626,7 +2662,7 @@ Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 SELECT COUNT(*) FROM t1; COUNT(*) 44671 -SELECT COUNT(*) FROM t1 WHERE a<>''; +SELECT COUNT(*) FROM t1 WHERE a<>'?'; COUNT(*) 17735 SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=2; @@ -3046,12 +3082,142 @@ WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <> HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; code a 8FAABC Ä¢ +Warnings: +Warning 1977 Cannot convert 'ujis' character 0xA2AF to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2AF to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B0 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B0 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B1 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B1 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B2 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B2 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B3 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B3 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B4 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B4 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B5 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B5 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B6 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B6 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B7 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B7 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B8 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B8 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B9 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B9 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C2 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C2 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C3 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C3 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C4 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C4 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C5 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C5 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C6 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C6 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C7 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C7 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C8 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C8 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C9 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C9 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D1 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D1 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D2 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D2 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D3 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D3 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D4 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D4 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D5 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D5 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D6 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D6 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D7 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D7 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D8 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D8 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D9 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D9 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2DA to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2DA to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2DB to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2DB to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2EB to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2EB to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2EC to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2EC to 'utf8' SELECT * FROM t1 WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <> HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code; code a 8FA9C3 ð 8FABB9 ǵ +Warnings: +Warning 1977 Cannot convert 'ujis' character 0xA2AF to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2AF to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B0 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B0 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B1 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B1 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B2 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B2 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B3 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B3 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B4 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B4 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B5 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B5 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B6 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B6 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B7 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B7 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B8 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B8 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B9 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B9 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C2 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C2 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C3 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C3 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C4 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C4 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C5 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C5 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C6 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C6 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C7 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C7 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C8 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C8 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C9 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C9 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D1 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D1 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D2 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D2 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D3 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D3 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D4 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D4 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D5 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D5 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D6 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D6 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D7 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D7 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D8 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D8 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D9 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D9 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2DA to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2DA to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2DB to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2DB to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2EB to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2EB to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2EC to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2EC to 'utf8' # # WL#3090 Japanese Character Set adjustments # Test sjis->Unicode conversion @@ -17948,6 +18114,71 @@ FEFB EE8EA8 FEFC EE8EA9 FEFD EE8EAA FEFE EE8EAB +Warnings: +Warning 1977 Cannot convert 'ujis' character 0xA2AF to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B0 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B1 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B2 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B3 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B4 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B5 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B6 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B7 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B8 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2B9 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C2 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C3 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C4 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C5 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C6 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C7 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C8 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2C9 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D1 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D2 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D3 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D4 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D5 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D6 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D7 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D8 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2D9 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2DA to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2DB to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2EB to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2EC to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2ED to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2EE to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2EF to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2F0 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2F1 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2FA to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2FB to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2FC to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA2FD to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3A1 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3A2 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3A3 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3A4 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3A5 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3A6 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3A7 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3A8 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3A9 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3AA to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3AB to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3AC to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3AD to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3AE to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3AF to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3BA to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3BB to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3BC to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3BD to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3BE to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3BF to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3C0 to 'utf8' +Warning 1977 Cannot convert 'ujis' character 0xA3DB to 'utf8' DROP TABLE t1; # # WL#3090 Japanese Character Set adjustments @@ -25067,7 +25298,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET ujis NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET ujis NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -25087,7 +25318,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET ujis NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET ujis NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -25500,7 +25731,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET ujis COLLATE ujis_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET ujis COLLATE ujis_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -25520,7 +25751,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET ujis COLLATE ujis_bin NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET ujis COLLATE ujis_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -25938,10 +26169,52 @@ CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ujis); INSERT INTO t1 VALUES (0x8EA0); SELECT HEX(a), CHAR_LENGTH(a) FROM t1; HEX(a) CHAR_LENGTH(a) - 0 +3F3F 2 DROP TABLE t1; SELECT _ujis 0x8EA0; ERROR HY000: Invalid ujis character string: '8EA0' # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-8215 Asian MB3 charsets: compare broken bytes as "greater than any non-broken character" +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ujis, KEY(a)); +INSERT INTO t1 VALUES ('a'),(0x7F); +INSERT INTO t1 VALUES (0x8EA1),(0x8EDF); +INSERT INTO t1 VALUES (0x8FA1A1),(0x8FFEFE); +INSERT INTO t1 VALUES (0xA1A1),(0xDEDE),(0xDFDF),(0xE0E0),(0xFEFE); +SELECT HEX(a) FROM t1 ORDER BY a; +HEX(a) +61 +7F +8EA1 +8EDF +8FA1A1 +8FFEFE +A1A1 +DEDE +DFDF +E0E0 +FEFE +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ujis COLLATE ujis_bin; +SELECT HEX(a) FROM t1 ORDER BY a; +HEX(a) +61 +7F +8EA1 +8EDF +8FA1A1 +8FFEFE +A1A1 +DEDE +DFDF +E0E0 +FEFE +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ctype_upgrade.result b/mysql-test/r/ctype_upgrade.result index 6bef89f6cd6..b317be42d5c 100644 --- a/mysql-test/r/ctype_upgrade.result +++ b/mysql-test/r/ctype_upgrade.result @@ -6,7 +6,7 @@ call mtr.add_suppression("Table rebuild required"); # Copying maria050313_utf8_croatian_ci.* to MYSQLD_DATADIR CHECK TABLE maria050313_utf8_croatian_ci FOR UPGRADE; Table Op Msg_type Msg_text -test.maria050313_utf8_croatian_ci check error Table upgrade required. Please do "REPAIR TABLE `maria050313_utf8_croatian_ci`" or dump/reload to fix it! +test.maria050313_utf8_croatian_ci check error Upgrade required. Please do "REPAIR TABLE `maria050313_utf8_croatian_ci`" or dump/reload to fix it! SHOW CREATE TABLE maria050313_utf8_croatian_ci; ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.maria050313_utf8_croatian_c` FORCE" or dump/reload to fix it! REPAIR TABLE maria050313_utf8_croatian_ci; @@ -43,7 +43,7 @@ DROP TABLE maria050313_utf8_croatian_ci; # Copying maria050313_ucs2_croatian_ci.* to MYSQLD_DATADIR CHECK TABLE maria050313_ucs2_croatian_ci_def FOR UPGRADE; Table Op Msg_type Msg_text -test.maria050313_ucs2_croatian_ci_def check error Table upgrade required. Please do "REPAIR TABLE `maria050313_ucs2_croatian_ci_def`" or dump/reload to fix it! +test.maria050313_ucs2_croatian_ci_def check error Upgrade required. Please do "REPAIR TABLE `maria050313_ucs2_croatian_ci_def`" or dump/reload to fix it! SELECT count(*) FROM maria050313_ucs2_croatian_ci_def; ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.maria050313_ucs2_croatian_c` FORCE" or dump/reload to fix it! REPAIR TABLE maria050313_ucs2_croatian_ci_def; @@ -58,7 +58,7 @@ DROP TABLE maria050313_ucs2_croatian_ci_def; # Copying maria050313_ucs2_croatian_ci.* to MYSQLD_DATADIR CHECK TABLE maria050313_ucs2_croatian_ci_def; Table Op Msg_type Msg_text -test.maria050313_ucs2_croatian_ci_def check error Table upgrade required. Please do "REPAIR TABLE `maria050313_ucs2_croatian_ci_def`" or dump/reload to fix it! +test.maria050313_ucs2_croatian_ci_def check error Upgrade required. Please do "REPAIR TABLE `maria050313_ucs2_croatian_ci_def`" or dump/reload to fix it! REPAIR TABLE maria050313_ucs2_croatian_ci_def; Table Op Msg_type Msg_text test.maria050313_ucs2_croatian_ci_def repair status OK @@ -84,7 +84,7 @@ DROP TABLE maria050313_ucs2_croatian_ci_def; # Copying maria050533_xxx_croatian_ci.* to MYSQLD_DATADIR CHECK TABLE maria050533_xxx_croatian_ci FOR UPGRADE; Table Op Msg_type Msg_text -test.maria050533_xxx_croatian_ci check error Table upgrade required. Please do "REPAIR TABLE `maria050533_xxx_croatian_ci`" or dump/reload to fix it! +test.maria050533_xxx_croatian_ci check error Upgrade required. Please do "REPAIR TABLE `maria050533_xxx_croatian_ci`" or dump/reload to fix it! REPAIR TABLE maria050533_xxx_croatian_ci; Table Op Msg_type Msg_text test.maria050533_xxx_croatian_ci repair status OK @@ -141,7 +141,7 @@ DROP TABLE maria050533_xxx_croatian_ci; # Copying maria100004_xxx_croatian_ci.* to MYSQLD_DATADIR CHECK TABLE maria100004_xxx_croatian_ci FOR UPGRADE; Table Op Msg_type Msg_text -test.maria100004_xxx_croatian_ci check error Table upgrade required. Please do "REPAIR TABLE `maria100004_xxx_croatian_ci`" or dump/reload to fix it! +test.maria100004_xxx_croatian_ci check error Upgrade required. Please do "REPAIR TABLE `maria100004_xxx_croatian_ci`" or dump/reload to fix it! SELECT count(*) FROM maria100004_xxx_croatian_ci; ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.maria100004_xxx_croatian_ci` FORCE" or dump/reload to fix it! REPAIR TABLE maria100004_xxx_croatian_ci; diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result index 2d91ce3dd6f..3bd37255b59 100644 --- a/mysql-test/r/ctype_utf16.result +++ b/mysql-test/r/ctype_utf16.result @@ -101,8 +101,8 @@ RPAD(_utf16 X'0420',10,_utf16 X'0421') r; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `l` varchar(10) CHARACTER SET utf16 NOT NULL DEFAULT '', - `r` varchar(10) CHARACTER SET utf16 NOT NULL DEFAULT '' + `l` varchar(10) CHARACTER SET utf16 NOT NULL, + `r` varchar(10) CHARACTER SET utf16 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select hex(l), hex(r) from t1; hex(l) hex(r) @@ -755,7 +755,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84); INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080); @@ -1254,6 +1254,8 @@ insert into t1 values ('-1234.1e2xxxx'); Warnings: Warning 1265 Data truncated for column 'a' at row 1 insert into t1 values ('-1234.1e2 '); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 select * from t1; a -123410 @@ -1262,6 +1264,8 @@ a drop table t1; create table t1 (a int); insert into t1 values ('1 '); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 insert into t1 values ('1 x'); Warnings: Warning 1265 Data truncated for column 'a' at row 1 @@ -1415,7 +1419,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 64) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(64) CHARACTER SET utf16 NOT NULL DEFAULT '' + `a` varchar(64) CHARACTER SET utf16 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (''); SELECT CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1; @@ -1464,7 +1468,7 @@ CREATE TABLE t1 AS SELECT repeat('a',2) as s1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `s1` varchar(2) CHARACTER SET utf16 NOT NULL DEFAULT '' + `s1` varchar(2) CHARACTER SET utf16 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE'); SELECT * FROM t1 ORDER BY s1; @@ -1549,7 +1553,7 @@ SELECT space(date_add(101, INTERVAL CHAR('1' USING utf16) hour_second)); space(date_add(101, INTERVAL CHAR('1' USING utf16) hour_second)) NULL Warnings: -Warning 1301 Result of space() was larger than max_allowed_packet (1048576) - truncated +Warning 1301 Result of space() was larger than max_allowed_packet (4194304) - truncated # # Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT # @@ -1596,7 +1600,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf16 NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET utf16 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -1616,7 +1620,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET utf16 NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET utf16 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -1846,7 +1850,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -1866,7 +1870,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -2127,3 +2131,73 @@ DEALLOCATE PREPARE stmt; # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character" +# +CREATE TABLE t1 ( +id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +a VARCHAR(10) CHARACTER SET utf16, KEY(a,id) +); +INSERT INTO t1 (a) VALUES (_utf8mb4 0x61); +INSERT INTO t1 (a) VALUES (_utf8mb4 0xC280),(_utf8mb4 0xDFBF); +INSERT INTO t1 (a) VALUES (_utf8mb4 0xE0A080),(_utf8mb4 0xEFBFBF); +INSERT INTO t1 (a) VALUES (_utf8mb4 0xF0908080),(_utf8mb4 0xF48FBFBF); +SELECT id,HEX(a) FROM t1 ORDER BY a,id; +id HEX(a) +1 0061 +2 0080 +3 07FF +4 0800 +6 D800DC00 +7 DBFFDFFF +5 FFFF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +5 FFFF +7 DBFFDFFF +6 D800DC00 +4 0800 +3 07FF +2 0080 +1 0061 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +6 +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16 COLLATE utf16_bin; +SELECT id,HEX(a) FROM t1 ORDER BY a; +id HEX(a) +1 0061 +2 0080 +3 07FF +4 0800 +5 FFFF +6 D800DC00 +7 DBFFDFFF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +7 DBFFDFFF +6 D800DC00 +5 FFFF +4 0800 +3 07FF +2 0080 +1 0061 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +7 +DROP TABLE t1; +# +# MDEV-9178 Wrong result for CAST(CONVERT('1IJ3' USING utf16) AS SIGNED) +# +SET NAMES utf8; +SELECT CAST(CONVERT('1IJ3' USING utf16) AS SIGNED); +CAST(CONVERT('1IJ3' USING utf16) AS SIGNED) +1 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '1IJ3' +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ctype_utf16_uca.result b/mysql-test/r/ctype_utf16_uca.result index e3ba73a9047..ac2ed9b2c5b 100644 --- a/mysql-test/r/ctype_utf16_uca.result +++ b/mysql-test/r/ctype_utf16_uca.result @@ -3045,8 +3045,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL DEFAULT '', - `b` int(1) NOT NULL DEFAULT '0' + `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL, + `b` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; @@ -3208,7 +3208,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -3228,7 +3228,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -3695,8 +3695,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_german2_ci NOT NULL DEFAULT '', - `b` int(1) NOT NULL DEFAULT '0' + `a` varchar(1) CHARACTER SET utf16 COLLATE utf16_german2_ci NOT NULL, + `b` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; @@ -3726,7 +3726,7 @@ CREATE TABLE t1 AS SELECT repeat('a', 10) as c LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` varchar(10) CHARACTER SET utf16 COLLATE utf16_unicode_520_ci NOT NULL DEFAULT '' + `c` varchar(10) CHARACTER SET utf16 COLLATE utf16_unicode_520_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (_utf32 0x0180),(_utf32 0x023A); INSERT INTO t1 VALUES (_utf32 0x023B),(_utf32 0x023C); @@ -4042,7 +4042,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `s1` varchar(64) CHARACTER SET utf16 COLLATE utf16_myanmar_ci NOT NULL DEFAULT '', + `s1` varchar(64) CHARACTER SET utf16 COLLATE utf16_myanmar_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (s1) VALUES diff --git a/mysql-test/r/ctype_utf16le.result b/mysql-test/r/ctype_utf16le.result index 8098b0d1666..93fce843dc8 100644 --- a/mysql-test/r/ctype_utf16le.result +++ b/mysql-test/r/ctype_utf16le.result @@ -102,8 +102,8 @@ RPAD(_utf16le X'2004',10,_utf16le X'2104') r; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `l` varchar(10) CHARACTER SET utf16le NOT NULL DEFAULT '', - `r` varchar(10) CHARACTER SET utf16le NOT NULL DEFAULT '' + `l` varchar(10) CHARACTER SET utf16le NOT NULL, + `r` varchar(10) CHARACTER SET utf16le NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT HEX(l), HEX(r) FROM t1; HEX(l) HEX(r) @@ -798,7 +798,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf16le COLLATE utf16le_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET utf16le COLLATE utf16le_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84); INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080); @@ -1474,6 +1474,8 @@ INSERT INTO t1 VALUES ('-1234.1e2xxxx'); Warnings: Warning 1265 Data truncated for column 'a' at row 1 INSERT INTO t1 VALUES ('-1234.1e2 '); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 INSERT INTO t1 VALUES ('123'); INSERT INTO t1 VALUES ('-124'); INSERT INTO t1 VALUES ('+125'); @@ -1520,6 +1522,8 @@ DROP TABLE t1; # CREATE TABLE t1 (a int); INSERT INTO t1 VALUES ('1 '); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 INSERT INTO t1 VALUES ('1 x'); Warnings: Warning 1265 Data truncated for column 'a' at row 1 @@ -1686,7 +1690,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 64) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(64) CHARACTER SET utf16le NOT NULL DEFAULT '' + `a` varchar(64) CHARACTER SET utf16le NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (''); SELECT CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1; @@ -1737,7 +1741,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',2) as s1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `s1` varchar(2) CHARACTER SET utf16le NOT NULL DEFAULT '' + `s1` varchar(2) CHARACTER SET utf16le NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE'); SELECT * FROM t1 ORDER BY s1; @@ -1809,7 +1813,7 @@ ALTER TABLE t1 ADD PRIMARY KEY(c); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` varchar(10) CHARACTER SET utf16le COLLATE utf16le_bin NOT NULL DEFAULT '', + `c` varchar(10) CHARACTER SET utf16le COLLATE utf16le_bin NOT NULL, PRIMARY KEY (`c`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('abc'),('zyx'),('acb'); @@ -1830,7 +1834,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf16le NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET utf16le NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -1850,7 +1854,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET utf16le NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET utf16le NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -2080,7 +2084,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf16le COLLATE utf16le_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET utf16le COLLATE utf16le_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -2100,7 +2104,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET utf16le COLLATE utf16le_bin NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET utf16le COLLATE utf16le_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -2319,3 +2323,73 @@ DFFFFFDFFFFF9CFFFF9DFFFF9EFFFF # # End of 5.6 tests # +# +# Start of 10.1 tests +# +# +# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character" +# +CREATE TABLE t1 ( +id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +a VARCHAR(10) CHARACTER SET utf16le, KEY(a,id) +); +INSERT INTO t1 (a) VALUES (_utf8mb4 0x61); +INSERT INTO t1 (a) VALUES (_utf8mb4 0xC280),(_utf8mb4 0xDFBF); +INSERT INTO t1 (a) VALUES (_utf8mb4 0xE0A080),(_utf8mb4 0xEFBFBF); +INSERT INTO t1 (a) VALUES (_utf8mb4 0xF0908080),(_utf8mb4 0xF48FBFBF); +SELECT id,HEX(a) FROM t1 ORDER BY a,id; +id HEX(a) +1 6100 +2 8000 +3 FF07 +4 0008 +6 00D800DC +7 FFDBFFDF +5 FFFF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +5 FFFF +7 FFDBFFDF +6 00D800DC +4 0008 +3 FF07 +2 8000 +1 6100 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +6 +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16le COLLATE utf16le_bin; +SELECT id,HEX(a) FROM t1 ORDER BY a; +id HEX(a) +1 6100 +2 8000 +3 FF07 +4 0008 +5 FFFF +6 00D800DC +7 FFDBFFDF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +7 FFDBFFDF +6 00D800DC +5 FFFF +4 0008 +3 FF07 +2 8000 +1 6100 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +7 +DROP TABLE t1; +# +# MDEV-9178 Wrong result for CAST(CONVERT('1IJ3' USING ucs2) AS SIGNED) +# +SET NAMES utf8; +SELECT CAST(CONVERT('1IJ3' USING utf16le) AS SIGNED); +CAST(CONVERT('1IJ3' USING utf16le) AS SIGNED) +1 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '1IJ3' +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result index 0ec89a50c0f..a0a8072265c 100644 --- a/mysql-test/r/ctype_utf32.result +++ b/mysql-test/r/ctype_utf32.result @@ -100,8 +100,8 @@ RPAD(_utf32 X'0420',10,_utf32 X'0421') r; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `l` varchar(10) CHARACTER SET utf32 NOT NULL DEFAULT '', - `r` varchar(10) CHARACTER SET utf32 NOT NULL DEFAULT '' + `l` varchar(10) CHARACTER SET utf32 NOT NULL, + `r` varchar(10) CHARACTER SET utf32 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select hex(l), hex(r) from t1; hex(l) hex(r) @@ -754,7 +754,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84); INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080); @@ -1252,6 +1252,8 @@ insert into t1 values ('-1234.1e2xxxx'); Warnings: Warning 1265 Data truncated for column 'a' at row 1 insert into t1 values ('-1234.1e2 '); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 select * from t1; a -123410 @@ -1260,6 +1262,8 @@ a drop table t1; create table t1 (a int); insert into t1 values ('1 '); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 insert into t1 values ('1 x'); Warnings: Warning 1265 Data truncated for column 'a' at row 1 @@ -1363,7 +1367,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 64) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(64) CHARACTER SET utf32 NOT NULL DEFAULT '' + `a` varchar(64) CHARACTER SET utf32 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (''); SELECT CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1; @@ -1478,7 +1482,7 @@ CREATE TABLE t1 AS SELECT repeat('a',2) as s1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `s1` varchar(2) CHARACTER SET utf32 NOT NULL DEFAULT '' + `s1` varchar(2) CHARACTER SET utf32 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE'); SELECT * FROM t1 ORDER BY s1; @@ -1571,7 +1575,7 @@ CREATE TABLE t1 AS SELECT format(123,2,'no_NO'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `format(123,2,'no_NO')` varchar(37) CHARACTER SET utf32 NOT NULL DEFAULT '' + `format(123,2,'no_NO')` varchar(37) CHARACTER SET utf32 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t1; format(123,2,'no_NO') @@ -1675,7 +1679,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf32 NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET utf32 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -1695,7 +1699,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET utf32 NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET utf32 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -1925,7 +1929,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -1945,7 +1949,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -2206,3 +2210,30 @@ DEALLOCATE PREPARE stmt; # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-8419 utf32: compare broken bytes as "greater than any non-broken character" +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf32, KEY(a)); +INSERT INTO t1 VALUES (0x10000),(0x10001),(0x10002); +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +1 +DROP TABLE t1; +SELECT _utf32 0x10001=_utf32 0x10002; +_utf32 0x10001=_utf32 0x10002 +1 +# +# MDEV-9178 Wrong result for CAST(CONVERT('1IJ3' USING ucs2) AS SIGNED) +# +SET NAMES utf8; +SELECT CAST(CONVERT('1IJ3' USING utf32) AS SIGNED); +CAST(CONVERT('1IJ3' USING utf32) AS SIGNED) +1 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '1IJ3' +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ctype_utf32_uca.result b/mysql-test/r/ctype_utf32_uca.result index d2032d401df..89a9e23bf45 100644 --- a/mysql-test/r/ctype_utf32_uca.result +++ b/mysql-test/r/ctype_utf32_uca.result @@ -3045,8 +3045,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL DEFAULT '', - `b` int(1) NOT NULL DEFAULT '0' + `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL, + `b` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; @@ -3228,7 +3228,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -3248,7 +3248,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -3715,8 +3715,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_german2_ci NOT NULL DEFAULT '', - `b` int(1) NOT NULL DEFAULT '0' + `a` varchar(1) CHARACTER SET utf32 COLLATE utf32_german2_ci NOT NULL, + `b` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; @@ -3746,7 +3746,7 @@ CREATE TABLE t1 AS SELECT repeat('a', 10) as c LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c` varchar(10) CHARACTER SET utf32 COLLATE utf32_unicode_520_ci NOT NULL DEFAULT '' + `c` varchar(10) CHARACTER SET utf32 COLLATE utf32_unicode_520_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (_utf32 0x0180),(_utf32 0x023A); INSERT INTO t1 VALUES (_utf32 0x023B),(_utf32 0x023C); @@ -4062,7 +4062,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `s1` varchar(64) CHARACTER SET utf32 COLLATE utf32_myanmar_ci NOT NULL DEFAULT '', + `s1` varchar(64) CHARACTER SET utf32 COLLATE utf32_myanmar_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (s1) VALUES diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 4123b06b0a7..63815bfa9ff 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -225,7 +225,7 @@ Warnings: Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 select hex(s1) from t1; hex(s1) -41 +413F drop table t1; create table t1 (s1 varchar(10) character set utf8); insert into t1 values (0x41FF); @@ -233,7 +233,7 @@ Warnings: Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 select hex(s1) from t1; hex(s1) -41 +413F drop table t1; create table t1 (s1 text character set utf8); insert into t1 values (0x41FF); @@ -241,7 +241,7 @@ Warnings: Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 select hex(s1) from t1; hex(s1) -41 +413F drop table t1; create table t1 (a text character set utf8, primary key(a(371))); ERROR 42000: Specified key was too long; max key length is 1000 bytes @@ -901,8 +901,8 @@ create table t2 select concat(a,_utf8'') as a, concat(b,_utf8'')as b from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` varchar(5) CHARACTER SET utf8 NOT NULL DEFAULT '', - `b` varchar(15) CHARACTER SET utf8 NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET utf8 NOT NULL, + `b` varchar(15) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t2; drop table t1; @@ -1126,8 +1126,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '', - `b` int(1) NOT NULL DEFAULT '0' + `a` varchar(1) CHARACTER SET utf8 NOT NULL, + `b` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; @@ -1160,8 +1160,8 @@ STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)) CREATE TABLE t1 AS SELECT REPEAT(' ', 64) AS subject, REPEAT(' ',64) AS pattern LIMIT 0; SHOW COLUMNS FROM t1; Field Type Null Key Default Extra -subject varchar(64) NO -pattern varchar(64) NO +subject varchar(64) NO NULL +pattern varchar(64) NO NULL INSERT INTO t1 VALUES (_utf8'2001÷01÷01',_utf8'%Y÷%m÷%d'); SELECT HEX(subject),HEX(pattern),STR_TO_DATE(subject, pattern) FROM t1; HEX(subject) HEX(pattern) STR_TO_DATE(subject, pattern) @@ -1919,9 +1919,9 @@ Warnings: Warning 1300 Invalid utf8 character string: 'FF8F' select convert(char(0xff,0x8f) using utf8); convert(char(0xff,0x8f) using utf8) - +?? Warnings: -Warning 1300 Invalid utf8 character string: 'FF8F' +Warning 1300 Invalid utf8 character string: '\xFF\x8F' set sql_mode=traditional; select char(0xff,0x8f using utf8); char(0xff,0x8f using utf8) @@ -1947,7 +1947,7 @@ select convert(char(0xff,0x8f) using utf8); convert(char(0xff,0x8f) using utf8) NULL Warnings: -Warning 1300 Invalid utf8 character string: 'FF8F' +Warning 1300 Invalid utf8 character string: '\xFF\x8F' select hex(convert(char(2557 using latin1) using utf8)); hex(convert(char(2557 using latin1) using utf8)) 09C3BD @@ -2116,7 +2116,7 @@ select hex(convert(0xFF using utf8)); hex(convert(0xFF using utf8)) NULL Warnings: -Warning 1300 Invalid utf8 character string: 'FF' +Warning 1300 Invalid utf8 character string: '\xFF' select hex(_utf8 0x616263FF); ERROR HY000: Invalid utf8 character string: 'FF' select hex(_utf8 X'616263FF'); @@ -2133,9 +2133,9 @@ Warnings: Warning 1300 Invalid utf8 character string: 'FF' select hex(convert(0xFF using utf8)); hex(convert(0xFF using utf8)) - +3F Warnings: -Warning 1300 Invalid utf8 character string: 'FF' +Warning 1300 Invalid utf8 character string: '\xFF' select hex(_utf8 0x616263FF); ERROR HY000: Invalid utf8 character string: 'FF' select hex(_utf8 X'616263FF'); @@ -2464,7 +2464,7 @@ create table t1 as select concat(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select hex(c1) from t1; hex(c1) @@ -2477,7 +2477,7 @@ create table t1 as select concat(18446744073709551615) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(20) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(20) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select hex(c1) from t1; hex(c1) @@ -2490,7 +2490,7 @@ create table t1 as select concat(1.1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(4) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select hex(c1) from t1; hex(c1) @@ -2503,7 +2503,7 @@ create table t1 as select concat(1+2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1-2)); @@ -2513,7 +2513,7 @@ create table t1 as select concat(1-2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1*2)); @@ -2523,7 +2523,7 @@ create table t1 as select concat(1*2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1/2)); @@ -2563,7 +2563,7 @@ create table t1 as select concat(-1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(-(1+2))); @@ -2573,7 +2573,7 @@ create table t1 as select concat(-(1+2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(4) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1|2)); @@ -2583,7 +2583,7 @@ create table t1 as select concat(1|2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(1&2)); @@ -2593,7 +2593,7 @@ create table t1 as select concat(1&2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(bit_count(12))); @@ -2603,7 +2603,7 @@ create table t1 as select concat(bit_count(12)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(2<<1)); @@ -2613,7 +2613,7 @@ create table t1 as select concat(2<<1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(2>>1)); @@ -2623,7 +2623,7 @@ create table t1 as select concat(2>>1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(~0)); @@ -2633,7 +2633,7 @@ create table t1 as select concat(~0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(3^2)); @@ -2643,7 +2643,7 @@ create table t1 as select concat(3^2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(abs(-2))); @@ -2653,7 +2653,7 @@ create table t1 as select concat(abs(-2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(left(concat(exp(2)),1)); @@ -2783,7 +2783,7 @@ create table t1 as select concat(degrees(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(23) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(radians(0))); @@ -2793,7 +2793,7 @@ create table t1 as select concat(radians(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(23) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ceiling(0.5))); @@ -2803,7 +2803,7 @@ create table t1 as select concat(ceiling(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(4) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(floor(0.5))); @@ -2813,7 +2813,7 @@ create table t1 as select concat(floor(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(4) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(round(0.5))); @@ -2823,7 +2823,7 @@ create table t1 as select concat(round(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(sign(0.5))); @@ -2833,14 +2833,14 @@ create table t1 as select concat(sign(0.5)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(rand()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(23) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(23) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(length('a'))); @@ -2850,7 +2850,7 @@ create table t1 as select concat(length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(char_length('a'))); @@ -2860,7 +2860,7 @@ create table t1 as select concat(char_length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(bit_length('a'))); @@ -2870,7 +2870,7 @@ create table t1 as select concat(bit_length('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(coercibility('a'))); @@ -2880,7 +2880,7 @@ create table t1 as select concat(coercibility('a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(locate('a','a'))); @@ -2890,7 +2890,7 @@ create table t1 as select concat(locate('a','a')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(11) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(11) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(field('c','a','b','c'))); @@ -2900,7 +2900,7 @@ create table t1 as select concat(field('c','a','b','c')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ascii(61))); @@ -2910,7 +2910,7 @@ create table t1 as select concat(ascii(61)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ord(61))); @@ -2920,7 +2920,7 @@ create table t1 as select concat(ord(61)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(find_in_set('b','a,b,c,d'))); @@ -2930,7 +2930,7 @@ create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select md5('a'), hex(md5('a')); @@ -2940,7 +2940,7 @@ create table t1 as select md5('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(32) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select old_password('a'), hex(old_password('a')); @@ -2950,7 +2950,7 @@ create table t1 as select old_password('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(16) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(16) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select password('a'), hex(password('a')); @@ -2960,7 +2960,7 @@ create table t1 as select password('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(41) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(41) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select sha('a'), hex(sha('a')); @@ -2970,7 +2970,7 @@ create table t1 as select sha('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(40) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(40) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select sha1('a'), hex(sha1('a')); @@ -2980,7 +2980,7 @@ create table t1 as select sha1('a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(40) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(40) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(cast('-1' as signed))); @@ -2990,7 +2990,7 @@ create table t1 as select concat(cast('-1' as signed)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(cast('1' as unsigned))); @@ -3000,7 +3000,7 @@ create table t1 as select concat(cast('1' as unsigned)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(cast(1/2 as decimal(5,5)))); @@ -3059,7 +3059,7 @@ create table t1 as select concat(least(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(greatest(1,2))); @@ -3069,7 +3069,7 @@ create table t1 as select concat(greatest(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(case when 11 then 22 else 33 end)); @@ -3079,7 +3079,7 @@ create table t1 as select concat(case when 11 then 22 else 33 end) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(coalesce(1,2))); @@ -3089,7 +3089,7 @@ create table t1 as select concat(coalesce(1,2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat_ws(1,2,3)); @@ -3099,7 +3099,7 @@ create table t1 as select concat_ws(1,2,3) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(group_concat(1,2,3)); @@ -3127,7 +3127,7 @@ create table t1 as select concat(last_insert_id()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(benchmark(0,0))); @@ -3137,7 +3137,7 @@ create table t1 as select concat(benchmark(0,0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(sleep(0))); @@ -3147,7 +3147,7 @@ create table t1 as select concat(sleep(0)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(is_free_lock('xxxx'))); @@ -3181,7 +3181,7 @@ create table t1 as select concat(crc32('')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(uncompressed_length(''))); @@ -3198,7 +3198,7 @@ create table t1 as select concat(connection_id()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(inet_aton('127.1.1.1'))); @@ -3234,7 +3234,7 @@ create table t1 as select concat(row_count()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(found_rows())); @@ -3244,21 +3244,21 @@ create table t1 as select concat(found_rows()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(uuid_short()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(21) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(uuid()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(36) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select coercibility(uuid()), coercibility(cast('a' as char character set latin1)); @@ -3271,7 +3271,7 @@ create table t1 as select concat(uuid(), cast('a' as char character set latin1)) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(37) NOT NULL DEFAULT '' + `c1` varchar(37) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1; @@ -3291,8 +3291,8 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '', - `c2` int(1) NOT NULL DEFAULT '0' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL, + `c2` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; set @a2=1; @@ -3349,8 +3349,8 @@ hex(c1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '', - `c2` decimal(2,1) NOT NULL DEFAULT '0.0' + `c1` varchar(4) CHARACTER SET utf8 NOT NULL, + `c2` decimal(2,1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; set @a2=1.1; @@ -3388,7 +3388,7 @@ create table t1 as select concat('a'='a' IS TRUE) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a'='a' IS NOT TRUE)); @@ -3398,7 +3398,7 @@ create table t1 as select concat('a'='a' IS NOT TRUE) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(NOT 'a'='a')); @@ -3408,7 +3408,7 @@ create table t1 as select concat(NOT 'a'='a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' IS NULL)); @@ -3418,7 +3418,7 @@ create table t1 as select concat('a' IS NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' IS NOT NULL)); @@ -3428,7 +3428,7 @@ create table t1 as select concat('a' IS NOT NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' rlike 'a')); @@ -3438,7 +3438,7 @@ create table t1 as select concat('a' IS NOT NULL) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(strcmp('a','b'))); @@ -3448,7 +3448,7 @@ create table t1 as select concat(strcmp('a','b')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' like 'a')); @@ -3458,7 +3458,7 @@ create table t1 as select concat('a' like 'b') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' between 'b' and 'c')); @@ -3468,7 +3468,7 @@ create table t1 as select concat('a' between 'b' and 'c') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat('a' in ('a','b'))); @@ -3478,7 +3478,7 @@ create table t1 as select concat('a' in ('a','b')) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(interval(23, 1, 15, 17, 30, 44, 200))); @@ -3488,7 +3488,7 @@ create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a varchar(10), fulltext key(a)); @@ -3510,7 +3510,7 @@ create table t1 as select ifnull(1,'a') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ifnull(1,1))); @@ -3520,7 +3520,7 @@ create table t1 as select concat(ifnull(1,1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(ifnull(1.1,1.1))); @@ -3530,7 +3530,7 @@ create table t1 as select concat(ifnull(1.1,1.1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(4) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(if(1,'b',1)); @@ -3540,7 +3540,7 @@ create table t1 as select if(1,'b',1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(if(1,1,'b')); @@ -3550,7 +3550,7 @@ create table t1 as select if(1,1,'b') as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(if(1,1,1))); @@ -3560,7 +3560,7 @@ create table t1 as select concat(if(1,1,1)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(nullif(1,2))); @@ -3640,7 +3640,7 @@ create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); @@ -3650,7 +3650,7 @@ create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); @@ -3725,7 +3725,7 @@ create table t1 as select concat(period_add(200902, 2)) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(6) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(period_diff(200902, 200802))); @@ -3737,7 +3737,7 @@ Warning 1265 Data truncated for column 'c1' at row 1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(6) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(to_days(20090224))); @@ -3934,21 +3934,21 @@ create table t1 as select concat(curdate()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(utc_date()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(curtime()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select repeat('a',20) as c1 limit 0; @@ -3964,7 +3964,7 @@ create table t1 as select concat(utc_time()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(sec_to_time(2378))); @@ -4057,21 +4057,21 @@ create table t1 as select concat(now()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(19) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(utc_timestamp()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(19) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select concat(sysdate()) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(19) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(addtime('00:00:00','11:22:33'))); @@ -4111,7 +4111,7 @@ create table t1 as select export_set(1,2,3,4,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(127) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(127) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(insert(1133,3,0,22)); @@ -4121,7 +4121,7 @@ create table t1 as select insert(1133,3,0,22) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(6) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(6) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(lcase(123)); @@ -4131,7 +4131,7 @@ create table t1 as select lcase(123) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(left(123,1)); @@ -4141,7 +4141,7 @@ create table t1 as select left(123,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(lower(123)); @@ -4151,7 +4151,7 @@ create table t1 as select lower(123) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(3) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(lpad(1,2,0)); @@ -4161,7 +4161,7 @@ create table t1 as select lpad(1,2,0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(ltrim(1)); @@ -4171,7 +4171,7 @@ create table t1 as select ltrim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(mid(1,1,1)); @@ -4181,7 +4181,7 @@ create table t1 as select mid(1,1,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(repeat(1,2)); @@ -4191,7 +4191,7 @@ create table t1 as select repeat(1,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(replace(1,1,2)); @@ -4201,7 +4201,7 @@ create table t1 as select replace(1,1,2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(reverse(12)); @@ -4211,7 +4211,7 @@ create table t1 as select reverse(12) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(right(123,1)); @@ -4221,7 +4221,7 @@ create table t1 as select right(123,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(rpad(1,2,0)); @@ -4231,7 +4231,7 @@ create table t1 as select rpad(1,2,0) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(2) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(rtrim(1)); @@ -4241,7 +4241,7 @@ create table t1 as select rtrim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(soundex(1)); @@ -4251,7 +4251,7 @@ create table t1 as select soundex(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(4) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(substring(1,1,1)); @@ -4261,7 +4261,7 @@ create table t1 as select substring(1,1,1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(trim(1)); @@ -4271,7 +4271,7 @@ create table t1 as select trim(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(ucase(1)); @@ -4281,7 +4281,7 @@ create table t1 as select ucase(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(upper(1)); @@ -4291,14 +4291,14 @@ create table t1 as select upper(1) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 as select repeat(' ', 64) as a limit 0; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT '' + `a` varchar(64) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ("1.1"), ("2.1"); select a, hex(a) from t1; @@ -4527,7 +4527,7 @@ t2 CREATE TABLE `t2` ( `concat(a)` varbinary(64) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1, t2; -create table t1 (a timestamp); +create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values (0); insert into t1 values (20010203040506); insert into t1 values (19800203040506); @@ -4548,7 +4548,7 @@ create table t2 as select concat(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `concat(a)` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '' + `concat(a)` varchar(19) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1, t2; create table t1 (a date); @@ -4839,7 +4839,7 @@ hex(a) 0000000000000001 drop table t1; drop view v1; -create table t1 (a timestamp); +create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values (0); insert into t1 values (20010203040506); insert into t1 values (19800203040506); @@ -5088,7 +5088,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `CONCAT(a)` varchar(9) CHARACTER SET utf8 DEFAULT NULL, - `IFNULL(a,'')` varchar(9) CHARACTER SET utf8 NOT NULL DEFAULT '', + `IFNULL(a,'')` varchar(9) CHARACTER SET utf8 NOT NULL, `IF(a,a,'')` varchar(9) CHARACTER SET utf8 DEFAULT NULL, `CASE WHEN a THEN a ELSE '' END` varchar(9) CHARACTER SET utf8 DEFAULT NULL, `COALESCE(a,'')` varchar(9) CHARACTER SET utf8 DEFAULT NULL @@ -5098,14 +5098,14 @@ CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '' + `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET utf8 NOT NULL DEFAULT '' + `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT LCASE(a) FROM t1; @@ -5126,35 +5126,35 @@ CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `REPEAT(1,2)` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '' + `REPEAT(1,2)` varchar(2) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `LEFT(123,2)` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '' + `LEFT(123,2)` varchar(2) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `RIGHT(123,2)` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '' + `RIGHT(123,2)` varchar(2) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `LTRIM(123)` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '' + `LTRIM(123)` varchar(3) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `RTRIM(123)` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '' + `RTRIM(123)` varchar(3) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1; @@ -5168,35 +5168,35 @@ CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `REPLACE(111,2,3)` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '' + `REPLACE(111,2,3)` varchar(3) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '' + `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET utf8 NOT NULL DEFAULT '' + `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `SOUNDEX(1)` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '' + `SOUNDEX(1)` varchar(4) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8); SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT '' + `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; DROP TABLE t1; @@ -5220,7 +5220,7 @@ id select_type table type possible_keys key key_len ref rows Extra ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL; EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range date_column date_column 9 NULL 1 Using index condition +1 SIMPLE t1 range date_column date_column 6 NULL 1 Using index condition DROP TABLE t1; # # Bug #31384 DATE_ADD() and DATE_SUB() return binary data @@ -5360,7 +5360,7 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `d` date DEFAULT NULL, - `bad` varchar(10) CHARACTER SET utf8 DEFAULT NULL + `bad` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1, t2; SET NAMES latin1; @@ -5374,7 +5374,8 @@ DROP TABLE t1; SET sql_mode=default; # # Bug#57687 crash when reporting duplicate group_key error and utf8 -# Make sure to modify this when Bug#58081 is fixed. +# Bug#58081 Duplicate entry error when doing GROUP BY +# MDEV-9332 Bug after upgrade to 10.1.10 # SET NAMES utf8; CREATE TABLE t1 (a INT); @@ -5443,7 +5444,7 @@ ADD KEY(ch); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `ch` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '', + `ch` varchar(60) CHARACTER SET utf8 NOT NULL, `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `ch` (`ch`) @@ -5470,10 +5471,22 @@ SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch; ch SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch; ch +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch; ch Warnings: Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch; ch Warnings: @@ -5516,6 +5529,12 @@ ab az aЀ aÖ€ +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch; ch a @@ -5537,6 +5556,12 @@ aЀ aÖ€ Warnings: Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch; ch a @@ -5564,11 +5589,23 @@ z SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch; ch z +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch; ch z Warnings: Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch; ch z @@ -5604,11 +5641,11 @@ a?z ab az aЀ +aÖ€ SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch'); PREPARE stmt FROM @query; EXECUTE stmt; ch -aÖ€ z # 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch'); @@ -5651,7 +5688,7 @@ ADD KEY(ch); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `ch` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '', + `ch` varchar(60) CHARACTER SET utf8 NOT NULL, `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `ch` (`ch`) @@ -5678,10 +5715,22 @@ SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch; ch SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch; ch +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch; ch Warnings: Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch; ch Warnings: @@ -5724,6 +5773,12 @@ ab az aЀ aÖ€ +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch; ch a @@ -5745,6 +5800,12 @@ aЀ aÖ€ Warnings: Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch; ch a @@ -5772,11 +5833,23 @@ z SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch; ch z +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch; ch z Warnings: Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 182 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch; ch z @@ -5812,11 +5885,11 @@ a?z ab az aЀ +aÖ€ SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch'); PREPARE stmt FROM @query; EXECUTE stmt; ch -aÖ€ z # 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch'); @@ -5859,7 +5932,7 @@ ADD KEY(ch); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `ch` varchar(60) CHARACTER SET utf8 NOT NULL DEFAULT '', + `ch` varchar(60) CHARACTER SET utf8 NOT NULL, `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `ch` (`ch`) @@ -5886,10 +5959,22 @@ SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch; ch SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch; ch +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†' ORDER BY ch; ch Warnings: Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='aðŒ†b' ORDER BY ch; ch Warnings: @@ -5932,6 +6017,10 @@ ab az aЀ aÖ€ +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†' ORDER BY ch; ch a @@ -5951,6 +6040,10 @@ ab az aЀ aÖ€ +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'aðŒ†b' ORDER BY ch; ch a @@ -5976,9 +6069,17 @@ z SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch; ch z +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†' ORDER BY ch; ch z +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'aðŒ†b' ORDER BY ch; ch z @@ -6012,11 +6113,11 @@ a?z ab az aЀ +aÖ€ SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch'); PREPARE stmt FROM @query; EXECUTE stmt; ch -aÖ€ z # 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch'); @@ -6080,11 +6181,11 @@ FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `c0` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '', - `c1` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '', - `c2` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '', - `c3` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '', - `c4` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c0` varchar(19) CHARACTER SET utf8 NOT NULL, + `c1` varchar(19) CHARACTER SET utf8 NOT NULL, + `c2` varchar(19) CHARACTER SET utf8 NOT NULL, + `c3` varchar(19) CHARACTER SET utf8 NOT NULL, + `c4` varchar(19) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t2; c0 c1 c2 c3 c4 @@ -6124,7 +6225,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -6144,7 +6245,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET utf8 NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -6368,7 +6469,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -6388,7 +6489,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -6640,7 +6741,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; @@ -6663,7 +6764,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); @@ -6686,7 +6787,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); @@ -6709,7 +6810,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); @@ -6728,6 +6829,31 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) DROP TABLE t1; +# +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 1 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 1 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (not((`test`.`t1`.`a` like 'a ')))) +DROP TABLE t1; +# +# End of MDEV-8694 +# SET NAMES utf8; # # MDEV-7149 Constant condition propagation erroneously applied for LIKE @@ -6736,7 +6862,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE CONCAT(c1)='a'; @@ -6759,7 +6885,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('a'),('a '); SELECT * FROM t1 WHERE 'a'=CONCAT(c1); @@ -6782,7 +6908,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '% '=CONCAT(c1); @@ -6805,7 +6931,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('%'),('% '); SELECT * FROM t1 WHERE '%'=CONCAT(c1); @@ -6825,13 +6951,38 @@ Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where (('%' = concat(`test`.`t1`.`c1`)) and ('a' like concat(`test`.`t1`.`c1`))) DROP TABLE t1; # +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET utf8 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 1 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 1 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where ((not((`test`.`t1`.`a` like 'a '))) and (`test`.`t1`.`a` = 'a')) +DROP TABLE t1; +# +# End of MDEV-8694 +# +# # MDEV-7149 Constant condition propagation erroneously applied for LIKE # CREATE TABLE t1 AS SELECT REPEAT('a',10) AS c1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('ae'),('ä'); SELECT * FROM t1 WHERE c1='ä'; @@ -10028,3 +10179,234 @@ DROP TABLE allbytes; # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-6572 "USE dbname" with a bad sequence erroneously connects to a wrong database +# +SET NAMES utf8; +SELECT * FROM `testðŸ˜ðŸ˜test`; +ERROR HY000: Invalid utf8 character string: 'test\xF0\x9F\x98\x81\xF0\x9F\x98\x81test' +# +#MDEV-8256 A part of a ROW comparison is erroneously optimized away +# +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8); +INSERT INTO t1 VALUES ('1e1'),('1é1'); +SELECT * FROM t1 WHERE a=10; +a +1e1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1é1' +SELECT * FROM t1 WHERE a='1e1'; +a +1e1 +1é1 +SELECT * FROM t1 WHERE a=10 AND a='1e1'; +a +1e1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1é1' +SELECT * FROM t1 WHERE (a,a)=(10,'1e1'); +a +1e1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1é1' +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a,a)=(10,'1e1'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 10) and (`test`.`t1`.`a` = '1e1')) +DROP TABLE t1; +# +# MDEV-8688 Wrong result for SELECT..WHERE varchar_column IN (1,2,3) AND varchar_column=' 1'; +# +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1); +INSERT INTO t1 VALUES ('1e1'),('1ë1'); +SELECT * FROM t1 WHERE a IN (1,2); +a +1ë1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1ë1' +SELECT * FROM t1 WHERE a IN (1,2) AND a='1ë1'; +a +1ë1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1ë1' +SELECT * FROM t1 WHERE a IN (1,2,'x') AND a='1ë1'; +a +1ë1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1ë1' +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2) AND a='1ë1'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '1ë1') and (`test`.`t1`.`a` in (1,2))) +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,'x') AND a='1ë1'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '1ë1') and (`test`.`t1`.`a` in (1,2,'x'))) +DROP TABLE IF EXISTS t1; +# +# MDEV-8816 Equal field propagation is not applied for WHERE varbinary_column>=_utf8'a' COLLATE utf8_swedish_ci AND varbinary_column='A'; +# +CREATE TABLE t1 (c VARBINARY(10)); +INSERT INTO t1 VALUES ('a'),('A'); +SELECT * FROM t1 WHERE c>=_utf8'a' COLLATE utf8_general_ci AND c='A'; +c +A +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE c>=_utf8'a' COLLATE utf8_general_ci AND c='A'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c` AS `c` from `test`.`t1` where (`test`.`t1`.`c` = 'A') +DROP TABLE t1; +# +# MDEV-7231 Field ROUTINE_DEFINITION in INFORMATION_SCHEMA.`ROUTINES` contains broken procedure body when used shielding quotes inside. +# +CREATE PROCEDURE p1() +BEGIN +SELECT CONCAT('ABC = ''',1,''''), CONCAT('ABC = ',2); +SELECT '''', """", '\'', "\""; +SELECT '<tab> <tab>\t<tab>'; +SELECT '<nl> +<nl>\n<nl>'; +SELECT 'test'; +SELECT 'tëst'; +SELECT 'test\0'; +SELECT 'tëst\0'; +SELECT _binary'test'; +SELECT _binary'test\0'; +SELECT N'''', N"""", N'\'', N"\""; +SELECT N'<tab> <tab>\t<tab>'; +SELECT N'<nl> +<nl>\n<nl>'; +SELECT N'test'; +SELECT N'tëst'; +SELECT N'test\0'; +SELECT N'tëst\0'; +END$$ +SELECT ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES +WHERE ROUTINE_SCHEMA='test' AND SPECIFIC_NAME ='p1'; +ROUTINE_DEFINITION +BEGIN +SELECT CONCAT('ABC = ''',1,''''), CONCAT('ABC = ',2); +SELECT '''', """", '''', """"; +SELECT '<tab>\t<tab>\t<tab>'; +SELECT '<nl>\n<nl>\n<nl>'; +SELECT 'test'; +SELECT 'tëst'; +SELECT 'test\0'; +SELECT 'tëst\0'; +SELECT 'test'; +SELECT 'test\0'; +SELECT N'''', N"""", N'''', N""""; +SELECT N'<tab>\t<tab>\t<tab>'; +SELECT N'<nl>\n<nl>\n<nl>'; +SELECT N'test'; +SELECT N'tëst'; +SELECT N'test\0'; +SELECT N'tëst\0'; +END +SELECT body_utf8 FROM mysql.proc WHERE name='p1'; +body_utf8 +BEGIN +SELECT CONCAT('ABC = ''',1,''''), CONCAT('ABC = ',2); +SELECT '''', """", '''', """"; +SELECT '<tab>\t<tab>\t<tab>'; +SELECT '<nl>\n<nl>\n<nl>'; +SELECT 'test'; +SELECT 'tëst'; +SELECT 'test\0'; +SELECT 'tëst\0'; +SELECT 'test'; +SELECT 'test\0'; +SELECT N'''', N"""", N'''', N""""; +SELECT N'<tab>\t<tab>\t<tab>'; +SELECT N'<nl>\n<nl>\n<nl>'; +SELECT N'test'; +SELECT N'tëst'; +SELECT N'test\0'; +SELECT N'tëst\0'; +END +DROP PROCEDURE p1; +SET @@SQL_MODE='NO_BACKSLASH_ESCAPES'; +CREATE PROCEDURE p1() +BEGIN +SELECT CONCAT('ABC = ''',1,''''), CONCAT('ABC = ',2); +SELECT '''', """"; +SELECT '<tab> <tab>\t<tab>'; +SELECT '<nl> +<nl>\n<nl>'; +SELECT 'test'; +SELECT 'tëst'; +SELECT 'test\0'; +SELECT 'tëst\0'; +SELECT _binary'test'; +SELECT _binary'test\0'; +SELECT N'''', N""""; +SELECT N'<tab> <tab>\t<tab>'; +SELECT N'<nl> +<nl>\n<nl>'; +SELECT N'test'; +SELECT N'tëst'; +SELECT N'test\0'; +SELECT N'tëst\0'; +END$$ +SELECT ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES +WHERE ROUTINE_SCHEMA='test' AND SPECIFIC_NAME ='p1'; +ROUTINE_DEFINITION +BEGIN +SELECT CONCAT('ABC = ''',1,''''), CONCAT('ABC = ',2); +SELECT '''', """"; +SELECT '<tab> <tab>\t<tab>'; +SELECT '<nl> +<nl>\n<nl>'; +SELECT 'test'; +SELECT 'tëst'; +SELECT 'test\0'; +SELECT 'tëst\0'; +SELECT 'test'; +SELECT 'test\0'; +SELECT N'''', N""""; +SELECT N'<tab> <tab>\t<tab>'; +SELECT N'<nl> +<nl>\n<nl>'; +SELECT N'test'; +SELECT N'tëst'; +SELECT N'test\0'; +SELECT N'tëst\0'; +END +SELECT body_utf8 FROM mysql.proc WHERE name='p1'; +body_utf8 +BEGIN +SELECT CONCAT('ABC = ''',1,''''), CONCAT('ABC = ',2); +SELECT '''', """"; +SELECT '<tab> <tab>\t<tab>'; +SELECT '<nl> +<nl>\n<nl>'; +SELECT 'test'; +SELECT 'tëst'; +SELECT 'test\0'; +SELECT 'tëst\0'; +SELECT 'test'; +SELECT 'test\0'; +SELECT N'''', N""""; +SELECT N'<tab> <tab>\t<tab>'; +SELECT N'<nl> +<nl>\n<nl>'; +SELECT N'test'; +SELECT N'tëst'; +SELECT N'test\0'; +SELECT N'tëst\0'; +END +DROP PROCEDURE p1; +SET @@SQL_MODE=default; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ctype_utf8mb4.result b/mysql-test/r/ctype_utf8mb4.result index d8e97371294..10d77ae1502 100644 --- a/mysql-test/r/ctype_utf8mb4.result +++ b/mysql-test/r/ctype_utf8mb4.result @@ -225,7 +225,7 @@ Warnings: Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 select hex(s1) from t1; hex(s1) -41 +413F drop table t1; create table t1 (s1 varchar(10) character set utf8mb4); insert into t1 values (0x41FF); @@ -233,7 +233,7 @@ Warnings: Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 select hex(s1) from t1; hex(s1) -41 +413F drop table t1; create table t1 (s1 text character set utf8mb4); insert into t1 values (0x41FF); @@ -241,7 +241,7 @@ Warnings: Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 select hex(s1) from t1; hex(s1) -41 +413F drop table t1; create table t1 (a text character set utf8mb4, primary key(a(371))); ERROR 42000: Specified key was too long; max key length is 1000 bytes @@ -901,8 +901,8 @@ create table t2 select concat(a,_utf8mb4'') as a, concat(b,_utf8mb4'')as b from show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL DEFAULT '', - `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL, + `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t2; drop table t1; @@ -1126,8 +1126,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL DEFAULT '', - `b` int(1) NOT NULL DEFAULT '0' + `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL, + `b` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; @@ -1233,7 +1233,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (_utf8mb4 0xEFBE9D),(_utf8mb4 0xF0908E84); INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080); @@ -1944,9 +1944,9 @@ Warnings: Warning 1300 Invalid utf8mb4 character string: 'FF8F' select convert(char(0xff,0x8f) using utf8mb4); convert(char(0xff,0x8f) using utf8mb4) - +?? Warnings: -Warning 1300 Invalid utf8mb4 character string: 'FF8F' +Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F' set sql_mode=traditional; select char(0xff,0x8f using utf8mb4); char(0xff,0x8f using utf8mb4) @@ -1972,7 +1972,7 @@ select convert(char(0xff,0x8f) using utf8mb4); convert(char(0xff,0x8f) using utf8mb4) NULL Warnings: -Warning 1300 Invalid utf8mb4 character string: 'FF8F' +Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F' select hex(convert(char(2557 using latin1) using utf8mb4)); hex(convert(char(2557 using latin1) using utf8mb4)) 09C3BD @@ -2141,7 +2141,7 @@ select hex(convert(0xFF using utf8mb4)); hex(convert(0xFF using utf8mb4)) NULL Warnings: -Warning 1300 Invalid utf8mb4 character string: 'FF' +Warning 1300 Invalid utf8mb4 character string: '\xFF' select hex(_utf8mb4 0x616263FF); ERROR HY000: Invalid utf8mb4 character string: 'FF' select hex(_utf8mb4 X'616263FF'); @@ -2158,9 +2158,9 @@ Warnings: Warning 1300 Invalid utf8mb4 character string: 'FF' select hex(convert(0xFF using utf8mb4)); hex(convert(0xFF using utf8mb4)) - +3F Warnings: -Warning 1300 Invalid utf8mb4 character string: 'FF' +Warning 1300 Invalid utf8mb4 character string: '\xFF' select hex(_utf8mb4 0x616263FF); ERROR HY000: Invalid utf8mb4 character string: 'FF' select hex(_utf8mb4 X'616263FF'); @@ -2327,7 +2327,7 @@ select hex(utf8mb4) from t1; hex(utf8mb4) F0908080 F0BFBFBF - +3F delete from t1; Testing [F2..F3][80..BF][80..BF][80..BF] insert into t1 values (0xF2808080); @@ -2347,7 +2347,7 @@ select hex(utf8mb4) from t1; hex(utf8mb4) F4808080 F48F8080 - +3F drop table t1; # # Check strnxfrm() with odd length @@ -2472,45 +2472,45 @@ F3A087AFEA9DA8 F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8 EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEA9DA8 F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8 -EA9DA8 +3F3F3F3FEA9DA8 SELECT HEX(CONCAT(utf8mb4_encoding, utf8mb3_encoding)) FROM t1,t2; HEX(CONCAT(utf8mb4_encoding, utf8mb3_encoding)) F09D8480EA9DA8 F09D8480EFB9AB -F09D8480 +F09D84803F3F3F3F F09D849EEA9DA8 F09D849EEFB9AB -F09D849E +F09D849E3F3F3F3F F09D859EEA9DA8 F09D859EEFB9AB -F09D859E +F09D859E3F3F3F3F F09D878FEA9DA8 F09D878FEFB9AB -F09D878F +F09D878F3F3F3F3F F09D9C9FEA9DA8 F09D9C9FEFB9AB -F09D9C9F +F09D9C9F3F3F3F3F F09D9E9FEA9DA8 F09D9E9FEFB9AB -F09D9E9F +F09D9E9F3F3F3F3F F48FBFBFEA9DA8 F48FBFBFEFB9AB -F48FBFBF +F48FBFBF3F3F3F3F F3A087AFEA9DA8 F3A087AFEFB9AB -F3A087AF +F3A087AF3F3F3F3F F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8 F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EFB9AB -F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480 +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D84803F3F3F3F EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEA9DA8 EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEFB9AB -EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9AB +EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9AB3F3F3F3F F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8 F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EFB9AB -F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480 -EA9DA8 -EFB9AB - +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D84803F3F3F3F +3F3F3F3FEA9DA8 +3F3F3F3FEFB9AB +3F3F3F3F3F3F3F3F SELECT count(*) FROM t1, t2 WHERE t1.utf8mb4_encoding > t2.utf8mb3_encoding; count(*) @@ -2547,7 +2547,7 @@ u_decimal hex(utf8mb4_encoding) utf8mb4_encoding 119070 3F3F3F3F3F3F3F3F3F3F ?????????? 65131 EFB9AB3F3F3F3F3FEFB9ABEFB9AB3FEFB9AB ﹫?????﹫﹫?﹫ 119070 3F3F3F3F3F3F3F3F3F3F ?????????? -1114111 +1114111 3F3F3F3F ???? ALTER TABLE t2 CONVERT TO CHARACTER SET utf8mb4; SHOW CREATE TABLE t2; Table Create Table @@ -2559,7 +2559,7 @@ SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) 42856 EA9DA8 65131 EFB9AB -1114111 +1114111 3F3F3F3F ALTER TABLE t2 CONVERT TO CHARACTER SET utf8mb3; SHOW CREATE TABLE t2; Table Create Table @@ -2571,7 +2571,7 @@ SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) 42856 EA9DA8 65131 EFB9AB -1114111 +1114111 3F3F3F3F ALTER TABLE t1 MODIFY utf8mb4_encoding VARCHAR(10) CHARACTER SET utf8mb3; SHOW CREATE TABLE t1; Table Create Table @@ -2592,7 +2592,7 @@ u_decimal hex(utf8mb4_encoding) 119070 3F3F3F3F3F3F3F3F3F3F 65131 EFB9AB3F3F3F3F3FEFB9ABEFB9AB3FEFB9AB 119070 3F3F3F3F3F3F3F3F3F3F -1114111 +1114111 3F3F3F3F ALTER TABLE t1 MODIFY utf8mb4_encoding VARCHAR(10) CHARACTER SET utf8mb4; SHOW CREATE TABLE t1; Table Create Table @@ -2613,7 +2613,7 @@ u_decimal hex(utf8mb4_encoding) 119070 3F3F3F3F3F3F3F3F3F3F 65131 EFB9AB3F3F3F3F3FEFB9ABEFB9AB3FEFB9AB 119070 3F3F3F3F3F3F3F3F3F3F -1114111 +1114111 3F3F3F3F ALTER TABLE t2 MODIFY utf8mb3_encoding VARCHAR(10) CHARACTER SET utf8mb4; SHOW CREATE TABLE t2; Table Create Table @@ -2625,7 +2625,7 @@ SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) 42856 EA9DA8 65131 EFB9AB -1114111 +1114111 3F3F3F3F DROP TABLE IF EXISTS t3; CREATE TABLE t3 ( u_decimal int NOT NULL, @@ -2667,7 +2667,7 @@ Table Create Table t3 CREATE TEMPORARY TABLE `t3` ( `utf8mb4` varchar(10) CHARACTER SET utf8mb4 NOT NULL, `utf8mb3` varchar(10) CHARACTER SET utf8 NOT NULL, - `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' + `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TEMPORARY TABLE t3; SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3; @@ -2838,7 +2838,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -2858,7 +2858,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -3082,7 +3082,7 @@ CREATE TABLE t1 AS SELECT 'a' AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' + `a` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -3102,7 +3102,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; SHOW CREATE TABLE t2; @@ -3322,5 +3322,79 @@ DFFFFFDFFFFF9CFFFF9DFFFF9EFFFF # End of 5.6 tests # # +# Start of 10.0 tests +# +# +# MDEV-6566 Different INSERT behaviour on bad bytes with and without character set conversion +# +# +# This test sets session character set to 3-byte utf8, +# but then sends a 4-byte sequence (which is wrong for 3-byte utf8). +# It should be replaced to four question marks: '????' in both columns +# (i.e. four unknown bytes are replaced to four question marks), +# then the rest of the string should be stored, so we get 'a ???? b'. +# +SET NAMES utf8; +CREATE TABLE t1 ( +a VARCHAR(32) CHARACTER SET utf8mb4, +b VARCHAR(32) CHARACTER SET utf8 +); +INSERT INTO t1 SELECT 'a 😠b', 'a 😠b'; +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81 b' for column 'a' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81 b' for column 'b' at row 1 +SELECT * FROM t1; +a b +a ???? b a ???? b +DROP TABLE t1; +# +# This test sets session character set to 4-byte utf8, +# then normally sends a 4-byte sequence. +# It should be stored AS IS into the utf8mb4 column (a), +# and should be replaced to a single question mark in the utf8 column (b) +# (i.e. one character that cannot be converted is replaced to one question mark). +# +SET NAMES utf8mb4; +CREATE TABLE t1 ( +a VARCHAR(32) CHARACTER SET utf8mb4, +b VARCHAR(32) CHARACTER SET utf8 +); +INSERT INTO t1 SELECT 'a 😠b', 'a 😠b'; +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81 b' for column 'b' at row 1 +SELECT * FROM t1; +a b +a 😠b a ? b +DROP TABLE t1; +# +# End of 10.0 tests +# +# # End of tests # +# +# Start of 10.1 tests +# +# +# MDEV-6572 "USE dbname" with a bad sequence erroneously connects to a wrong database +# +SET NAMES utf8mb4; +SELECT * FROM `testðŸ˜ðŸ˜test`; +ERROR HY000: Invalid utf8mb4 character string: 'test\xF0\x9F\x98\x81\xF0\x9F\x98\x81test' +# +# MDEV-7231 Field ROUTINE_DEFINITION in INFORMATION_SCHEMA.`ROUTINES` contains broken procedure body when used shielding quotes inside. +# +SET NAMES utf8mb4; +CREATE FUNCTION f1() RETURNS TEXT CHARACTER SET utf8mb4 +RETURN CONCAT('😎','x😎','😎y','x😎y'); +SELECT ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES +WHERE ROUTINE_SCHEMA='test' AND SPECIFIC_NAME ='f1'; +ROUTINE_DEFINITION +RETURN CONCAT('?','x?','?y','x?y') +SELECT body_utf8 FROM mysql.proc WHERE name='f1'; +body_utf8 +RETURN CONCAT('?','x?','?y','x?y') +DROP FUNCTION f1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ctype_utf8mb4_heap.result b/mysql-test/r/ctype_utf8mb4_heap.result index 3f543ce73e1..d70e009228e 100644 --- a/mysql-test/r/ctype_utf8mb4_heap.result +++ b/mysql-test/r/ctype_utf8mb4_heap.result @@ -225,7 +225,7 @@ Warnings: Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 select hex(s1) from t1; hex(s1) -41 +413F drop table t1; create table t1 (s1 varchar(10) character set utf8mb4) engine heap; insert into t1 values (0x41FF); @@ -233,7 +233,7 @@ Warnings: Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 select hex(s1) from t1; hex(s1) -41 +413F drop table t1; CREATE TABLE t1 ( a varchar(10) ) CHARACTER SET utf8mb4 ENGINE heap; INSERT INTO t1 VALUES ( 'test' ); @@ -840,8 +840,8 @@ create table t2 engine heap select concat(a,_utf8mb4'') as a, concat(b,_utf8mb4' show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL DEFAULT '', - `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL, + `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 drop table t2; drop table t1; @@ -1065,8 +1065,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL DEFAULT '', - `b` int(1) NOT NULL DEFAULT '0' + `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL, + `b` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; @@ -1776,9 +1776,9 @@ Warnings: Warning 1300 Invalid utf8mb4 character string: 'FF8F' select convert(char(0xff,0x8f) using utf8mb4); convert(char(0xff,0x8f) using utf8mb4) - +?? Warnings: -Warning 1300 Invalid utf8mb4 character string: 'FF8F' +Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F' set sql_mode=traditional; select char(0xff,0x8f using utf8mb4); char(0xff,0x8f using utf8mb4) @@ -1804,7 +1804,7 @@ select convert(char(0xff,0x8f) using utf8mb4); convert(char(0xff,0x8f) using utf8mb4) NULL Warnings: -Warning 1300 Invalid utf8mb4 character string: 'FF8F' +Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F' select hex(convert(char(2557 using latin1) using utf8mb4)); hex(convert(char(2557 using latin1) using utf8mb4)) 09C3BD @@ -1973,7 +1973,7 @@ select hex(convert(0xFF using utf8mb4)); hex(convert(0xFF using utf8mb4)) NULL Warnings: -Warning 1300 Invalid utf8mb4 character string: 'FF' +Warning 1300 Invalid utf8mb4 character string: '\xFF' select hex(_utf8mb4 0x616263FF); ERROR HY000: Invalid utf8mb4 character string: 'FF' select hex(_utf8mb4 X'616263FF'); @@ -1990,9 +1990,9 @@ Warnings: Warning 1300 Invalid utf8mb4 character string: 'FF' select hex(convert(0xFF using utf8mb4)); hex(convert(0xFF using utf8mb4)) - +3F Warnings: -Warning 1300 Invalid utf8mb4 character string: 'FF' +Warning 1300 Invalid utf8mb4 character string: '\xFF' select hex(_utf8mb4 0x616263FF); ERROR HY000: Invalid utf8mb4 character string: 'FF' select hex(_utf8mb4 X'616263FF'); @@ -2157,7 +2157,7 @@ Warnings: Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column 'utf8mb4' at row 1 select hex(utf8mb4) from t1; hex(utf8mb4) - +3F F0908080 F0BFBFBF delete from t1; @@ -2177,7 +2177,7 @@ Warnings: Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column 'utf8mb4' at row 1 select hex(utf8mb4) from t1; hex(utf8mb4) - +3F F4808080 F48F8080 drop table t1; @@ -2274,7 +2274,7 @@ Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column 'utf8mb3_enco UPDATE t2 SET utf8mb3_encoding= _utf8mb4 x'ea9da8' where u_decimal= 42856; SELECT HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) FROM t1; HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) -EA9DA8 +3F3F3F3FEA9DA8 EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEA9DA8 F09D8480EA9DA8 F09D849EEA9DA8 @@ -2288,40 +2288,40 @@ F3A087AFEA9DA8 F48FBFBFEA9DA8 SELECT HEX(CONCAT(utf8mb4_encoding, utf8mb3_encoding)) FROM t1,t2; HEX(CONCAT(utf8mb4_encoding, utf8mb3_encoding)) - -EA9DA8 -EFB9AB -EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9AB +3F3F3F3F3F3F3F3F +3F3F3F3FEA9DA8 +3F3F3F3FEFB9AB +EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9AB3F3F3F3F EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEA9DA8 EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEFB9AB -F09D8480 +F09D84803F3F3F3F F09D8480EA9DA8 F09D8480EFB9AB -F09D849E +F09D849E3F3F3F3F F09D849EEA9DA8 F09D849EEFB9AB -F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480 -F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480 +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D84803F3F3F3F +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D84803F3F3F3F F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8 F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8 F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EFB9AB F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EFB9AB -F09D859E +F09D859E3F3F3F3F F09D859EEA9DA8 F09D859EEFB9AB -F09D878F +F09D878F3F3F3F3F F09D878FEA9DA8 F09D878FEFB9AB -F09D9C9F +F09D9C9F3F3F3F3F F09D9C9FEA9DA8 F09D9C9FEFB9AB -F09D9E9F +F09D9E9F3F3F3F3F F09D9E9FEA9DA8 F09D9E9FEFB9AB -F3A087AF +F3A087AF3F3F3F3F F3A087AFEA9DA8 F3A087AFEFB9AB -F48FBFBF +F48FBFBF3F3F3F3F F48FBFBFEA9DA8 F48FBFBFEFB9AB SELECT count(*) FROM t1, t2 @@ -2337,8 +2337,8 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MEMORY DEFAULT CHARSET=utf8 SELECT u_decimal,hex(utf8mb4_encoding),utf8mb4_encoding FROM t1; u_decimal hex(utf8mb4_encoding) utf8mb4_encoding -1114111 1114111 3F ? +1114111 3F3F3F3F ???? 119040 3F ? 119070 3F ? 119070 3F3F3F3F3F3F3F3F3F3F ?????????? @@ -2358,7 +2358,7 @@ t2 CREATE TABLE `t2` ( ) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) -1114111 +1114111 3F3F3F3F 42856 EA9DA8 65131 EFB9AB ALTER TABLE t2 CONVERT TO CHARACTER SET utf8mb3; @@ -2370,7 +2370,7 @@ t2 CREATE TABLE `t2` ( ) ENGINE=MEMORY DEFAULT CHARSET=utf8 SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) -1114111 +1114111 3F3F3F3F 42856 EA9DA8 65131 EFB9AB ALTER TABLE t1 MODIFY utf8mb4_encoding VARCHAR(10) CHARACTER SET utf8mb3; @@ -2382,8 +2382,8 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MEMORY DEFAULT CHARSET=utf8 SELECT u_decimal,hex(utf8mb4_encoding) FROM t1; u_decimal hex(utf8mb4_encoding) -1114111 1114111 3F +1114111 3F3F3F3F 119040 3F 119070 3F 119070 3F3F3F3F3F3F3F3F3F3F @@ -2403,8 +2403,8 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MEMORY DEFAULT CHARSET=utf8 SELECT u_decimal,hex(utf8mb4_encoding) FROM t1; u_decimal hex(utf8mb4_encoding) -1114111 1114111 3F +1114111 3F3F3F3F 119040 3F 119070 3F 119070 3F3F3F3F3F3F3F3F3F3F @@ -2424,7 +2424,7 @@ t2 CREATE TABLE `t2` ( ) ENGINE=MEMORY DEFAULT CHARSET=utf8 SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) -1114111 +1114111 3F3F3F3F 42856 EA9DA8 65131 EFB9AB DROP TABLE IF EXISTS t3; @@ -2468,7 +2468,7 @@ Table Create Table t3 CREATE TEMPORARY TABLE `t3` ( `utf8mb4` varchar(10) CHARACTER SET utf8mb4 NOT NULL, `utf8mb3` varchar(10) CHARACTER SET utf8 NOT NULL, - `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' + `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 NOT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 DROP TEMPORARY TABLE t3; SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3; @@ -2495,5 +2495,66 @@ DROP TABLE t1; # End of 5.5 tests # # -# End of tests +# ctype_utf8mb4.inc: Start of 10.1 tests +# +# +# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character" +# +CREATE TABLE t1 ( +id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +a VARCHAR(10) CHARACTER SET utf8mb4, KEY(a,id) +); +INSERT INTO t1 (a) VALUES (0x61); +INSERT INTO t1 (a) VALUES (0xC280),(0xDFBF); +INSERT INTO t1 (a) VALUES (0xE0A080),(0xEFBFBF); +INSERT INTO t1 (a) VALUES (0xF0908080),(0xF48FBFBF); +SELECT id,HEX(a) FROM t1 ORDER BY a,id; +id HEX(a) +1 61 +2 C280 +3 DFBF +4 E0A080 +6 F0908080 +7 F48FBFBF +5 EFBFBF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +5 EFBFBF +7 F48FBFBF +6 F0908080 +4 E0A080 +3 DFBF +2 C280 +1 61 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +6 +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; +SELECT id,HEX(a) FROM t1 ORDER BY a; +id HEX(a) +1 61 +2 C280 +3 DFBF +4 E0A080 +5 EFBFBF +6 F0908080 +7 F48FBFBF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +7 F48FBFBF +6 F0908080 +5 EFBFBF +4 E0A080 +3 DFBF +2 C280 +1 61 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +7 +DROP TABLE t1; +# +# ctype_utf8mb4.inc: End of 10.1 tests +# +# +# End of ctype_utf8mb4.inc # diff --git a/mysql-test/r/ctype_utf8mb4_innodb.result b/mysql-test/r/ctype_utf8mb4_innodb.result index cc0ded6728d..7d193f397ac 100644 --- a/mysql-test/r/ctype_utf8mb4_innodb.result +++ b/mysql-test/r/ctype_utf8mb4_innodb.result @@ -225,7 +225,7 @@ Warnings: Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 select hex(s1) from t1; hex(s1) -41 +413F drop table t1; create table t1 (s1 varchar(10) character set utf8mb4) engine InnoDB; insert into t1 values (0x41FF); @@ -233,7 +233,7 @@ Warnings: Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 select hex(s1) from t1; hex(s1) -41 +413F drop table t1; create table t1 (s1 text character set utf8mb4) engine InnoDB; insert into t1 values (0x41FF); @@ -241,7 +241,7 @@ Warnings: Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 select hex(s1) from t1; hex(s1) -41 +413F drop table t1; create table t1 (a text character set utf8mb4, primary key(a(371))) engine InnoDB; ERROR 42000: Specified key was too long; max key length is 767 bytes @@ -901,8 +901,8 @@ create table t2 engine InnoDB select concat(a,_utf8mb4'') as a, concat(b,_utf8mb show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL DEFAULT '', - `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL, + `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t2; drop table t1; @@ -1126,8 +1126,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL DEFAULT '', - `b` int(1) NOT NULL DEFAULT '0' + `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL, + `b` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; @@ -1904,9 +1904,9 @@ Warnings: Warning 1300 Invalid utf8mb4 character string: 'FF8F' select convert(char(0xff,0x8f) using utf8mb4); convert(char(0xff,0x8f) using utf8mb4) - +?? Warnings: -Warning 1300 Invalid utf8mb4 character string: 'FF8F' +Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F' set sql_mode=traditional; select char(0xff,0x8f using utf8mb4); char(0xff,0x8f using utf8mb4) @@ -1932,7 +1932,7 @@ select convert(char(0xff,0x8f) using utf8mb4); convert(char(0xff,0x8f) using utf8mb4) NULL Warnings: -Warning 1300 Invalid utf8mb4 character string: 'FF8F' +Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F' select hex(convert(char(2557 using latin1) using utf8mb4)); hex(convert(char(2557 using latin1) using utf8mb4)) 09C3BD @@ -2101,7 +2101,7 @@ select hex(convert(0xFF using utf8mb4)); hex(convert(0xFF using utf8mb4)) NULL Warnings: -Warning 1300 Invalid utf8mb4 character string: 'FF' +Warning 1300 Invalid utf8mb4 character string: '\xFF' select hex(_utf8mb4 0x616263FF); ERROR HY000: Invalid utf8mb4 character string: 'FF' select hex(_utf8mb4 X'616263FF'); @@ -2118,9 +2118,9 @@ Warnings: Warning 1300 Invalid utf8mb4 character string: 'FF' select hex(convert(0xFF using utf8mb4)); hex(convert(0xFF using utf8mb4)) - +3F Warnings: -Warning 1300 Invalid utf8mb4 character string: 'FF' +Warning 1300 Invalid utf8mb4 character string: '\xFF' select hex(_utf8mb4 0x616263FF); ERROR HY000: Invalid utf8mb4 character string: 'FF' select hex(_utf8mb4 X'616263FF'); @@ -2285,7 +2285,7 @@ Warnings: Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column 'utf8mb4' at row 1 select hex(utf8mb4) from t1; hex(utf8mb4) - +3F F0908080 F0BFBFBF delete from t1; @@ -2305,7 +2305,7 @@ Warnings: Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column 'utf8mb4' at row 1 select hex(utf8mb4) from t1; hex(utf8mb4) - +3F F4808080 F48F8080 drop table t1; @@ -2421,7 +2421,7 @@ Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column 'utf8mb3_enco UPDATE t2 SET utf8mb3_encoding= _utf8mb4 x'ea9da8' where u_decimal= 42856; SELECT HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) FROM t1; HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) -EA9DA8 +3F3F3F3FEA9DA8 EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEA9DA8 F09D8480EA9DA8 F09D849EEA9DA8 @@ -2435,40 +2435,40 @@ F3A087AFEA9DA8 F48FBFBFEA9DA8 SELECT HEX(CONCAT(utf8mb4_encoding, utf8mb3_encoding)) FROM t1,t2; HEX(CONCAT(utf8mb4_encoding, utf8mb3_encoding)) - -EA9DA8 -EFB9AB -EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9AB +3F3F3F3F3F3F3F3F +3F3F3F3FEA9DA8 +3F3F3F3FEFB9AB +EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9AB3F3F3F3F EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEA9DA8 EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEFB9AB -F09D8480 +F09D84803F3F3F3F F09D8480EA9DA8 F09D8480EFB9AB -F09D849E +F09D849E3F3F3F3F F09D849EEA9DA8 F09D849EEFB9AB -F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480 -F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480 +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D84803F3F3F3F +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D84803F3F3F3F F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8 F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8 F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EFB9AB F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EFB9AB -F09D859E +F09D859E3F3F3F3F F09D859EEA9DA8 F09D859EEFB9AB -F09D878F +F09D878F3F3F3F3F F09D878FEA9DA8 F09D878FEFB9AB -F09D9C9F +F09D9C9F3F3F3F3F F09D9C9FEA9DA8 F09D9C9FEFB9AB -F09D9E9F +F09D9E9F3F3F3F3F F09D9E9FEA9DA8 F09D9E9FEFB9AB -F3A087AF +F3A087AF3F3F3F3F F3A087AFEA9DA8 F3A087AFEFB9AB -F48FBFBF +F48FBFBF3F3F3F3F F48FBFBFEA9DA8 F48FBFBFEFB9AB SELECT count(*) FROM t1, t2 @@ -2484,8 +2484,8 @@ t1 CREATE TABLE `t1` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 SELECT u_decimal,hex(utf8mb4_encoding),utf8mb4_encoding FROM t1; u_decimal hex(utf8mb4_encoding) utf8mb4_encoding -1114111 1114111 3F ? +1114111 3F3F3F3F ???? 119040 3F ? 119070 3F ? 119070 3F3F3F3F3F3F3F3F3F3F ?????????? @@ -2505,7 +2505,7 @@ t2 CREATE TABLE `t2` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) -1114111 +1114111 3F3F3F3F 42856 EA9DA8 65131 EFB9AB ALTER TABLE t2 CONVERT TO CHARACTER SET utf8mb3; @@ -2517,7 +2517,7 @@ t2 CREATE TABLE `t2` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) -1114111 +1114111 3F3F3F3F 42856 EA9DA8 65131 EFB9AB ALTER TABLE t1 MODIFY utf8mb4_encoding VARCHAR(10) CHARACTER SET utf8mb3; @@ -2529,8 +2529,8 @@ t1 CREATE TABLE `t1` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 SELECT u_decimal,hex(utf8mb4_encoding) FROM t1; u_decimal hex(utf8mb4_encoding) -1114111 1114111 3F +1114111 3F3F3F3F 119040 3F 119070 3F 119070 3F3F3F3F3F3F3F3F3F3F @@ -2550,8 +2550,8 @@ t1 CREATE TABLE `t1` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 SELECT u_decimal,hex(utf8mb4_encoding) FROM t1; u_decimal hex(utf8mb4_encoding) -1114111 1114111 3F +1114111 3F3F3F3F 119040 3F 119070 3F 119070 3F3F3F3F3F3F3F3F3F3F @@ -2571,7 +2571,7 @@ t2 CREATE TABLE `t2` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) -1114111 +1114111 3F3F3F3F 42856 EA9DA8 65131 EFB9AB DROP TABLE IF EXISTS t3; @@ -2615,7 +2615,7 @@ Table Create Table t3 CREATE TEMPORARY TABLE `t3` ( `utf8mb4` varchar(10) CHARACTER SET utf8mb4 NOT NULL, `utf8mb3` varchar(10) CHARACTER SET utf8 NOT NULL, - `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' + `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TEMPORARY TABLE t3; SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3; @@ -2642,5 +2642,66 @@ DROP TABLE t1; # End of 5.5 tests # # -# End of tests +# ctype_utf8mb4.inc: Start of 10.1 tests +# +# +# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character" +# +CREATE TABLE t1 ( +id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +a VARCHAR(10) CHARACTER SET utf8mb4, KEY(a,id) +); +INSERT INTO t1 (a) VALUES (0x61); +INSERT INTO t1 (a) VALUES (0xC280),(0xDFBF); +INSERT INTO t1 (a) VALUES (0xE0A080),(0xEFBFBF); +INSERT INTO t1 (a) VALUES (0xF0908080),(0xF48FBFBF); +SELECT id,HEX(a) FROM t1 ORDER BY a,id; +id HEX(a) +1 61 +2 C280 +3 DFBF +4 E0A080 +6 F0908080 +7 F48FBFBF +5 EFBFBF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +5 EFBFBF +7 F48FBFBF +6 F0908080 +4 E0A080 +3 DFBF +2 C280 +1 61 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +6 +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; +SELECT id,HEX(a) FROM t1 ORDER BY a; +id HEX(a) +1 61 +2 C280 +3 DFBF +4 E0A080 +5 EFBFBF +6 F0908080 +7 F48FBFBF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +7 F48FBFBF +6 F0908080 +5 EFBFBF +4 E0A080 +3 DFBF +2 C280 +1 61 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +7 +DROP TABLE t1; +# +# ctype_utf8mb4.inc: End of 10.1 tests +# +# +# End of ctype_utf8mb4.inc # diff --git a/mysql-test/r/ctype_utf8mb4_myisam.result b/mysql-test/r/ctype_utf8mb4_myisam.result index 03e32836cb5..28cf36c7492 100644 --- a/mysql-test/r/ctype_utf8mb4_myisam.result +++ b/mysql-test/r/ctype_utf8mb4_myisam.result @@ -225,7 +225,7 @@ Warnings: Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 select hex(s1) from t1; hex(s1) -41 +413F drop table t1; create table t1 (s1 varchar(10) character set utf8mb4) engine MyISAM; insert into t1 values (0x41FF); @@ -233,7 +233,7 @@ Warnings: Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 select hex(s1) from t1; hex(s1) -41 +413F drop table t1; create table t1 (s1 text character set utf8mb4) engine MyISAM; insert into t1 values (0x41FF); @@ -241,7 +241,7 @@ Warnings: Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 select hex(s1) from t1; hex(s1) -41 +413F drop table t1; create table t1 (a text character set utf8mb4, primary key(a(371))) engine MyISAM; ERROR 42000: Specified key was too long; max key length is 1000 bytes @@ -901,8 +901,8 @@ create table t2 engine MyISAM select concat(a,_utf8mb4'') as a, concat(b,_utf8mb show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL DEFAULT '', - `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' + `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL, + `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t2; drop table t1; @@ -1126,8 +1126,8 @@ CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL DEFAULT '', - `b` int(1) NOT NULL DEFAULT '0' + `a` varchar(1) CHARACTER SET utf8mb4 NOT NULL, + `b` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); SELECT * FROM t1 ORDER BY a, b; @@ -1904,9 +1904,9 @@ Warnings: Warning 1300 Invalid utf8mb4 character string: 'FF8F' select convert(char(0xff,0x8f) using utf8mb4); convert(char(0xff,0x8f) using utf8mb4) - +?? Warnings: -Warning 1300 Invalid utf8mb4 character string: 'FF8F' +Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F' set sql_mode=traditional; select char(0xff,0x8f using utf8mb4); char(0xff,0x8f using utf8mb4) @@ -1932,7 +1932,7 @@ select convert(char(0xff,0x8f) using utf8mb4); convert(char(0xff,0x8f) using utf8mb4) NULL Warnings: -Warning 1300 Invalid utf8mb4 character string: 'FF8F' +Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F' select hex(convert(char(2557 using latin1) using utf8mb4)); hex(convert(char(2557 using latin1) using utf8mb4)) 09C3BD @@ -2101,7 +2101,7 @@ select hex(convert(0xFF using utf8mb4)); hex(convert(0xFF using utf8mb4)) NULL Warnings: -Warning 1300 Invalid utf8mb4 character string: 'FF' +Warning 1300 Invalid utf8mb4 character string: '\xFF' select hex(_utf8mb4 0x616263FF); ERROR HY000: Invalid utf8mb4 character string: 'FF' select hex(_utf8mb4 X'616263FF'); @@ -2118,9 +2118,9 @@ Warnings: Warning 1300 Invalid utf8mb4 character string: 'FF' select hex(convert(0xFF using utf8mb4)); hex(convert(0xFF using utf8mb4)) - +3F Warnings: -Warning 1300 Invalid utf8mb4 character string: 'FF' +Warning 1300 Invalid utf8mb4 character string: '\xFF' select hex(_utf8mb4 0x616263FF); ERROR HY000: Invalid utf8mb4 character string: 'FF' select hex(_utf8mb4 X'616263FF'); @@ -2285,7 +2285,7 @@ Warnings: Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column 'utf8mb4' at row 1 select hex(utf8mb4) from t1; hex(utf8mb4) - +3F F0908080 F0BFBFBF delete from t1; @@ -2305,7 +2305,7 @@ Warnings: Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column 'utf8mb4' at row 1 select hex(utf8mb4) from t1; hex(utf8mb4) - +3F F4808080 F48F8080 drop table t1; @@ -2421,7 +2421,7 @@ Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column 'utf8mb3_enco UPDATE t2 SET utf8mb3_encoding= _utf8mb4 x'ea9da8' where u_decimal= 42856; SELECT HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) FROM t1; HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) -EA9DA8 +3F3F3F3FEA9DA8 EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEA9DA8 F09D8480EA9DA8 F09D849EEA9DA8 @@ -2435,40 +2435,40 @@ F3A087AFEA9DA8 F48FBFBFEA9DA8 SELECT HEX(CONCAT(utf8mb4_encoding, utf8mb3_encoding)) FROM t1,t2; HEX(CONCAT(utf8mb4_encoding, utf8mb3_encoding)) - -EA9DA8 -EFB9AB -EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9AB +3F3F3F3F3F3F3F3F +3F3F3F3FEA9DA8 +3F3F3F3FEFB9AB +EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9AB3F3F3F3F EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEA9DA8 EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEFB9AB -F09D8480 +F09D84803F3F3F3F F09D8480EA9DA8 F09D8480EFB9AB -F09D849E +F09D849E3F3F3F3F F09D849EEA9DA8 F09D849EEFB9AB -F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480 -F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480 +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D84803F3F3F3F +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D84803F3F3F3F F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8 F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8 F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EFB9AB F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EFB9AB -F09D859E +F09D859E3F3F3F3F F09D859EEA9DA8 F09D859EEFB9AB -F09D878F +F09D878F3F3F3F3F F09D878FEA9DA8 F09D878FEFB9AB -F09D9C9F +F09D9C9F3F3F3F3F F09D9C9FEA9DA8 F09D9C9FEFB9AB -F09D9E9F +F09D9E9F3F3F3F3F F09D9E9FEA9DA8 F09D9E9FEFB9AB -F3A087AF +F3A087AF3F3F3F3F F3A087AFEA9DA8 F3A087AFEFB9AB -F48FBFBF +F48FBFBF3F3F3F3F F48FBFBFEA9DA8 F48FBFBFEFB9AB SELECT count(*) FROM t1, t2 @@ -2484,8 +2484,8 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=utf8 SELECT u_decimal,hex(utf8mb4_encoding),utf8mb4_encoding FROM t1; u_decimal hex(utf8mb4_encoding) utf8mb4_encoding -1114111 1114111 3F ? +1114111 3F3F3F3F ???? 119040 3F ? 119070 3F ? 119070 3F3F3F3F3F3F3F3F3F3F ?????????? @@ -2505,7 +2505,7 @@ t2 CREATE TABLE `t2` ( ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) -1114111 +1114111 3F3F3F3F 42856 EA9DA8 65131 EFB9AB ALTER TABLE t2 CONVERT TO CHARACTER SET utf8mb3; @@ -2517,7 +2517,7 @@ t2 CREATE TABLE `t2` ( ) ENGINE=MyISAM DEFAULT CHARSET=utf8 SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) -1114111 +1114111 3F3F3F3F 42856 EA9DA8 65131 EFB9AB ALTER TABLE t1 MODIFY utf8mb4_encoding VARCHAR(10) CHARACTER SET utf8mb3; @@ -2529,8 +2529,8 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=utf8 SELECT u_decimal,hex(utf8mb4_encoding) FROM t1; u_decimal hex(utf8mb4_encoding) -1114111 1114111 3F +1114111 3F3F3F3F 119040 3F 119070 3F 119070 3F3F3F3F3F3F3F3F3F3F @@ -2550,8 +2550,8 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=utf8 SELECT u_decimal,hex(utf8mb4_encoding) FROM t1; u_decimal hex(utf8mb4_encoding) -1114111 1114111 3F +1114111 3F3F3F3F 119040 3F 119070 3F 119070 3F3F3F3F3F3F3F3F3F3F @@ -2571,7 +2571,7 @@ t2 CREATE TABLE `t2` ( ) ENGINE=MyISAM DEFAULT CHARSET=utf8 SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; u_decimal hex(utf8mb3_encoding) -1114111 +1114111 3F3F3F3F 42856 EA9DA8 65131 EFB9AB DROP TABLE IF EXISTS t3; @@ -2615,7 +2615,7 @@ Table Create Table t3 CREATE TEMPORARY TABLE `t3` ( `utf8mb4` varchar(10) CHARACTER SET utf8mb4 NOT NULL, `utf8mb3` varchar(10) CHARACTER SET utf8 NOT NULL, - `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' + `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TEMPORARY TABLE t3; SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3; @@ -2642,5 +2642,66 @@ DROP TABLE t1; # End of 5.5 tests # # -# End of tests +# ctype_utf8mb4.inc: Start of 10.1 tests +# +# +# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character" +# +CREATE TABLE t1 ( +id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +a VARCHAR(10) CHARACTER SET utf8mb4, KEY(a,id) +); +INSERT INTO t1 (a) VALUES (0x61); +INSERT INTO t1 (a) VALUES (0xC280),(0xDFBF); +INSERT INTO t1 (a) VALUES (0xE0A080),(0xEFBFBF); +INSERT INTO t1 (a) VALUES (0xF0908080),(0xF48FBFBF); +SELECT id,HEX(a) FROM t1 ORDER BY a,id; +id HEX(a) +1 61 +2 C280 +3 DFBF +4 E0A080 +6 F0908080 +7 F48FBFBF +5 EFBFBF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +5 EFBFBF +7 F48FBFBF +6 F0908080 +4 E0A080 +3 DFBF +2 C280 +1 61 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +6 +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; +SELECT id,HEX(a) FROM t1 ORDER BY a; +id HEX(a) +1 61 +2 C280 +3 DFBF +4 E0A080 +5 EFBFBF +6 F0908080 +7 F48FBFBF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +7 F48FBFBF +6 F0908080 +5 EFBFBF +4 E0A080 +3 DFBF +2 C280 +1 61 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +7 +DROP TABLE t1; +# +# ctype_utf8mb4.inc: End of 10.1 tests +# +# +# End of ctype_utf8mb4.inc # diff --git a/mysql-test/r/ctype_utf8mb4_uca.result b/mysql-test/r/ctype_utf8mb4_uca.result index ef18272ca24..1057b9743f4 100644 --- a/mysql-test/r/ctype_utf8mb4_uca.result +++ b/mysql-test/r/ctype_utf8mb4_uca.result @@ -2752,7 +2752,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `s1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_myanmar_ci NOT NULL DEFAULT '', + `s1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_myanmar_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (s1) VALUES diff --git a/mysql-test/r/ddl_i18n_koi8r.result b/mysql-test/r/ddl_i18n_koi8r.result index fbed2ac1565..d81b6af0aeb 100644 --- a/mysql-test/r/ddl_i18n_koi8r.result +++ b/mysql-test/r/ddl_i18n_koi8r.result @@ -1,3 +1,4 @@ +set sql_mode=""; set names koi8r; ------------------------------------------------------------------- @@ -34,16 +35,16 @@ v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def mysqltest1 v1 select 'ÔÅÓÔ' AS `c1`,`mysqltest1`.`t1`.`ËÏÌ` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER koi8r koi8r_general_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def mysqltest1 v1 select 'ÔÅÓÔ' AS `c1`,`mysqltest1`.`t1`.`ËÏÌ` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER koi8r koi8r_general_ci UNDEFINED SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def mysqltest1 v2 select 'ÔÅÓÔ' AS `c1` NONE NO root@localhost DEFINER koi8r koi8r_general_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def mysqltest1 v2 select 'ÔÅÓÔ' AS `c1` NONE NO root@localhost DEFINER koi8r koi8r_general_ci UNDEFINED SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'| -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def mysqltest1 v3 select 'ÔÅÓÔ' AS `ÔÅÓÔ` NONE NO root@localhost DEFINER koi8r koi8r_general_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def mysqltest1 v3 select 'ÔÅÓÔ' AS `ÔÅÓÔ` NONE NO root@localhost DEFINER koi8r koi8r_general_ci UNDEFINED SELECT COLLATION(c1), COLLATION(c2) FROM v1| @@ -86,16 +87,16 @@ v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def mysqltest1 v1 select 'ÔÅÓÔ' AS `c1`,`mysqltest1`.`t1`.`ËÏÌ` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER koi8r koi8r_general_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def mysqltest1 v1 select 'ÔÅÓÔ' AS `c1`,`mysqltest1`.`t1`.`ËÏÌ` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER koi8r koi8r_general_ci UNDEFINED SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def mysqltest1 v2 select 'ÔÅÓÔ' AS `c1` NONE NO root@localhost DEFINER koi8r koi8r_general_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def mysqltest1 v2 select 'ÔÅÓÔ' AS `c1` NONE NO root@localhost DEFINER koi8r koi8r_general_ci UNDEFINED SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'| -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def mysqltest1 v3 select 'ÔÅÓÔ' AS `ÔÅÓÔ` NONE NO root@localhost DEFINER koi8r koi8r_general_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def mysqltest1 v3 select 'ÔÅÓÔ' AS `ÔÅÓÔ` NONE NO root@localhost DEFINER koi8r koi8r_general_ci UNDEFINED SELECT COLLATION(c1), COLLATION(c2) FROM v1| @@ -143,16 +144,16 @@ v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def mysqltest1 v1 select 'ÔÅÓÔ' AS `c1`,`mysqltest1`.`t1`.`ËÏÌ` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER koi8r koi8r_general_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def mysqltest1 v1 select 'ÔÅÓÔ' AS `c1`,`mysqltest1`.`t1`.`ËÏÌ` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER koi8r koi8r_general_ci UNDEFINED SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def mysqltest1 v2 select 'ÔÅÓÔ' AS `c1` NONE NO root@localhost DEFINER koi8r koi8r_general_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def mysqltest1 v2 select 'ÔÅÓÔ' AS `c1` NONE NO root@localhost DEFINER koi8r koi8r_general_ci UNDEFINED SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'| -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def mysqltest1 v3 select 'ÔÅÓÔ' AS `ÔÅÓÔ` NONE NO root@localhost DEFINER koi8r koi8r_general_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def mysqltest1 v3 select 'ÔÅÓÔ' AS `ÔÅÓÔ` NONE NO root@localhost DEFINER koi8r koi8r_general_ci UNDEFINED SELECT COLLATION(c1), COLLATION(c2) FROM v1| diff --git a/mysql-test/r/ddl_i18n_utf8.result b/mysql-test/r/ddl_i18n_utf8.result index 98da459dafc..5921a7f538d 100644 --- a/mysql-test/r/ddl_i18n_utf8.result +++ b/mysql-test/r/ddl_i18n_utf8.result @@ -1,3 +1,4 @@ +set sql_mode=""; set names utf8; ------------------------------------------------------------------- @@ -34,16 +35,16 @@ v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def mysqltest1 v1 select 'теÑÑ‚' AS `c1`,`mysqltest1`.`t1`.`кол` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER utf8 utf8_general_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def mysqltest1 v1 select 'теÑÑ‚' AS `c1`,`mysqltest1`.`t1`.`кол` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER utf8 utf8_general_ci UNDEFINED SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def mysqltest1 v2 select 'теÑÑ‚' AS `c1` NONE NO root@localhost DEFINER utf8 utf8_general_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def mysqltest1 v2 select 'теÑÑ‚' AS `c1` NONE NO root@localhost DEFINER utf8 utf8_general_ci UNDEFINED SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'| -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def mysqltest1 v3 select 'теÑÑ‚' AS `теÑÑ‚` NONE NO root@localhost DEFINER utf8 utf8_general_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def mysqltest1 v3 select 'теÑÑ‚' AS `теÑÑ‚` NONE NO root@localhost DEFINER utf8 utf8_general_ci UNDEFINED SELECT COLLATION(c1), COLLATION(c2) FROM v1| @@ -86,16 +87,16 @@ v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def mysqltest1 v1 select 'теÑÑ‚' AS `c1`,`mysqltest1`.`t1`.`кол` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER utf8 utf8_general_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def mysqltest1 v1 select 'теÑÑ‚' AS `c1`,`mysqltest1`.`t1`.`кол` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER utf8 utf8_general_ci UNDEFINED SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def mysqltest1 v2 select 'теÑÑ‚' AS `c1` NONE NO root@localhost DEFINER utf8 utf8_general_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def mysqltest1 v2 select 'теÑÑ‚' AS `c1` NONE NO root@localhost DEFINER utf8 utf8_general_ci UNDEFINED SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'| -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def mysqltest1 v3 select 'теÑÑ‚' AS `теÑÑ‚` NONE NO root@localhost DEFINER utf8 utf8_general_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def mysqltest1 v3 select 'теÑÑ‚' AS `теÑÑ‚` NONE NO root@localhost DEFINER utf8 utf8_general_ci UNDEFINED SELECT COLLATION(c1), COLLATION(c2) FROM v1| @@ -143,16 +144,16 @@ v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def mysqltest1 v1 select 'теÑÑ‚' AS `c1`,`mysqltest1`.`t1`.`кол` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER utf8 utf8_general_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def mysqltest1 v1 select 'теÑÑ‚' AS `c1`,`mysqltest1`.`t1`.`кол` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER utf8 utf8_general_ci UNDEFINED SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def mysqltest1 v2 select 'теÑÑ‚' AS `c1` NONE NO root@localhost DEFINER utf8 utf8_general_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def mysqltest1 v2 select 'теÑÑ‚' AS `c1` NONE NO root@localhost DEFINER utf8 utf8_general_ci UNDEFINED SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'| -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def mysqltest1 v3 select 'теÑÑ‚' AS `теÑÑ‚` NONE NO root@localhost DEFINER utf8 utf8_general_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def mysqltest1 v3 select 'теÑÑ‚' AS `теÑÑ‚` NONE NO root@localhost DEFINER utf8 utf8_general_ci UNDEFINED SELECT COLLATION(c1), COLLATION(c2) FROM v1| diff --git a/mysql-test/r/default.result b/mysql-test/r/default.result index 9afffe4c3bc..685b534b808 100644 --- a/mysql-test/r/default.result +++ b/mysql-test/r/default.result @@ -1,5 +1,6 @@ drop table if exists t1,t2,t3,t4,t5,t6; drop database if exists mysqltest; +set sql_mode=""; CREATE TABLE t1 (a varchar(30) binary NOT NULL DEFAULT ' ', b varchar(1) binary NOT NULL DEFAULT ' ', c varchar(4) binary NOT NULL DEFAULT '0000', @@ -29,6 +30,7 @@ z varchar(20) binary NOT NULL DEFAULT ' ', a1 varchar(30) binary NOT NULL DEFAULT ' ', b1 tinyblob NULL) ENGINE=InnoDB DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin; +set sql_mode=default; INSERT into t1 (b) values ('1'); SHOW WARNINGS; Level Code Message @@ -220,3 +222,17 @@ NULL 10 drop table t1, t2; End of 5.0 tests. +# +# Start of 10.1 tests +# +CREATE TABLE t1 (a INT DEFAULT 100, b INT DEFAULT NULL); +INSERT INTO t1 VALUES (); +SELECT * FROM t1 WHERE DEFAULT(a); +a b +100 NULL +SELECT * FROM t1 WHERE DEFAULT(b); +a b +DROP TABLE IF EXISTS t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/delayed.result b/mysql-test/r/delayed.result index 98c8b599e88..8cc5645eeda 100644 --- a/mysql-test/r/delayed.result +++ b/mysql-test/r/delayed.result @@ -466,3 +466,37 @@ commit; # Reaping ALTER TABLE: # Connection 'default'. drop tables tm, t1, t2; +# +# MDEV-9621 INSERT DELAYED fails on insert for tables with many columns +# +CREATE TABLE t1 ( +a int,b int,c int,d int,e int,f int,g int,h int,i int,j int,k int,l int,m int,n int,o int,p int,q int,r int,s int,t int,u int,v int,x int,y int,z int +) ENGINE=MyISAM; +INSERT DELAYED INTO t1 (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,x,y,z) +values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1); +INSERT DELAYED INTO t1 (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,x,y,z) +values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1); +drop table t1; +# +# INSERT DELAYED hangs if table was crashed +# +create table t1 (a int, b int) engine=myisam; +insert into t1 values (1,1); +SET debug_dbug="d,crash_shutdown"; +shutdown; +ERROR HY000: Lost connection to MySQL server during query +call mtr.add_suppression(" marked as crashed and should be repaired"); +call mtr.add_suppression("Checking table"); +insert delayed into t1 values (2,2); +Warnings: +Error 145 Table './test/t1' is marked as crashed and should be repaired +Error 1194 Table 't1' is marked as crashed and should be repaired +Error 1034 1 client is using or hasn't closed the table properly +insert delayed into t1 values (3,3); +flush tables t1; +select * from t1; +a b +1 1 +2 2 +3 3 +drop table t1; diff --git a/mysql-test/r/delete_returning_grant.result b/mysql-test/r/delete_returning_grant.result index c15d3627a39..bdd171940ba 100644 --- a/mysql-test/r/delete_returning_grant.result +++ b/mysql-test/r/delete_returning_grant.result @@ -1,3 +1,5 @@ +set GLOBAL sql_mode=""; +set LOCAL sql_mode=""; CREATE TABLE t1 (a int(11), b varchar(32)); INSERT INTO t1 VALUES (7,'ggggggg'),(1,'a'),(3,'ccc'),(4,'dddd'),(1,'A'), (2,'BB'),(4,'DDDD'),(5,'EEEEE'),(7,'GGGGGGG'),(2,'bb'); @@ -67,3 +69,4 @@ DROP DATABASE mysqltest; DROP USER mysqltest_1@localhost; DROP VIEW v1; DROP TABLE t1; +set GLOBAL sql_mode=default; diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index 97ba35ed9cd..1d643333424 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -102,7 +102,6 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 8 2 DERIVED t1 ALL NULL NULL NULL NULL 4 3 UNION t1 ALL NULL NULL NULL NULL 4 -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL CREATE TABLE t2 (a int not null); insert into t2 values(1); select * from (select * from t1 where t1.a=(select a from t2 where t2.a=t1.a)) a; @@ -950,3 +949,48 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table DROP TABLES t1,t2; set optimizer_switch=@save_derived_optimizer_switch; +# +# Start of 10.1 tests +# +# +# MDEV-8747 Wrong result for SELECT..WHERE derived_table_column='a' AND derived_table_column<>_latin1'A' COLLATE latin1_bin +# +CREATE TABLE t1 (a VARCHAR(10)); +INSERT INTO t1 VALUES ('a'),('A'); +SELECT * FROM t1 WHERE a='a' AND a <> _latin1'A' COLLATE latin1_bin; +a +a +SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a='a' AND a <> _latin1'A' COLLATE latin1_bin; +a +a +DROP TABLE t1; +CREATE TABLE t1 (a ENUM('5','6')); +INSERT INTO t1 VALUES ('5'),('6'); +SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a='5'; +a +5 +SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a=1; +a +5 +SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a='5' AND a=1; +a +5 +DROP TABLE t1; +# +# MDEV-8749 Wrong result for SELECT..WHERE derived_table_enum_column='number' AND derived_table_enum_column OP number2 +# +CREATE TABLE t1 (a ENUM('5','6')); +INSERT INTO t1 VALUES ('5'),('6'); +SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a='5'; +a +5 +SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a=1; +a +5 +SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a='5' AND a=1; +a +5 +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result index fa0a69a487d..639942f0da9 100644 --- a/mysql-test/r/derived_view.result +++ b/mysql-test/r/derived_view.result @@ -2262,10 +2262,7 @@ CREATE TABLE IF NOT EXISTS `galleries` ( `year` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -Warnings: -Warning 1286 Unknown storage engine 'InnoDB' -Warning 1266 Using storage engine MyISAM for table 'galleries' +) DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `pictures` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(100) NOT NULL, @@ -2278,10 +2275,7 @@ CREATE TABLE IF NOT EXISTS `pictures` ( `type` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `gallery_id` (`gallery_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; -Warnings: -Warning 1286 Unknown storage engine 'InnoDB' -Warning 1266 Using storage engine MyISAM for table 'pictures' +) DEFAULT CHARSET=utf8 ; ALTER TABLE `pictures` ADD CONSTRAINT `pictures_ibfk_1` FOREIGN KEY (`gallery_id`) REFERENCES `galleries` (`id`); INSERT INTO `galleries` (`id`, `name`, `year`) VALUES diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index bd7deee43e9..d6e5a69e217 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -744,7 +744,7 @@ a a b 1 1 3 DROP TABLE t1; End of 5.0 tests -CREATE TABLE t1(a INT, b INT, c INT, d INT, e INT, +CREATE TABLE t1(a INT, b INT, c INT, d INT default 0, e INT default 0, PRIMARY KEY(a,b,c,d,e), KEY(a,b,d,c) ); @@ -925,9 +925,6 @@ set join_buffer_size=1024; SELECT STRAIGHT_JOIN DISTINCT t1.id FROM t1, v1, t2 WHERE v1.id = t2.i AND t1.i1 = v1.i1 AND t2.i != 3; id -7 -8 -9 18 20 24 @@ -937,34 +934,37 @@ id 51 61 64 +7 71 74 77 78 +8 +9 93 94 set join_buffer_size=1024*16; SELECT STRAIGHT_JOIN DISTINCT t1.id FROM t1, v1, t2 WHERE v1.id = t2.i AND t1.i1 = v1.i1 AND t2.i != 3; id -7 -9 18 20 24 -8 +43 +45 50 51 61 -43 -45 -71 64 +7 +71 74 77 78 -94 +8 +9 93 +94 set join_buffer_size=default; SELECT STRAIGHT_JOIN DISTINCT t1.id FROM t1, v1, t2 WHERE v1.id = t2.i AND t1.i1 = v1.i1 AND t2.i != 3; diff --git a/mysql-test/r/enforce_storage_engine.result b/mysql-test/r/enforce_storage_engine.result new file mode 100644 index 00000000000..6b5e1f6958b --- /dev/null +++ b/mysql-test/r/enforce_storage_engine.result @@ -0,0 +1,154 @@ +set local sql_mode=""; +set global sql_mode=""; +drop table if exists t1; +SET SESSION enforce_storage_engine=MyISAM; +select @@session.enforce_storage_engine; +@@session.enforce_storage_engine +MyISAM +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=Memory; +Warnings: +Note 1266 Using storage engine MyISAM for table 't1' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SET SESSION sql_mode='NO_ENGINE_SUBSTITUTION'; +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 values (1,'abba'); +CREATE TABLE t2 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=Memory; +ERROR 42000: Unknown storage engine 'MEMORY' +SET SESSION sql_mode=''; +SET SESSION enforce_storage_engine=MyISAM; +select @@session.enforce_storage_engine; +@@session.enforce_storage_engine +MyISAM +select * from t1; +c1 c2 +1 abba +drop table t1; +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SET SESSION enforce_storage_engine=FooBar; +ERROR 42000: Unknown storage engine 'FooBar' +select @@session.enforce_storage_engine; +@@session.enforce_storage_engine +MyISAM +SET SESSION enforce_storage_engine=MyISAM; +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation +SET SESSION enforce_storage_engine=NULL; +SET SESSION sql_mode='NO_ENGINE_SUBSTITUTION'; +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=Memory; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SET GLOBAL enforce_storage_engine=Memory; +SET SESSION sql_mode=''; +select @@session.enforce_storage_engine; +@@session.enforce_storage_engine +MEMORY +select @@global.enforce_storage_engine; +@@global.enforce_storage_engine +MEMORY +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)); +Warnings: +Note 1266 Using storage engine MEMORY for table 't1' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1 +DROP TABLE t1; +set global sql_mode=default; +SET SESSION enforce_storage_engine=NULL; +SET GLOBAL enforce_storage_engine=NULL; +CREATE TABLE t3 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t3 values (NULL, 'test'); +SET SESSION enforce_storage_engine=Memory; +ALTER TABLE t3 ENGINE=MyISAM; +Warnings: +Note 1266 Using storage engine MEMORY for table 't3' +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +DROP TABLE t3; +SET SESSION enforce_storage_engine=NULL; +CREATE TABLE t3 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t3 values (NULL, 'test'); +SET SESSION enforce_storage_engine=Memory; +ALTER TABLE t3 ADD COLUMN c3 INT; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +DROP TABLE t3; +SET SESSION enforce_storage_engine=NULL; +SET GLOBAL enforce_storage_engine=NULL; diff --git a/mysql-test/r/enforce_storage_engine_opt.result b/mysql-test/r/enforce_storage_engine_opt.result new file mode 100644 index 00000000000..1b03aa281d9 --- /dev/null +++ b/mysql-test/r/enforce_storage_engine_opt.result @@ -0,0 +1,15 @@ +SET SQL_MODE=""; +create table t1 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory; +Warnings: +Note 1266 Using storage engine MyISAM for table 't1' +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +set session sql_mode='no_engine_substitution'; +create table t2 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory; +ERROR 42000: Unknown storage engine 'MEMORY' +drop table t1; diff --git a/mysql-test/r/engine_error_in_alter-8453.result b/mysql-test/r/engine_error_in_alter-8453.result new file mode 100644 index 00000000000..c5a3375f33c --- /dev/null +++ b/mysql-test/r/engine_error_in_alter-8453.result @@ -0,0 +1,6 @@ +create table t1 (a int, b int); +set debug_dbug='+d,external_lock_failure'; +alter table t1 add column c int; +ERROR HY000: Got error 168 'KABOOM!' from MyISAM +set debug_dbug=''; +drop table t1; diff --git a/mysql-test/r/events_1.result b/mysql-test/r/events_1.result index e03ccf51d8b..153137bc4f9 100644 --- a/mysql-test/r/events_1.result +++ b/mysql-test/r/events_1.result @@ -1,3 +1,4 @@ +set sql_mode=""; call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted"); drop database if exists events_test; drop database if exists db_x; diff --git a/mysql-test/r/events_2.result b/mysql-test/r/events_2.result index 06075b0e66e..c57893ccf6f 100644 --- a/mysql-test/r/events_2.result +++ b/mysql-test/r/events_2.result @@ -1,3 +1,4 @@ +set sql_mode=""; drop database if exists events_test; create database events_test; use events_test; diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result index 3e12b43e72c..bde4f1c785b 100644 --- a/mysql-test/r/events_bugs.result +++ b/mysql-test/r/events_bugs.result @@ -1,3 +1,4 @@ +SET SQL_MODE=""; drop database if exists events_test; drop database if exists mysqltest_db1; drop database if exists mysqltest_db2; @@ -218,13 +219,13 @@ drop event events_test.mysqltest_user1; drop user mysqltest_user1@localhost; drop database mysqltest_db1; create event e_53 on schedule at (select s1 from ttx) do drop table t; -ERROR 42000: This version of MariaDB doesn't yet support 'Usage of subqueries or stored function calls as part of this statement' +ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions. create event e_53 on schedule every (select s1 from ttx) second do drop table t; -ERROR 42000: This version of MariaDB doesn't yet support 'Usage of subqueries or stored function calls as part of this statement' +ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions. create event e_53 on schedule every 5 second starts (select s1 from ttx) do drop table t; -ERROR 42000: This version of MariaDB doesn't yet support 'Usage of subqueries or stored function calls as part of this statement' +ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions. create event e_53 on schedule every 5 second ends (select s1 from ttx) do drop table t; -ERROR 42000: This version of MariaDB doesn't yet support 'Usage of subqueries or stored function calls as part of this statement' +ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions. drop event if exists e_16; drop procedure if exists p_16; create event e_16 on schedule every 1 second do set @a=5; @@ -265,7 +266,7 @@ begin call p22830_wait(); select 123; end| -ERROR 42000: This version of MariaDB doesn't yet support 'Usage of subqueries or stored function calls as part of this statement' +ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions. create event e22830_1 on schedule every 1 hour do begin call p22830_wait(); diff --git a/mysql-test/r/events_trans.result b/mysql-test/r/events_trans.result index 084587079ba..873f0441089 100644 --- a/mysql-test/r/events_trans.result +++ b/mysql-test/r/events_trans.result @@ -1,3 +1,4 @@ +set sql_mode=""; drop database if exists events_test; drop database if exists mysqltest_no_such_database; create database events_test; diff --git a/mysql-test/r/events_trans_notembedded.result b/mysql-test/r/events_trans_notembedded.result index 1e3dfffe232..fb68bc9ceab 100644 --- a/mysql-test/r/events_trans_notembedded.result +++ b/mysql-test/r/events_trans_notembedded.result @@ -2,6 +2,7 @@ drop database if exists events_test; drop database if exists mysqltest_db2; create database events_test; use events_test; +create user mysqltest_user1@localhost; grant create, insert, select, delete on mysqltest_db2.* to mysqltest_user1@localhost; create database mysqltest_db2; diff --git a/mysql-test/r/explain_json.result b/mysql-test/r/explain_json.result new file mode 100644 index 00000000000..a42f5af114c --- /dev/null +++ b/mysql-test/r/explain_json.result @@ -0,0 +1,1545 @@ +drop table if exists t0,t1,t2; +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +explain format=json select * from t0; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t0", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + } + } +} +explain format=json select * from t0 where 1>2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "message": "Impossible WHERE" + } + } +} +explain format=json select * from t0 where a<3; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t0", + "access_type": "ALL", + "rows": 10, + "filtered": 100, + "attached_condition": "(t0.a < 3)" + } + } +} +# Try a basic join +create table t1 (a int, b int, filler char(32), key(a)); +insert into t1 +select +a.a + b.a* 10 + c.a * 100, +a.a + b.a* 10 + c.a * 100, +'filler' +from t0 a, t0 b, t0 c; +explain format=json select * from t0,t1 where t1.a=t0.a; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t0", + "access_type": "ALL", + "rows": 10, + "filtered": 100, + "attached_condition": "(t0.a is not null)" + }, + "table": { + "table_name": "t1", + "access_type": "ref", + "possible_keys": ["a"], + "key": "a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t0.a"], + "rows": 1, + "filtered": 100 + } + } +} +# Try range and index_merge +create table t2 (a1 int, a2 int, b1 int, b2 int, key(a1,a2), key(b1,b2)); +insert into t2 select a,a,a,a from t1; +explain format=json select * from t2 where a1<5; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "range", + "possible_keys": ["a1"], + "key": "a1", + "key_length": "5", + "used_key_parts": ["a1"], + "rows": 5, + "filtered": 100, + "index_condition": "(t2.a1 < 5)" + } + } +} +explain format=json select * from t2 where a1=1 or b1=2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "index_merge", + "possible_keys": ["a1", "b1"], + "key_length": "5,5", + "index_merge": { + "sort_union": { + "range": { + "key": "a1", + "used_key_parts": ["a1"] + }, + "range": { + "key": "b1", + "used_key_parts": ["b1"] + } + } + }, + "rows": 2, + "filtered": 100, + "attached_condition": "((t2.a1 = 1) or (t2.b1 = 2))" + } + } +} +explain format=json select * from t2 where a1=1 or (b1=2 and b2=3); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "index_merge", + "possible_keys": ["a1", "b1"], + "key_length": "5,10", + "index_merge": { + "sort_union": { + "range": { + "key": "a1", + "used_key_parts": ["a1"] + }, + "range": { + "key": "b1", + "used_key_parts": ["b1", "b2"] + } + } + }, + "rows": 2, + "filtered": 100, + "attached_condition": "((t2.a1 = 1) or ((t2.b1 = 2) and (t2.b2 = 3)))" + } + } +} +explain format=json select * from t2 where (a1=1 and a2=1) or +(b1=2 and b2=1); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "index_merge", + "possible_keys": ["a1", "b1"], + "key_length": "10,10", + "index_merge": { + "union": { + "range": { + "key": "a1", + "used_key_parts": ["a1", "a2"] + }, + "range": { + "key": "b1", + "used_key_parts": ["b1", "b2"] + } + } + }, + "rows": 2, + "filtered": 100, + "attached_condition": "(((t2.a1 = 1) and (t2.a2 = 1)) or ((t2.b1 = 2) and (t2.b2 = 1)))" + } + } +} +# Try ref access on two key components +explain format=json select * from t0,t2 where t2.b1=t0.a and t2.b2=4; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t0", + "access_type": "ALL", + "rows": 10, + "filtered": 100, + "attached_condition": "(t0.a is not null)" + }, + "table": { + "table_name": "t2", + "access_type": "ref", + "possible_keys": ["b1"], + "key": "b1", + "key_length": "10", + "used_key_parts": ["b1", "b2"], + "ref": ["test.t0.a", "const"], + "rows": 1, + "filtered": 100 + } + } +} +drop table t1,t2; +# +# Try a UNION +# +explain format=json select * from t0 A union select * from t0 B; +EXPLAIN +{ + "query_block": { + "union_result": { + "table_name": "<union1,2>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 1, + "table": { + "table_name": "A", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + } + } + }, + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "B", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + } + } + } + ] + } + } +} +explain format=json select * from t0 A union all select * from t0 B; +EXPLAIN +{ + "query_block": { + "union_result": { + "table_name": "<union1,2>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 1, + "table": { + "table_name": "A", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + } + } + }, + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "B", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + } + } + } + ] + } + } +} +# +# Subqueries +# +create table t1 (a int, b int); +insert into t1 select a,a from t0; +explain format=json select a, a > (select max(b) from t1 where t1.b=t0.a) from t0; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t0", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + }, + "subqueries": [ + { + "expression_cache": { + "state": "uninitialized", + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100, + "attached_condition": "(t1.b = t0.a)" + } + } + } + } + ] + } +} +explain format=json +select * from t0 where +a > (select max(b) from t1 where t1.b=t0.a) or a < 3 ; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t0", + "access_type": "ALL", + "rows": 10, + "filtered": 100, + "attached_condition": "((t0.a > (subquery#2)) or (t0.a < 3))" + }, + "subqueries": [ + { + "expression_cache": { + "state": "uninitialized", + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100, + "attached_condition": "(t1.b = t0.a)" + } + } + } + } + ] + } +} +drop table t1; +# +# Join buffering +# +create table t1 (a int, b int); +insert into t1 select tbl1.a+10*tbl2.a, tbl1.a+10*tbl2.a from t0 tbl1, t0 tbl2; +explain format=json +select * from t1 tbl1, t1 tbl2 where tbl1.a=tbl2.a and tbl1.b < 3 and tbl2.b < 5; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "tbl1", + "access_type": "ALL", + "rows": 100, + "filtered": 100, + "attached_condition": "(tbl1.b < 3)" + }, + "block-nl-join": { + "table": { + "table_name": "tbl2", + "access_type": "ALL", + "rows": 100, + "filtered": 100, + "attached_condition": "(tbl2.b < 5)" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "(tbl2.a = tbl1.a)" + } + } +} +drop table t1; +# +# Single-table UPDATE/DELETE, INSERT +# +explain format=json delete from t0; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "message": "Deleting all rows" + } + } +} +explain format=json delete from t0 where 1 > 2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "message": "Impossible WHERE" + } + } +} +explain format=json delete from t0 where a < 3; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "delete": 1, + "table_name": "t0", + "access_type": "ALL", + "rows": 10, + "attached_condition": "(t0.a < 3)" + } + } +} +explain format=json update t0 set a=3 where a in (2,3,4); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "update": 1, + "table_name": "t0", + "access_type": "ALL", + "rows": 10, + "attached_condition": "(t0.a in (2,3,4))" + } + } +} +explain format=json insert into t0 values (1); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t0" + } + } +} +create table t1 like t0; +explain format=json insert into t1 values ((select max(a) from t0)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1" + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t0", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + } + } + } + ] + } +} +drop table t1; +# +# A derived table +# +create table t1 (a int, b int); +insert into t1 select a,a from t0; +explain format=json +select * from (select a, count(*) as cnt from t1 group by a) as tbl +where cnt>0; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 10, + "filtered": 100, + "attached_condition": "(tbl.cnt > 0)", + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "temporary_table": { + "function": "buffer", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + } + } + } + } + } + } + } +} +explain format=json +select * from (select a, count(*) as cnt from t1 group by a) as tbl1, t1 as +tbl2 where cnt=tbl2.a; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "tbl2", + "access_type": "ALL", + "rows": 10, + "filtered": 100, + "attached_condition": "(tbl2.a is not null)" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "8", + "used_key_parts": ["cnt"], + "ref": ["test.tbl2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "(tbl1.cnt = tbl2.a)", + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "temporary_table": { + "function": "buffer", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + } + } + } + } + } + } + } +} +# +# Non-merged semi-join (aka JTBM) +# +explain format=json +select * from t1 where a in (select max(a) from t1 group by b); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100, + "attached_condition": "(t1.a is not null)" + }, + "table": { + "table_name": "<subquery2>", + "access_type": "eq_ref", + "possible_keys": ["distinct_key"], + "key": "distinct_key", + "key_length": "4", + "used_key_parts": ["max(a)"], + "ref": ["test.t1.a"], + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 2, + "temporary_table": { + "function": "buffer", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + } + } + } + } + } + } +} +# +# Semi-join Materialization +# +create table t2 like t1; +insert into t2 select * from t1; +explain format=json +select * from t1,t2 where t1.a in ( select a from t0); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "const_condition": "1", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + }, + "table": { + "table_name": "<subquery2>", + "access_type": "eq_ref", + "possible_keys": ["distinct_key"], + "key": "distinct_key", + "key_length": "4", + "used_key_parts": ["a"], + "ref": ["func"], + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 2, + "table": { + "table_name": "t0", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL" + } + } +} +# +# First-Match +# +explain +select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 10 +1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where; FirstMatch(t2); Using join buffer (flat, BNL join) +explain format=json +select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100, + "first_match": "t2" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "((t1.b = t2.b) and (t1.a = t2.a))" + } + } +} +# +# Duplicate Weedout +# +set @tmp= @@optimizer_switch; +set optimizer_switch='firstmatch=off'; +explain +select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 10 +1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +explain format=json +select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + }, + "duplicates_removal": { + "block-nl-join": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "((t1.b = t2.b) and (t1.a = t2.a))" + } + } + } +} +set optimizer_switch=@tmp; +drop table t1,t2; +# +# MRR for range access (no BKA, just MRR) +# +create table t1 (a int, b int, key(a)); +insert into t1 select tbl1.a+10*tbl2.a, 12345 from t0 tbl1, t0 tbl2; +set @tmp= @@optimizer_switch; +set optimizer_switch='mrr=on,mrr_sort_keys=on'; +explain format=json select * from t1 where a < 3; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "range", + "possible_keys": ["a"], + "key": "a", + "key_length": "5", + "used_key_parts": ["a"], + "rows": 1, + "filtered": 100, + "index_condition": "(t1.a < 3)", + "mrr_type": "Rowid-ordered scan" + } + } +} +# 'Range checked for each record' +set optimizer_switch=@tmp; +explain format=json +select * from t1 tbl1, t1 tbl2 where tbl2.a < tbl1.b; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "tbl1", + "access_type": "ALL", + "rows": 100, + "filtered": 100 + }, + "range-checked-for-each-record": { + "keys": ["a"], + "table": { + "table_name": "tbl2", + "access_type": "ALL", + "possible_keys": ["a"], + "rows": 100, + "filtered": 100 + } + } + } +} +drop table t1; +drop table t0; +# +# MDEV-7265: "Full scan on NULL key", the join case +# +CREATE TABLE t1 (a INT, KEY(a)); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (3),(4); +EXPLAIN FORMAT=JSON SELECT * FROM t1 AS outer_t1 WHERE a <> ALL ( SELECT a FROM t1, t2 WHERE b <> outer_t1.a ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "outer_t1", + "access_type": "index", + "key": "a", + "key_length": "5", + "used_key_parts": ["a"], + "rows": 2, + "filtered": 100, + "attached_condition": "(not(<in_optimizer>(outer_t1.a,<exists>(subquery#2))))", + "using_index": true + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "having_condition": "trigcond(<is_not_null_test>(t1.a))", + "full-scan-on-null_key": { + "table": { + "table_name": "t1", + "access_type": "ref_or_null", + "possible_keys": ["a"], + "key": "a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["func"], + "rows": 2, + "filtered": 100, + "attached_condition": "trigcond(((<cache>(outer_t1.a) = t1.a) or isnull(t1.a)))", + "using_index": true + } + }, + "block-nl-join": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "((t2.b <> outer_t1.a) and trigcond(((<cache>(outer_t1.a) = t1.a) or isnull(t1.a))))" + } + } + } + ] + } +} +DROP TABLE t1,t2; +# +# Join's constant expression +# +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1(a int, b int); +insert into t1 select tbl1.a+10*tbl2.a, 1234 from t0 tbl1, t0 tbl2; +explain format=json +select * from t0 +where +20000 > all (select max(tbl1.a + tbl2.a) +from t1 tbl1, t1 tbl2 where tbl1.b=tbl2.b); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "const_condition": "<not>(<in_optimizer>(20000,(<max>(subquery#2) >= 20000)))", + "table": { + "table_name": "t0", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "tbl1", + "access_type": "ALL", + "rows": 100, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "tbl2", + "access_type": "ALL", + "rows": 100, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "(tbl2.b = tbl1.b)" + } + } + } + ] + } +} +drop table t1; +drop table t0; +# +# MDEV-7264: Assertion `0' failed in subselect_engine::get_identifier() on EXPLAIN JSON +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (3),(4); +EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE a <> ALL ( SELECT b FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "(not(<in_optimizer>(t1.a,t1.a in (subquery#2))))" + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + } + } + } + ] + } +} +DROP TABLE t1, t2; +# +# MDEV-7927: Server crashes in in Time_and_counter_tracker::incr_loops +# +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +EXPLAIN SELECT * FROM t1 WHERE 3 IN ( SELECT 4 UNION SELECT 5 ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +DROP TABLE t1; +# +# MDEV-7860: EXPLAIN FORMAT=JSON crashes for loose scan query +# +create table t2(a int); +insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (a int, b int, c int, d int, key(a,b,c)); +insert into t1 select A.a, B.a, C.a, D.a from t2 A, t2 B, t2 C, t2 D; +explain select count(distinct b) from t1 group by a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range NULL a 10 NULL 101 Using index for group-by +explain format=json select count(distinct b) from t1 group by a; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "range", + "key": "a", + "key_length": "10", + "used_key_parts": ["a", "b"], + "rows": 101, + "filtered": 100, + "using_index_for_group_by": true + } + } +} +analyze format=json select count(distinct b) from t1 group by a; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t1", + "access_type": "range", + "key": "a", + "key_length": "10", + "used_key_parts": ["a", "b"], + "r_loops": 1, + "rows": 101, + "r_rows": 100, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100, + "using_index_for_group_by": true + } + } +} +drop table t1,t2; +# +# Try both variants of LooseScan (data/queries borrowed from group_min_max.test) +# +create table t1 ( +a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(248) default ' ' +); +insert into t1 (a1, a2, b, c, d) values +('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'), +('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'), +('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'), +('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'), +('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'), +('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'), +('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'), +('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'), +('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'), +('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'), +('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'), +('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'), +('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'), +('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'), +('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'), +('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'), +('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'), +('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'), +('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'), +('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'), +('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'), +('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'), +('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'), +('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'), +('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'), +('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'), +('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'), +('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'), +('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'), +('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'), +('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'), +('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'); +create index idx_t1_0 on t1 (a1); +create index idx_t1_1 on t1 (a1,a2,b,c); +create index idx_t1_2 on t1 (a1,a2,b); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Table is already up to date +explain select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by +explain select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range NULL idx_t1_1 163 NULL 65 Using where; Using index for group-by (scanning) +explain format=json select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a'); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "range", + "key": "idx_t1_1", + "key_length": "147", + "used_key_parts": ["a1", "a2", "b"], + "rows": 17, + "filtered": 100, + "attached_condition": "((t1.b = 'a') and (t1.a2 >= 'b'))", + "using_index_for_group_by": true + } + } +} +explain format=json select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121'); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "range", + "key": "idx_t1_1", + "key_length": "163", + "used_key_parts": ["a1", "a2", "b", "c"], + "rows": 65, + "filtered": 100, + "attached_condition": "((t1.b = 'a') and (t1.c = 'i121') and (t1.a2 >= 'b'))", + "using_index_for_group_by": "scanning" + } + } +} +drop table t1; +# +# MDEV-8786 Wrong result for SELECT FORMAT=JSON * FROM t1 WHERE a=_latin1 0xDF +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1); +INSERT INTO t1 VALUES ('a'),('b'); +EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE a=_latin1 0xDF; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "(t1.a = _latin1'\xDF')" + } + } +} +DROP TABLE t1; +# +# MDEV-8785 Wrong results for EXPLAIN EXTENDED...WHERE NULLIF(latin1_col, _utf8'a' COLLATE utf8_bin) IS NOT NULL +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1); +INSERT INTO t1 VALUES ('a'),('A'); +EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE NULLIF(a,_utf8'a' COLLATE utf8_bin); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "(case when convert(t1.a using utf8) = <cache>((_utf8'a' collate utf8_bin)) then NULL else t1.a end)" + } + } +} +DROP TABLE t1; +# +# MDEV-7970: EXPLAIN FORMAT=JSON does not print HAVING +# +create table t0(a int); +insert into t0 values (0),(1),(2),(3); +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; +create table t2 ( +a int, +b int, +key (a) +); +insert into t2 select A.a*1000 + B.a, A.a*1000 + B.a from t0 A, t1 B; +# normal HAVING +explain format=json select a, max(b) as TOP from t2 group by a having TOP > a; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "having_condition": "(TOP > t2.a)", + "filesort": { + "temporary_table": { + "function": "buffer", + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 256, + "filtered": 100 + } + } + } + } +} +# HAVING is always TRUE (not printed) +explain format=json select a, max(b) as TOP from t2 group by a having 1<>2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "filesort": { + "temporary_table": { + "function": "buffer", + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 256, + "filtered": 100 + } + } + } + } +} +# HAVING is always FALSE (intercepted by message) +explain format=json select a, max(b) as TOP from t2 group by a having 1=2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "message": "Impossible HAVING" + } + } +} +# HAVING is absent +explain format=json select a, max(b) as TOP from t2 group by a; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "filesort": { + "temporary_table": { + "function": "buffer", + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 256, + "filtered": 100 + } + } + } + } +} +drop table t0, t1, t2; +# +# MDEV-8829: Assertion `0' failed in Explain_table_access::tag_to_json +# +# Check ET_CONST_ROW_NOT_FOUND +create table t1 (i int) engine=myisam; +explain +select * from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +explain format=json +select * from t1; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "system", + "rows": 0, + "filtered": 0, + "const_row_not_found": true + } + } +} +analyze format=json +select * from t1; +ANALYZE +{ + "query_block": { + "select_id": 1, + "table": { + "message": "no matching row in const table" + } + } +} +drop table t1; +# Check ET_IMPOSSIBLE_ON_CONDITION +create table t1 (a int); +create table t2 (pk int primary key); +insert into t1 values (1),(2); +insert into t2 values (1),(2); +explain +select * from t1 left join t2 on t2.pk > 10 and t2.pk < 0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 const PRIMARY NULL NULL NULL 1 Impossible ON condition +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +explain format=json +select * from t1 left join t2 on t2.pk > 10 and t2.pk < 0; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "const_condition": "1", + "table": { + "table_name": "t2", + "access_type": "const", + "possible_keys": ["PRIMARY"], + "rows": 1, + "filtered": 100, + "impossible_on_condition": true + }, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + } + } +} +analyze format=json +select * from t1 left join t2 on t2.pk > 10 and t2.pk < 0; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "const_condition": "1", + "table": { + "table_name": "t2", + "access_type": "const", + "possible_keys": ["PRIMARY"], + "r_loops": 0, + "rows": 1, + "r_rows": null, + "filtered": 100, + "r_filtered": null, + "impossible_on_condition": true + }, + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 1, + "rows": 2, + "r_rows": 2, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + } + } +} +# Check ET_NOT_EXISTS: +explain +select * from t1 left join t2 on t2.pk=t1.a where t2.pk is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using index; Not exists +explain format=json +select * from t1 left join t2 on t2.pk=t1.a where t2.pk is null; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + }, + "table": { + "table_name": "t2", + "access_type": "eq_ref", + "possible_keys": ["PRIMARY"], + "key": "PRIMARY", + "key_length": "4", + "used_key_parts": ["pk"], + "ref": ["test.t1.a"], + "rows": 1, + "filtered": 100, + "attached_condition": "(trigcond(isnull(t2.pk)) and trigcond(trigcond((t1.a is not null))))", + "using_index": true, + "not_exists": true + } + } +} +analyze format=json +select * from t1 left join t2 on t2.pk=t1.a where t2.pk is null; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 1, + "rows": 2, + "r_rows": 2, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + }, + "table": { + "table_name": "t2", + "access_type": "eq_ref", + "possible_keys": ["PRIMARY"], + "key": "PRIMARY", + "key_length": "4", + "used_key_parts": ["pk"], + "ref": ["test.t1.a"], + "r_loops": 2, + "rows": 1, + "r_rows": 1, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100, + "attached_condition": "(trigcond(isnull(t2.pk)) and trigcond(trigcond((t1.a is not null))))", + "using_index": true, + "not_exists": true + } + } +} +# Check ET_DISTINCT +explain +select distinct t1.a from t1 join t2 on t2.pk=t1.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where; Using temporary +1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index; Distinct +explain format=json +select distinct t1.a from t1 join t2 on t2.pk=t1.a; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "temporary_table": { + "function": "buffer", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "(t1.a is not null)" + }, + "table": { + "table_name": "t2", + "access_type": "eq_ref", + "possible_keys": ["PRIMARY"], + "key": "PRIMARY", + "key_length": "4", + "used_key_parts": ["pk"], + "ref": ["test.t1.a"], + "rows": 1, + "filtered": 100, + "using_index": true, + "distinct": true + } + } + } +} +analyze format=json +select distinct t1.a from t1 join t2 on t2.pk=t1.a; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 1, + "rows": 2, + "r_rows": 2, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100, + "attached_condition": "(t1.a is not null)" + }, + "table": { + "table_name": "t2", + "access_type": "eq_ref", + "possible_keys": ["PRIMARY"], + "key": "PRIMARY", + "key_length": "4", + "used_key_parts": ["pk"], + "ref": ["test.t1.a"], + "r_loops": 2, + "rows": 1, + "r_rows": 1, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100, + "using_index": true, + "distinct": true + } + } + } +} +drop table t1,t2; +# Check ET_USING_INDEX_CONDITION_BKA +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2(a int); +insert into t2 select A.a + B.a* 10 + C.a * 100 from t1 A, t1 B, t1 C; +create table t3(a int, b int); +insert into t3 select a,a from t1; +create table t4(a int, b int, c int, filler char(100), key (a,b)); +insert into t4 select a,a,a, 'filler-data' from t2; +set @tmp_optimizer_switch=@@optimizer_switch; +set @tmp_join_cache_level=@@join_cache_level; +set optimizer_switch='mrr=on'; +set join_cache_level=6; +explain +select * from t3,t4 where t3.a=t4.a and (t4.b+1 <= t3.b+1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t4 ref a a 5 test.t3.a 1 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan +explain format=json +select * from t3,t4 where t3.a=t4.a and (t4.b+1 <= t3.b+1); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t3", + "access_type": "ALL", + "rows": 10, + "filtered": 100, + "attached_condition": "(t3.a is not null)" + }, + "block-nl-join": { + "table": { + "table_name": "t4", + "access_type": "ref", + "possible_keys": ["a"], + "key": "a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t3.a"], + "rows": 1, + "filtered": 100, + "index_condition_bka": "((t4.b + 1) <= (t3.b + 1))" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BKA", + "mrr_type": "Rowid-ordered scan" + } + } +} +analyze format=json +select * from t3,t4 where t3.a=t4.a and (t4.b+1 <= t3.b+1); +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t3", + "access_type": "ALL", + "r_loops": 1, + "rows": 10, + "r_rows": 10, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100, + "attached_condition": "(t3.a is not null)" + }, + "block-nl-join": { + "table": { + "table_name": "t4", + "access_type": "ref", + "possible_keys": ["a"], + "key": "a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t3.a"], + "r_loops": 0, + "rows": 1, + "r_rows": null, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": null, + "index_condition_bka": "((t4.b + 1) <= (t3.b + 1))" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BKA", + "mrr_type": "Rowid-ordered scan", + "r_filtered": 100 + } + } +} +set optimizer_switch=@tmp_optimizer_switch; +set join_cache_level=@tmp_join_cache_level; +drop table t1,t2,t3,t4; diff --git a/mysql-test/r/explain_json_format_partitions.result b/mysql-test/r/explain_json_format_partitions.result new file mode 100644 index 00000000000..fa2b5681120 --- /dev/null +++ b/mysql-test/r/explain_json_format_partitions.result @@ -0,0 +1,86 @@ +create table t2(a int); +insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 ( +a int not null +) partition by key(a); +insert into t1 select a from t2; +explain partitions select * from t1 where a in (2,3,4); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 10 Using where +explain format=json select * from t1 where a in (2,3,4); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "partitions": ["p0"], + "access_type": "ALL", + "rows": 10, + "filtered": 100, + "attached_condition": "(t1.a in (2,3,4))" + } + } +} +analyze format=json select * from t1 where a in (2,3,4); +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t1", + "partitions": ["p0"], + "access_type": "ALL", + "r_loops": 1, + "rows": 10, + "r_rows": 10, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 30, + "attached_condition": "(t1.a in (2,3,4))" + } + } +} +analyze format=json update t1 set a=a+10 where a in (2,3,4); +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_total_time_ms": "REPLACED", + "buffer": { + "table": { + "update": 1, + "table_name": "t1", + "partitions": ["p0"], + "access_type": "ALL", + "rows": 10, + "r_rows": 10, + "r_filtered": 30, + "r_total_time_ms": "REPLACED", + "attached_condition": "(t1.a in (2,3,4))" + } + } + } +} +analyze format=json delete from t1 where a in (20,30,40); +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_total_time_ms": "REPLACED", + "table": { + "delete": 1, + "table_name": "t1", + "partitions": ["p0"], + "access_type": "ALL", + "rows": 10, + "r_rows": 10, + "r_filtered": 0, + "r_total_time_ms": "REPLACED", + "attached_condition": "(t1.a in (20,30,40))" + } + } +} +drop table t1,t2; diff --git a/mysql-test/r/explain_json_innodb.result b/mysql-test/r/explain_json_innodb.result new file mode 100644 index 00000000000..cc389c63bda --- /dev/null +++ b/mysql-test/r/explain_json_innodb.result @@ -0,0 +1,57 @@ +drop table if exists t0,t1,t2; +# +# MDEV-7266: Assertion `!element_started' failed in Json_writer& Json_writer::add_member +# +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (column_name_1 INT, column_name_2 VARCHAR(52)) ENGINE=InnoDB; +INSERT INTO t2 VALUES (3,'United States'); +CREATE TABLE t3 (b INT, c VARCHAR(3), PRIMARY KEY (c,b)) ENGINE=InnoDB; +INSERT INTO t3 VALUES (4,'USA'),(5,'CAN'); +EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE 0 < ALL ( +SELECT tbl_alias1.column_name_1 FROM t2 AS tbl_alias1, t3 AS tbl_alias2 +WHERE tbl_alias2.b = tbl_alias1.column_name_1 AND tbl_alias2.c = tbl_alias1.column_name_2 +); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "tbl_alias1", + "access_type": "ALL", + "rows": 1, + "filtered": 100, + "attached_condition": "((tbl_alias1.column_name_2 is not null) and (tbl_alias1.column_name_1 is not null))" + }, + "table": { + "table_name": "tbl_alias2", + "access_type": "eq_ref", + "possible_keys": ["PRIMARY"], + "key": "PRIMARY", + "key_length": "9", + "used_key_parts": ["c", "b"], + "ref": [ + "test.tbl_alias1.column_name_2", + "test.tbl_alias1.column_name_1" + ], + "rows": 1, + "filtered": 100, + "attached_condition": "(tbl_alias2.c = tbl_alias1.column_name_2)", + "using_index": true + } + } + } + ] + } +} +drop table t1,t2,t3; diff --git a/mysql-test/r/fast_prefix_index_fetch_innodb.result b/mysql-test/r/fast_prefix_index_fetch_innodb.result new file mode 100644 index 00000000000..92af85f7fdb --- /dev/null +++ b/mysql-test/r/fast_prefix_index_fetch_innodb.result @@ -0,0 +1,102 @@ +drop table if exists prefixinno; +set global innodb_prefix_index_cluster_optimization = ON; +show variables like 'innodb_prefix_index_cluster_optimization'; +Variable_name Value +innodb_prefix_index_cluster_optimization ON +# Create a table with a large varchar field that we index the prefix +# of and ensure we only trigger cluster lookups when we expect it. +create table prefixinno ( +id int not null, +fake_id int not null, +bigfield varchar(4096), +primary key(id), +index bigfield_idx (bigfield(32)), +index fake_id_bigfield_prefix (fake_id, bigfield(32)) +) engine=innodb; +insert into prefixinno values (1, 1001, repeat('a', 1)), +(8, 1008, repeat('b', 8)), +(24, 1024, repeat('c', 24)), +(31, 1031, repeat('d', 31)), +(32, 1032, repeat('x', 32)), +(33, 1033, repeat('y', 33)), +(128, 1128, repeat('z', 128)); +select * from prefixinno; +id fake_id bigfield +1 1001 a +8 1008 bbbbbbbb +24 1024 cccccccccccccccccccccccc +31 1031 ddddddddddddddddddddddddddddddd +32 1032 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +33 1033 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy +128 1128 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz +# Baseline sanity check: 0, 0. +no-op query +no-op query +cluster_lookups_matched +1 +cluster_lookups_avoided_matched +1 +# Eligible for optimization. +id bigfield +31 ddddddddddddddddddddddddddddddd +cluster_lookups_matched +1 +cluster_lookups_avoided_matched +1 +# Eligible for optimization, access via fake_id only. +id bigfield +31 ddddddddddddddddddddddddddddddd +cluster_lookups_matched +1 +cluster_lookups_avoided_matched +1 +# Not eligible for optimization, access via fake_id of big row. +id bigfield +33 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy +cluster_lookups_matched +1 +cluster_lookups_avoided_matched +1 +# Not eligible for optimization. +id bigfield +32 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +cluster_lookups_matched +1 +cluster_lookups_avoided_matched +1 +# Not eligible for optimization. +id bigfield +33 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy +cluster_lookups_matched +1 +cluster_lookups_avoided_matched +1 +# Eligible, should not increment lookup counter. +id bigfield +8 bbbbbbbb +cluster_lookups_matched +1 +cluster_lookups_avoided_matched +1 +# Eligible, should not increment lookup counter. +id bigfield +24 cccccccccccccccccccccccc +cluster_lookups_matched +1 +cluster_lookups_avoided_matched +1 +# Should increment lookup counter. +id bigfield +128 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz +cluster_lookups_matched +1 +cluster_lookups_avoided_matched +1 +# Disable optimization, confirm we still increment counter. +id bigfield +33 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy +cluster_lookups_matched +1 +cluster_lookups_avoided_matched +1 +# make test suite happy by cleaning up our mess diff --git a/mysql-test/r/features.result b/mysql-test/r/features.result index 04e0df98ec7..52650d118b3 100644 --- a/mysql-test/r/features.result +++ b/mysql-test/r/features.result @@ -1,4 +1,5 @@ drop table if exists t1; +set sql_mode=""; flush status; show status like "feature%"; Variable_name Value diff --git a/mysql-test/r/file_contents.result b/mysql-test/r/file_contents.result index 0b0d5d598d6..2b5e6e6229b 100644 --- a/mysql-test/r/file_contents.result +++ b/mysql-test/r/file_contents.result @@ -1,6 +1,6 @@ Checking 'INFO_SRC' and 'INFO_BIN' -INFO_SRC: Found MySQL version number / Found GIT revision id +INFO_SRC: Found MariaDB version number / Found GIT revision id INFO_BIN: Found 'Compiler ... used' line / Found 'Feature flags' line End of tests diff --git a/mysql-test/r/fix_priv_tables.result b/mysql-test/r/fix_priv_tables.result index e54330a5520..dea1ccdbd18 100644 --- a/mysql-test/r/fix_priv_tables.result +++ b/mysql-test/r/fix_priv_tables.result @@ -1,4 +1,5 @@ drop table if exists t1,t1aa,t2aa; +set sql_mode=""; DROP DATABASE IF EXISTS testdb; CREATE DATABASE testdb; CREATE TABLE testdb.t1 ( diff --git a/mysql-test/r/flush-innodb-notembedded.result b/mysql-test/r/flush-innodb-notembedded.result index 817d57d9d79..911abfe6daf 100644 --- a/mysql-test/r/flush-innodb-notembedded.result +++ b/mysql-test/r/flush-innodb-notembedded.result @@ -1,3 +1,4 @@ +set sql_mode=""; # Test 7: Check privileges required. # CREATE DATABASE db1; diff --git a/mysql-test/r/flush2.result b/mysql-test/r/flush2.result index 13bcc371ef6..ff5d8755f01 100644 --- a/mysql-test/r/flush2.result +++ b/mysql-test/r/flush2.result @@ -3,10 +3,32 @@ set global expire_logs_days = 3; show variables like 'log_bin%'; Variable_name Value log_bin OFF +log_bin_basename +log_bin_index log_bin_trust_function_creators ON +show variables like 'relay_log%'; +Variable_name Value +relay_log mysqld-relay-bin +relay_log_basename MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin +relay_log_index MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin.index +relay_log_info_file relay-log.info +relay_log_purge ON +relay_log_recovery OFF +relay_log_space_limit 0 flush logs; show variables like 'log_bin%'; Variable_name Value log_bin OFF +log_bin_basename +log_bin_index log_bin_trust_function_creators ON +show variables like 'relay_log%'; +Variable_name Value +relay_log mysqld-relay-bin +relay_log_basename MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin +relay_log_index MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin.index +relay_log_info_file relay-log.info +relay_log_purge ON +relay_log_recovery OFF +relay_log_space_limit 0 set global expire_logs_days = 0; diff --git a/mysql-test/r/flush_read_lock.result b/mysql-test/r/flush_read_lock.result index c2e8531d01f..260edf8e51d 100644 --- a/mysql-test/r/flush_read_lock.result +++ b/mysql-test/r/flush_read_lock.result @@ -1,3 +1,5 @@ +set global sql_mode=""; +set local sql_mode=""; # FTWRL takes two global metadata locks -- a global shared # metadata lock and the commit blocker lock. # The first lock prevents DDL from taking place. @@ -1667,3 +1669,4 @@ drop database `#mysql50#mysqltest-2`; drop database mysqltest1; drop temporary tables t1_temp, t2_temp; drop tables t1_base, t2_base, t3_trans; +set global sql_mode=default; diff --git a/mysql-test/r/fulltext_order_by.result b/mysql-test/r/fulltext_order_by.result index 419c1f53a2c..c2f57c6f9c2 100644 --- a/mysql-test/r/fulltext_order_by.result +++ b/mysql-test/r/fulltext_order_by.result @@ -126,7 +126,7 @@ group by a.text, b.id, b.betreff order by match(b.betreff) against ('+abc' in boolean mode) desc; -ERROR 42000: Incorrect usage/placement of 'MATCH()' +ERROR 42000: Table 'b' from one of the SELECTs cannot be used in field list select a.text, b.id, b.betreff from t2 a inner join t3 b on a.id = b.forum inner join @@ -142,7 +142,7 @@ where match(c.beitrag) against ('+abc' in boolean mode) order by match(b.betreff) against ('+abc' in boolean mode) desc; -ERROR 42000: Incorrect usage/placement of 'MATCH()' +ERROR 42000: Table 'b' from one of the SELECTs cannot be used in field list select a.text, b.id, b.betreff from t2 a inner join t3 b on a.id = b.forum inner join @@ -158,7 +158,7 @@ where match(c.beitrag) against ('+abc' in boolean mode) order by match(betreff) against ('+abc' in boolean mode) desc; -ERROR 42000: Incorrect usage/placement of 'MATCH()' +text id betreff (select b.id, b.betreff from t3 b) union (select b.id, b.betreff from t3 b) order by match(betreff) against ('+abc' in boolean mode) desc; diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result index 9fde006b377..e9c8193685b 100644 --- a/mysql-test/r/func_compress.result +++ b/mysql-test/r/func_compress.result @@ -1,3 +1,4 @@ +set global max_allowed_packet=1048576; select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa '; @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ' string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa @@ -72,6 +73,9 @@ set @@global.max_allowed_packet=1048576*100; select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null; compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: XXX +Warning 1292 Truncated incorrect DOUBLE value: XXX set @@global.max_allowed_packet=default; create table t1(a blob); insert into t1 values(NULL), (compress('a')); @@ -152,6 +156,7 @@ UNCOMPRESS(CAST(0 AS BINARY(5))) NULL Warnings: Warning 1259 ZLIB: Input data corrupted +set global max_allowed_packet=default; # # End of 5.5 tests # diff --git a/mysql-test/r/func_encrypt.result b/mysql-test/r/func_encrypt.result index 91ff4e218fb..f5e03a90327 100644 --- a/mysql-test/r/func_encrypt.result +++ b/mysql-test/r/func_encrypt.result @@ -190,3 +190,21 @@ insert into t1 values (null,'contraction\'s'); insert into t1 values (-15818,'requirement\'s'); select encrypt(f1,f2) as a from t1,(select encrypt(f1,f2) as b from t1) a; drop table t1; +# +# Start of 10.1 tests +# +# +# MDEV-8369 Unexpected impossible WHERE for a condition on a ZEROFILL field +# +CREATE TABLE t1 (a INT(6) ZEROFILL); +INSERT INTO t1 VALUES (1),(2); +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a=1 AND DES_ENCRYPT('test',a)=_latin1 'abc' COLLATE latin1_bin; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and (des_encrypt('test',`test`.`t1`.`a`) = 'abc')) +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 0bc31a5e85b..9014450bef3 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -1119,3 +1119,84 @@ GROUP_CONCAT(t1a.a ORDER BY 1, t1a.a=0) 1,1 2,2 DROP TABLE t1; +# +# WL#6098 Eliminate GROUP_CONCAT intermediate result limitation. +# Bug#13387020 GROUP_CONCAT WITH ORDER BY RESULTS ARE TRUNCATED. +# +SET group_concat_max_len= 9999999; +CREATE TABLE t1 (f1 LONGTEXT , f2 INTEGER); +INSERT INTO t1 VALUES (REPEAT('a', 500000), 0), (REPEAT('b', 500000), 1), (REPEAT('c', 500000), 2); +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1; +LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) +1500002 +SELECT LENGTH(GROUP_CONCAT(DISTINCT f1 ORDER BY f1 DESC)) FROM t1; +LENGTH(GROUP_CONCAT(DISTINCT f1 ORDER BY f1 DESC)) +1500002 +SELECT SUBSTRING(GROUP_CONCAT(DISTINCT f1 ORDER BY f1 DESC), 1, 5) FROM t1; +SUBSTRING(GROUP_CONCAT(DISTINCT f1 ORDER BY f1 DESC), 1, 5) +ccccc +SELECT LENGTH(GROUP_CONCAT(DISTINCT f1)) FROM t1; +LENGTH(GROUP_CONCAT(DISTINCT f1)) +1500002 +SELECT LENGTH(GROUP_CONCAT(UPPER(f1) ORDER BY f2)) FROM t1; +LENGTH(GROUP_CONCAT(UPPER(f1) ORDER BY f2)) +1500002 +SELECT LENGTH(GROUP_CONCAT(DISTINCT UPPER(f1) ORDER BY f1)) FROM t1; +LENGTH(GROUP_CONCAT(DISTINCT UPPER(f1) ORDER BY f1)) +1500002 +SELECT SUBSTRING(GROUP_CONCAT(DISTINCT UPPER(f1) ORDER BY f1), 1, 5) FROM t1; +SUBSTRING(GROUP_CONCAT(DISTINCT UPPER(f1) ORDER BY f1), 1, 5) +AAAAA +SELECT LENGTH(GROUP_CONCAT(DISTINCT UPPER(f1))) FROM t1; +LENGTH(GROUP_CONCAT(DISTINCT UPPER(f1))) +1500002 +CREATE TABLE t2 SELECT GROUP_CONCAT(f1 order by f2) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `GROUP_CONCAT(f1 order by f2)` mediumtext +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 SELECT GROUP_CONCAT(UPPER(f1) ORDER BY f2) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `GROUP_CONCAT(UPPER(f1) ORDER BY f2)` mediumtext +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +SET group_concat_max_len= DEFAULT; +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1; +LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) +1024 +Warnings: +Warning 1260 Row 2 was cut by GROUP_CONCAT() +SET group_concat_max_len= 499999; +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1 WHERE f2 = 0; +LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) +499999 +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1 GROUP BY f2; +LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) +499999 +499999 +499999 +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() +INSERT INTO t1 VALUES (REPEAT('a', 499999), 3), (REPEAT('b', 500000), 4); +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1 GROUP BY f2; +LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) +499999 +499999 +499999 +499999 +499999 +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() +Warning 1260 Row 5 was cut by GROUP_CONCAT() +DROP TABLE t1; +SET group_concat_max_len= DEFAULT; diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index ac076ec4348..0d9d4ffff9f 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -787,7 +787,7 @@ drop table t2; create table t2 select f2 from (select now() f2 from t1) a; show columns from t2; Field Type Null Key Default Extra -f2 datetime NO 0000-00-00 00:00:00 +f2 datetime NO NULL drop table t2, t1; CREATE TABLE t1( id int PRIMARY KEY, @@ -2107,6 +2107,9 @@ select avg(export_set( 3, 'y', sha(i))), group_concat(d) from t1 group by d orde avg(export_set( 3, 'y', sha(i))) group_concat(d) 0 2008-10-02 0 2010-12-12 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'y,y,356a192b7913b04c54574d18c28d46e6395428ab,356a192b7913b04c54574d18c28d46e6395428ab,356a192b7913b04c54574d18c28d46e6395428ab,3' +Warning 1292 Truncated incorrect DOUBLE value: 'y,y,da4b9237bacccdf19c0760cab7aec4a8359010b0,da4b9237bacccdf19c0760cab7aec4a8359010b0,da4b9237bacccdf19c0760cab7aec4a8359010b0,d' drop table t1; # # MDEV-4290: crash in st_select_lex::mark_as_dependent @@ -2270,3 +2273,72 @@ t2_id GROUP_CONCAT(IF (t6.b, t6.f, t5.f) ORDER BY 1) EXECUTE stmt; t2_id GROUP_CONCAT(IF (t6.b, t6.f, t5.f) ORDER BY 1) DROP TABLE t1,t2,t3,t4,t5,t6; +# +# MDEV-8852 Implicit or explicit CAST from MAX(string) to INT,DOUBLE,DECIMAL does not produce warnings +# +SELECT MAX('x') << 1, CAST(MAX('x') AS DOUBLE), CAST(MAX('x') AS DECIMAL); +MAX('x') << 1 CAST(MAX('x') AS DOUBLE) CAST(MAX('x') AS DECIMAL) +0 0 0 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'x' +Warning 1292 Truncated incorrect DOUBLE value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'x' +# +# MDEV-8918 Wrong result for CAST(AVG(a) AS SIGNED) +# +CREATE TABLE t1 (id INT, a BIGINT); +INSERT INTO t1 VALUES (1,0x7FFFFFFFFFFFFFFF),(2,0x7FFFFFFFFFFFFFFF); +SELECT id, AVG(a) AS avg, CAST(MIN(a) AS SIGNED) AS cast_min FROM t1 GROUP BY id HAVING avg!=123 ORDER BY id; +id avg cast_min +1 9223372036854775807.0000 9223372036854775807 +2 9223372036854775807.0000 9223372036854775807 +SELECT id, AVG(a) AS avg, CAST(AVG(a) AS SIGNED) AS cast_avg FROM t1 GROUP BY id HAVING avg!=123 ORDER BY id; +id avg cast_avg +1 9223372036854775807.0000 9223372036854775807 +2 9223372036854775807.0000 9223372036854775807 +DROP TABLE t1; +# +# MDEV-9656 Assertion `0' failed in Item_sum_field::get_tmp_table_field() +# +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +SELECT DISTINCT VAR_POP(1) FROM t1 GROUP BY @a := 's'; +VAR_POP(1) +0.0000 +DROP TABLE t1; +# +# MDEV-8921 Wrong result for CAST(AVG(double_column) AS SIGNED) +# +CREATE TABLE t1 (id INT, a DOUBLE); +INSERT INTO t1 VALUES (1,0x7FFFFFFFFFFFFFFF),(2,0x7FFFFFFFFFFFFFFF); +SELECT id, AVG(a) AS avg, CAST(MIN(a) AS SIGNED) AS cast_min,CAST(AVG(a) AS SIGNED) AS cast_avg FROM t1 GROUP BY id HAVING avg!=123 ORDER BY id; +id avg cast_min cast_avg +1 9.223372036854776e18 9223372036854775807 9223372036854775807 +2 9.223372036854776e18 9223372036854775807 9223372036854775807 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES (0x7FFFFFFFFFFFFFFF); +SELECT MIN(a), SUM(a), CAST(SUM(a) AS SIGNED), CAST(AVG(a) AS SIGNED) FROM t1; +MIN(a) SUM(a) CAST(SUM(a) AS SIGNED) CAST(AVG(a) AS SIGNED) +9.223372036854776e18 9.223372036854776e18 9223372036854775807 9223372036854775807 +DROP TABLE t1; +# +# MDEV-7195 AVG() loses precision in INT context +# +CREATE TABLE t1 ( +auto SERIAL, +fld1 bigint unsigned NOT NULL, +companynr tinyint(2) unsigned zerofill DEFAULT '00' NOT NULL, +UNIQUE fld1 (fld1) +); +INSERT INTO t1 VALUES (1,0x7FFFFFFFFFFFFFFF,00); +INSERT INTO t1 VALUES (2,0x7FFFFFFFFFFFFFFE,37); +INSERT INTO t1 VALUES (3,0x7FFFFFFFFFFFFFFC,37); +SELECT companynr, AVG(fld1), AVG(fld1)<<0 AS avg1, CAST(AVG(fld1) AS UNSIGNED)<<0 AS avg2 FROM t1 GROUP BY companynr; +companynr AVG(fld1) avg1 avg2 +00 9223372036854775807.0000 9223372036854775807 9223372036854775807 +37 9223372036854775805.0000 9223372036854775805 9223372036854775805 +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/func_hybrid_type.result b/mysql-test/r/func_hybrid_type.result new file mode 100644 index 00000000000..eeaa79e7dce --- /dev/null +++ b/mysql-test/r/func_hybrid_type.result @@ -0,0 +1,3431 @@ +# +# Start of 10.1 tests +# +# +# MDEV-8865 Wrong field type or metadata for COALESCE(signed_int_column, unsigned_int_column) +# +# +CREATE TABLE t1 (a INT, b INT UNSIGNED); +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (-1,1); +INSERT INTO t1 VALUES (-2147483648,4294967295); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 3 11 11 Y 32768 0 63 +def case_______a 3 11 11 Y 32896 0 63 +def case_____a_a 3 11 11 Y 32896 0 63 +def coalesce___a 3 11 11 Y 32896 0 63 +def coalesce_a_a 3 11 11 Y 32896 0 63 +def if_______a_a 3 11 11 Y 32896 0 63 +def ifnull___a_a 3 11 11 Y 32896 0 63 +def least____a_a 3 11 11 Y 32896 0 63 +def greatest_a_a 3 11 11 Y 32896 0 63 +def test t1 t1 b ___________b 3 10 10 Y 32800 0 63 +def case_______b 3 10 10 Y 32928 0 63 +def case_____b_b 3 10 10 Y 32928 0 63 +def coalesce___b 3 10 10 Y 32928 0 63 +def coalesce_b_b 3 10 10 Y 32928 0 63 +def if_______b_b 3 10 10 Y 32928 0 63 +def ifnull___b_b 3 10 10 Y 32928 0 63 +def least____b_b 3 10 10 Y 32928 0 63 +def greatest_b_b 3 10 10 Y 32928 0 63 +___________a 1 +case_______a 1 +case_____a_a 1 +coalesce___a 1 +coalesce_a_a 1 +if_______a_a 1 +ifnull___a_a 1 +least____a_a 1 +greatest_a_a 1 +___________b 1 +case_______b 1 +case_____b_b 1 +coalesce___b 1 +coalesce_b_b 1 +if_______b_b 1 +ifnull___b_b 1 +least____b_b 1 +greatest_b_b 1 +___________a -1 +case_______a -1 +case_____a_a -1 +coalesce___a -1 +coalesce_a_a -1 +if_______a_a -1 +ifnull___a_a -1 +least____a_a -1 +greatest_a_a -1 +___________b 1 +case_______b 1 +case_____b_b 1 +coalesce___b 1 +coalesce_b_b 1 +if_______b_b 1 +ifnull___b_b 1 +least____b_b 1 +greatest_b_b 1 +___________a -2147483648 +case_______a -2147483648 +case_____a_a -2147483648 +coalesce___a -2147483648 +coalesce_a_a -2147483648 +if_______a_a -2147483648 +ifnull___a_a -2147483648 +least____a_a -2147483648 +greatest_a_a -2147483648 +___________b 4294967295 +case_______b 4294967295 +case_____b_b 4294967295 +coalesce___b 4294967295 +coalesce_b_b 4294967295 +if_______b_b 4294967295 +ifnull___b_b 4294967295 +least____b_b 4294967295 +greatest_b_b 4294967295 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 246 11 11 Y 32896 0 63 +def case_____b_a 246 11 10 Y 32896 0 63 +def coalesce_a_b 246 11 11 Y 32896 0 63 +def coalesce_b_a 246 11 10 Y 32896 0 63 +def if_______a_b 246 11 10 Y 32896 0 63 +def if_______b_a 246 11 11 Y 32896 0 63 +def ifnull___a_b 246 11 11 Y 32896 0 63 +def ifnull___b_a 246 11 10 Y 32896 0 63 +def least____a_b 246 11 11 Y 32896 0 63 +def least____b_a 246 11 11 Y 32896 0 63 +def greatest_a_b 246 11 10 Y 32896 0 63 +def greatest_b_a 246 11 10 Y 32896 0 63 +case_____a_b 1 +case_____b_a 1 +coalesce_a_b 1 +coalesce_b_a 1 +if_______a_b 1 +if_______b_a 1 +ifnull___a_b 1 +ifnull___b_a 1 +least____a_b 1 +least____b_a 1 +greatest_a_b 1 +greatest_b_a 1 +case_____a_b -1 +case_____b_a 1 +coalesce_a_b -1 +coalesce_b_a 1 +if_______a_b 1 +if_______b_a -1 +ifnull___a_b -1 +ifnull___b_a 1 +least____a_b -1 +least____b_a -1 +greatest_a_b 1 +greatest_b_a 1 +case_____a_b -2147483648 +case_____b_a 4294967295 +coalesce_a_b -2147483648 +coalesce_b_a 4294967295 +if_______a_b 4294967295 +if_______b_a -2147483648 +ifnull___a_b -2147483648 +ifnull___b_a 4294967295 +least____a_b -2147483648 +least____b_a -2147483648 +greatest_a_b 4294967295 +greatest_b_a 4294967295 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` int(11) DEFAULT NULL, + `case_______a` int(11) DEFAULT NULL, + `case_____a_a` int(11) DEFAULT NULL, + `coalesce___a` int(11) DEFAULT NULL, + `coalesce_a_a` int(11) DEFAULT NULL, + `if_______a_a` int(11) DEFAULT NULL, + `ifnull___a_a` int(11) DEFAULT NULL, + `least____a_a` int(11) DEFAULT NULL, + `greatest_a_a` int(11) DEFAULT NULL, + `___________b` int(10) unsigned DEFAULT NULL, + `case_______b` int(10) unsigned DEFAULT NULL, + `case_____b_b` int(10) unsigned DEFAULT NULL, + `coalesce___b` int(10) unsigned DEFAULT NULL, + `coalesce_b_b` int(10) unsigned DEFAULT NULL, + `if_______b_b` int(10) unsigned DEFAULT NULL, + `ifnull___b_b` int(10) unsigned DEFAULT NULL, + `least____b_b` int(10) unsigned DEFAULT NULL, + `greatest_b_b` int(10) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` decimal(10,0) DEFAULT NULL, + `case_____b_a` decimal(10,0) DEFAULT NULL, + `coalesce_a_b` decimal(10,0) DEFAULT NULL, + `coalesce_b_a` decimal(10,0) DEFAULT NULL, + `if_______a_b` decimal(10,0) DEFAULT NULL, + `if_______b_a` decimal(10,0) DEFAULT NULL, + `ifnull___a_b` decimal(10,0) DEFAULT NULL, + `ifnull___b_a` decimal(10,0) DEFAULT NULL, + `least____a_b` decimal(10,0) DEFAULT NULL, + `least____b_a` decimal(10,0) DEFAULT NULL, + `greatest_a_b` decimal(10,0) DEFAULT NULL, + `greatest_b_a` decimal(10,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (-2147483648,2147483647); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 3 11 11 Y 32768 0 63 +def case_______a 3 11 11 Y 32896 0 63 +def case_____a_a 3 11 11 Y 32896 0 63 +def coalesce___a 3 11 11 Y 32896 0 63 +def coalesce_a_a 3 11 11 Y 32896 0 63 +def if_______a_a 3 11 11 Y 32896 0 63 +def ifnull___a_a 3 11 11 Y 32896 0 63 +def least____a_a 3 11 11 Y 32896 0 63 +def greatest_a_a 3 11 11 Y 32896 0 63 +def test t1 t1 b ___________b 3 11 10 Y 32768 0 63 +def case_______b 3 11 10 Y 32896 0 63 +def case_____b_b 3 11 10 Y 32896 0 63 +def coalesce___b 3 11 10 Y 32896 0 63 +def coalesce_b_b 3 11 10 Y 32896 0 63 +def if_______b_b 3 11 10 Y 32896 0 63 +def ifnull___b_b 3 11 10 Y 32896 0 63 +def least____b_b 3 11 10 Y 32896 0 63 +def greatest_b_b 3 11 10 Y 32896 0 63 +___________a 1 +case_______a 1 +case_____a_a 1 +coalesce___a 1 +coalesce_a_a 1 +if_______a_a 1 +ifnull___a_a 1 +least____a_a 1 +greatest_a_a 1 +___________b 1 +case_______b 1 +case_____b_b 1 +coalesce___b 1 +coalesce_b_b 1 +if_______b_b 1 +ifnull___b_b 1 +least____b_b 1 +greatest_b_b 1 +___________a -2147483648 +case_______a -2147483648 +case_____a_a -2147483648 +coalesce___a -2147483648 +coalesce_a_a -2147483648 +if_______a_a -2147483648 +ifnull___a_a -2147483648 +least____a_a -2147483648 +greatest_a_a -2147483648 +___________b 2147483647 +case_______b 2147483647 +case_____b_b 2147483647 +coalesce___b 2147483647 +coalesce_b_b 2147483647 +if_______b_b 2147483647 +ifnull___b_b 2147483647 +least____b_b 2147483647 +greatest_b_b 2147483647 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 3 11 11 Y 32896 0 63 +def case_____b_a 3 11 10 Y 32896 0 63 +def coalesce_a_b 3 11 11 Y 32896 0 63 +def coalesce_b_a 3 11 10 Y 32896 0 63 +def if_______a_b 3 11 10 Y 32896 0 63 +def if_______b_a 3 11 11 Y 32896 0 63 +def ifnull___a_b 3 11 11 Y 32896 0 63 +def ifnull___b_a 3 11 10 Y 32896 0 63 +def least____a_b 3 11 11 Y 32896 0 63 +def least____b_a 3 11 11 Y 32896 0 63 +def greatest_a_b 3 11 10 Y 32896 0 63 +def greatest_b_a 3 11 10 Y 32896 0 63 +case_____a_b 1 +case_____b_a 1 +coalesce_a_b 1 +coalesce_b_a 1 +if_______a_b 1 +if_______b_a 1 +ifnull___a_b 1 +ifnull___b_a 1 +least____a_b 1 +least____b_a 1 +greatest_a_b 1 +greatest_b_a 1 +case_____a_b -2147483648 +case_____b_a 2147483647 +coalesce_a_b -2147483648 +coalesce_b_a 2147483647 +if_______a_b 2147483647 +if_______b_a -2147483648 +ifnull___a_b -2147483648 +ifnull___b_a 2147483647 +least____a_b -2147483648 +least____b_a -2147483648 +greatest_a_b 2147483647 +greatest_b_a 2147483647 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` int(11) DEFAULT NULL, + `case_______a` int(11) DEFAULT NULL, + `case_____a_a` int(11) DEFAULT NULL, + `coalesce___a` int(11) DEFAULT NULL, + `coalesce_a_a` int(11) DEFAULT NULL, + `if_______a_a` int(11) DEFAULT NULL, + `ifnull___a_a` int(11) DEFAULT NULL, + `least____a_a` int(11) DEFAULT NULL, + `greatest_a_a` int(11) DEFAULT NULL, + `___________b` int(11) DEFAULT NULL, + `case_______b` int(11) DEFAULT NULL, + `case_____b_b` int(11) DEFAULT NULL, + `coalesce___b` int(11) DEFAULT NULL, + `coalesce_b_b` int(11) DEFAULT NULL, + `if_______b_b` int(11) DEFAULT NULL, + `ifnull___b_b` int(11) DEFAULT NULL, + `least____b_b` int(11) DEFAULT NULL, + `greatest_b_b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` int(11) DEFAULT NULL, + `case_____b_a` int(11) DEFAULT NULL, + `coalesce_a_b` int(11) DEFAULT NULL, + `coalesce_b_a` int(11) DEFAULT NULL, + `if_______a_b` int(11) DEFAULT NULL, + `if_______b_a` int(11) DEFAULT NULL, + `ifnull___a_b` int(11) DEFAULT NULL, + `ifnull___b_a` int(11) DEFAULT NULL, + `least____a_b` int(11) DEFAULT NULL, + `least____b_a` int(11) DEFAULT NULL, + `greatest_a_b` int(11) DEFAULT NULL, + `greatest_b_a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +CREATE TABLE t1 (a BIGINT, b BIGINT UNSIGNED); +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (-9223372036854775808,0xFFFFFFFFFFFFFFFF); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 8 20 20 Y 32768 0 63 +def case_______a 8 20 20 Y 32896 0 63 +def case_____a_a 8 20 20 Y 32896 0 63 +def coalesce___a 8 20 20 Y 32896 0 63 +def coalesce_a_a 8 20 20 Y 32896 0 63 +def if_______a_a 8 20 20 Y 32896 0 63 +def ifnull___a_a 8 20 20 Y 32896 0 63 +def least____a_a 8 20 20 Y 32896 0 63 +def greatest_a_a 8 20 20 Y 32896 0 63 +def test t1 t1 b ___________b 8 20 20 Y 32800 0 63 +def case_______b 8 20 20 Y 32928 0 63 +def case_____b_b 8 20 20 Y 32928 0 63 +def coalesce___b 8 20 20 Y 32928 0 63 +def coalesce_b_b 8 20 20 Y 32928 0 63 +def if_______b_b 8 20 20 Y 32928 0 63 +def ifnull___b_b 8 20 20 Y 32928 0 63 +def least____b_b 8 20 20 Y 32928 0 63 +def greatest_b_b 8 20 20 Y 32928 0 63 +___________a 1 +case_______a 1 +case_____a_a 1 +coalesce___a 1 +coalesce_a_a 1 +if_______a_a 1 +ifnull___a_a 1 +least____a_a 1 +greatest_a_a 1 +___________b 1 +case_______b 1 +case_____b_b 1 +coalesce___b 1 +coalesce_b_b 1 +if_______b_b 1 +ifnull___b_b 1 +least____b_b 1 +greatest_b_b 1 +___________a -9223372036854775808 +case_______a -9223372036854775808 +case_____a_a -9223372036854775808 +coalesce___a -9223372036854775808 +coalesce_a_a -9223372036854775808 +if_______a_a -9223372036854775808 +ifnull___a_a -9223372036854775808 +least____a_a -9223372036854775808 +greatest_a_a -9223372036854775808 +___________b 18446744073709551615 +case_______b 18446744073709551615 +case_____b_b 18446744073709551615 +coalesce___b 18446744073709551615 +coalesce_b_b 18446744073709551615 +if_______b_b 18446744073709551615 +ifnull___b_b 18446744073709551615 +least____b_b 18446744073709551615 +greatest_b_b 18446744073709551615 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 246 21 20 Y 32896 0 63 +def case_____b_a 246 21 20 Y 32896 0 63 +def coalesce_a_b 246 21 20 Y 32896 0 63 +def coalesce_b_a 246 21 20 Y 32896 0 63 +def if_______a_b 246 21 20 Y 32896 0 63 +def if_______b_a 246 21 20 Y 32896 0 63 +def ifnull___a_b 246 21 20 Y 32896 0 63 +def ifnull___b_a 246 21 20 Y 32896 0 63 +def least____a_b 246 21 20 Y 32896 0 63 +def least____b_a 246 21 20 Y 32896 0 63 +def greatest_a_b 246 21 20 Y 32896 0 63 +def greatest_b_a 246 21 20 Y 32896 0 63 +case_____a_b 1 +case_____b_a 1 +coalesce_a_b 1 +coalesce_b_a 1 +if_______a_b 1 +if_______b_a 1 +ifnull___a_b 1 +ifnull___b_a 1 +least____a_b 1 +least____b_a 1 +greatest_a_b 1 +greatest_b_a 1 +case_____a_b -9223372036854775808 +case_____b_a 18446744073709551615 +coalesce_a_b -9223372036854775808 +coalesce_b_a 18446744073709551615 +if_______a_b 18446744073709551615 +if_______b_a -9223372036854775808 +ifnull___a_b -9223372036854775808 +ifnull___b_a 18446744073709551615 +least____a_b -9223372036854775808 +least____b_a -9223372036854775808 +greatest_a_b 18446744073709551615 +greatest_b_a 18446744073709551615 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` bigint(20) DEFAULT NULL, + `case_______a` bigint(20) DEFAULT NULL, + `case_____a_a` bigint(20) DEFAULT NULL, + `coalesce___a` bigint(20) DEFAULT NULL, + `coalesce_a_a` bigint(20) DEFAULT NULL, + `if_______a_a` bigint(20) DEFAULT NULL, + `ifnull___a_a` bigint(20) DEFAULT NULL, + `least____a_a` bigint(20) DEFAULT NULL, + `greatest_a_a` bigint(20) DEFAULT NULL, + `___________b` bigint(20) unsigned DEFAULT NULL, + `case_______b` bigint(20) unsigned DEFAULT NULL, + `case_____b_b` bigint(20) unsigned DEFAULT NULL, + `coalesce___b` bigint(20) unsigned DEFAULT NULL, + `coalesce_b_b` bigint(20) unsigned DEFAULT NULL, + `if_______b_b` bigint(20) unsigned DEFAULT NULL, + `ifnull___b_b` bigint(20) unsigned DEFAULT NULL, + `least____b_b` bigint(20) unsigned DEFAULT NULL, + `greatest_b_b` bigint(20) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` decimal(20,0) DEFAULT NULL, + `case_____b_a` decimal(20,0) DEFAULT NULL, + `coalesce_a_b` decimal(20,0) DEFAULT NULL, + `coalesce_b_a` decimal(20,0) DEFAULT NULL, + `if_______a_b` decimal(20,0) DEFAULT NULL, + `if_______b_a` decimal(20,0) DEFAULT NULL, + `ifnull___a_b` decimal(20,0) DEFAULT NULL, + `ifnull___b_a` decimal(20,0) DEFAULT NULL, + `least____a_b` decimal(20,0) DEFAULT NULL, + `least____b_a` decimal(20,0) DEFAULT NULL, + `greatest_a_b` decimal(20,0) DEFAULT NULL, + `greatest_b_a` decimal(20,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +CREATE TABLE t1 (a BIGINT, b BIGINT); +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (-9223372036854775808,9223372036854775807); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 8 20 20 Y 32768 0 63 +def case_______a 8 20 20 Y 32896 0 63 +def case_____a_a 8 20 20 Y 32896 0 63 +def coalesce___a 8 20 20 Y 32896 0 63 +def coalesce_a_a 8 20 20 Y 32896 0 63 +def if_______a_a 8 20 20 Y 32896 0 63 +def ifnull___a_a 8 20 20 Y 32896 0 63 +def least____a_a 8 20 20 Y 32896 0 63 +def greatest_a_a 8 20 20 Y 32896 0 63 +def test t1 t1 b ___________b 8 20 19 Y 32768 0 63 +def case_______b 8 20 19 Y 32896 0 63 +def case_____b_b 8 20 19 Y 32896 0 63 +def coalesce___b 8 20 19 Y 32896 0 63 +def coalesce_b_b 8 20 19 Y 32896 0 63 +def if_______b_b 8 20 19 Y 32896 0 63 +def ifnull___b_b 8 20 19 Y 32896 0 63 +def least____b_b 8 20 19 Y 32896 0 63 +def greatest_b_b 8 20 19 Y 32896 0 63 +___________a 1 +case_______a 1 +case_____a_a 1 +coalesce___a 1 +coalesce_a_a 1 +if_______a_a 1 +ifnull___a_a 1 +least____a_a 1 +greatest_a_a 1 +___________b 1 +case_______b 1 +case_____b_b 1 +coalesce___b 1 +coalesce_b_b 1 +if_______b_b 1 +ifnull___b_b 1 +least____b_b 1 +greatest_b_b 1 +___________a -9223372036854775808 +case_______a -9223372036854775808 +case_____a_a -9223372036854775808 +coalesce___a -9223372036854775808 +coalesce_a_a -9223372036854775808 +if_______a_a -9223372036854775808 +ifnull___a_a -9223372036854775808 +least____a_a -9223372036854775808 +greatest_a_a -9223372036854775808 +___________b 9223372036854775807 +case_______b 9223372036854775807 +case_____b_b 9223372036854775807 +coalesce___b 9223372036854775807 +coalesce_b_b 9223372036854775807 +if_______b_b 9223372036854775807 +ifnull___b_b 9223372036854775807 +least____b_b 9223372036854775807 +greatest_b_b 9223372036854775807 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 8 20 20 Y 32896 0 63 +def case_____b_a 8 20 19 Y 32896 0 63 +def coalesce_a_b 8 20 20 Y 32896 0 63 +def coalesce_b_a 8 20 19 Y 32896 0 63 +def if_______a_b 8 20 19 Y 32896 0 63 +def if_______b_a 8 20 20 Y 32896 0 63 +def ifnull___a_b 8 20 20 Y 32896 0 63 +def ifnull___b_a 8 20 19 Y 32896 0 63 +def least____a_b 8 20 20 Y 32896 0 63 +def least____b_a 8 20 20 Y 32896 0 63 +def greatest_a_b 8 20 19 Y 32896 0 63 +def greatest_b_a 8 20 19 Y 32896 0 63 +case_____a_b 1 +case_____b_a 1 +coalesce_a_b 1 +coalesce_b_a 1 +if_______a_b 1 +if_______b_a 1 +ifnull___a_b 1 +ifnull___b_a 1 +least____a_b 1 +least____b_a 1 +greatest_a_b 1 +greatest_b_a 1 +case_____a_b -9223372036854775808 +case_____b_a 9223372036854775807 +coalesce_a_b -9223372036854775808 +coalesce_b_a 9223372036854775807 +if_______a_b 9223372036854775807 +if_______b_a -9223372036854775808 +ifnull___a_b -9223372036854775808 +ifnull___b_a 9223372036854775807 +least____a_b -9223372036854775808 +least____b_a -9223372036854775808 +greatest_a_b 9223372036854775807 +greatest_b_a 9223372036854775807 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` bigint(20) DEFAULT NULL, + `case_______a` bigint(20) DEFAULT NULL, + `case_____a_a` bigint(20) DEFAULT NULL, + `coalesce___a` bigint(20) DEFAULT NULL, + `coalesce_a_a` bigint(20) DEFAULT NULL, + `if_______a_a` bigint(20) DEFAULT NULL, + `ifnull___a_a` bigint(20) DEFAULT NULL, + `least____a_a` bigint(20) DEFAULT NULL, + `greatest_a_a` bigint(20) DEFAULT NULL, + `___________b` bigint(20) DEFAULT NULL, + `case_______b` bigint(20) DEFAULT NULL, + `case_____b_b` bigint(20) DEFAULT NULL, + `coalesce___b` bigint(20) DEFAULT NULL, + `coalesce_b_b` bigint(20) DEFAULT NULL, + `if_______b_b` bigint(20) DEFAULT NULL, + `ifnull___b_b` bigint(20) DEFAULT NULL, + `least____b_b` bigint(20) DEFAULT NULL, + `greatest_b_b` bigint(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` bigint(20) DEFAULT NULL, + `case_____b_a` bigint(20) DEFAULT NULL, + `coalesce_a_b` bigint(20) DEFAULT NULL, + `coalesce_b_a` bigint(20) DEFAULT NULL, + `if_______a_b` bigint(20) DEFAULT NULL, + `if_______b_a` bigint(20) DEFAULT NULL, + `ifnull___a_b` bigint(20) DEFAULT NULL, + `ifnull___b_a` bigint(20) DEFAULT NULL, + `least____a_b` bigint(20) DEFAULT NULL, + `least____b_a` bigint(20) DEFAULT NULL, + `greatest_a_b` bigint(20) DEFAULT NULL, + `greatest_b_a` bigint(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +CREATE TABLE t1 (a INT, b BIT(8)); +INSERT INTO t1 VALUES (-2147483648,0x32); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 3 11 11 Y 32768 0 63 +def case_______a 3 11 11 Y 32896 0 63 +def case_____a_a 3 11 11 Y 32896 0 63 +def coalesce___a 3 11 11 Y 32896 0 63 +def coalesce_a_a 3 11 11 Y 32896 0 63 +def if_______a_a 3 11 11 Y 32896 0 63 +def ifnull___a_a 3 11 11 Y 32896 0 63 +def least____a_a 3 11 11 Y 32896 0 63 +def greatest_a_a 3 11 11 Y 32896 0 63 +def test t1 t1 b ___________b 16 8 1 Y 32 0 63 +def case_______b 16 8 2 Y 160 0 63 +def case_____b_b 16 8 2 Y 160 0 63 +def coalesce___b 16 8 2 Y 160 0 63 +def coalesce_b_b 16 8 2 Y 160 0 63 +def if_______b_b 16 8 2 Y 160 0 63 +def ifnull___b_b 16 8 2 Y 160 0 63 +def least____b_b 16 8 2 Y 160 0 63 +def greatest_b_b 16 8 2 Y 160 0 63 +___________a -2147483648 +case_______a -2147483648 +case_____a_a -2147483648 +coalesce___a -2147483648 +coalesce_a_a -2147483648 +if_______a_a -2147483648 +ifnull___a_a -2147483648 +least____a_a -2147483648 +greatest_a_a -2147483648 +___________b 2 +case_______b 50 +case_____b_b 50 +coalesce___b 50 +coalesce_b_b 50 +if_______b_b 50 +ifnull___b_b 50 +least____b_b 50 +greatest_b_b 50 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 246 11 11 Y 32896 0 63 +def case_____b_a 246 11 2 Y 32896 0 63 +def coalesce_a_b 246 11 11 Y 32896 0 63 +def coalesce_b_a 246 11 2 Y 32896 0 63 +def if_______a_b 246 11 2 Y 32896 0 63 +def if_______b_a 246 11 11 Y 32896 0 63 +def ifnull___a_b 246 11 11 Y 32896 0 63 +def ifnull___b_a 246 11 2 Y 32896 0 63 +def least____a_b 246 11 11 Y 32896 0 63 +def least____b_a 246 11 11 Y 32896 0 63 +def greatest_a_b 246 11 2 Y 32896 0 63 +def greatest_b_a 246 11 2 Y 32896 0 63 +case_____a_b -2147483648 +case_____b_a 50 +coalesce_a_b -2147483648 +coalesce_b_a 50 +if_______a_b 50 +if_______b_a -2147483648 +ifnull___a_b -2147483648 +ifnull___b_a 50 +least____a_b -2147483648 +least____b_a -2147483648 +greatest_a_b 50 +greatest_b_a 50 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` int(11) DEFAULT NULL, + `case_______a` int(11) DEFAULT NULL, + `case_____a_a` int(11) DEFAULT NULL, + `coalesce___a` int(11) DEFAULT NULL, + `coalesce_a_a` int(11) DEFAULT NULL, + `if_______a_a` int(11) DEFAULT NULL, + `ifnull___a_a` int(11) DEFAULT NULL, + `least____a_a` int(11) DEFAULT NULL, + `greatest_a_a` int(11) DEFAULT NULL, + `___________b` bit(8) DEFAULT NULL, + `case_______b` int(8) unsigned DEFAULT NULL, + `case_____b_b` int(8) unsigned DEFAULT NULL, + `coalesce___b` int(8) unsigned DEFAULT NULL, + `coalesce_b_b` int(8) unsigned DEFAULT NULL, + `if_______b_b` int(8) unsigned DEFAULT NULL, + `ifnull___b_b` bit(8) DEFAULT NULL, + `least____b_b` int(8) unsigned DEFAULT NULL, + `greatest_b_b` int(8) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` decimal(10,0) DEFAULT NULL, + `case_____b_a` decimal(10,0) DEFAULT NULL, + `coalesce_a_b` decimal(10,0) DEFAULT NULL, + `coalesce_b_a` decimal(10,0) DEFAULT NULL, + `if_______a_b` decimal(10,0) DEFAULT NULL, + `if_______b_a` decimal(10,0) DEFAULT NULL, + `ifnull___a_b` decimal(10,0) DEFAULT NULL, + `ifnull___b_a` decimal(10,0) DEFAULT NULL, + `least____a_b` decimal(10,0) DEFAULT NULL, + `least____b_a` decimal(10,0) DEFAULT NULL, + `greatest_a_b` decimal(10,0) DEFAULT NULL, + `greatest_b_a` decimal(10,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +CREATE TABLE t1 (a INT UNSIGNED, b BIT(8)); +INSERT INTO t1 VALUES (4294967295,0x32); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 3 10 10 Y 32800 0 63 +def case_______a 3 10 10 Y 32928 0 63 +def case_____a_a 3 10 10 Y 32928 0 63 +def coalesce___a 3 10 10 Y 32928 0 63 +def coalesce_a_a 3 10 10 Y 32928 0 63 +def if_______a_a 3 10 10 Y 32928 0 63 +def ifnull___a_a 3 10 10 Y 32928 0 63 +def least____a_a 3 10 10 Y 32928 0 63 +def greatest_a_a 3 10 10 Y 32928 0 63 +def test t1 t1 b ___________b 16 8 1 Y 32 0 63 +def case_______b 16 8 2 Y 160 0 63 +def case_____b_b 16 8 2 Y 160 0 63 +def coalesce___b 16 8 2 Y 160 0 63 +def coalesce_b_b 16 8 2 Y 160 0 63 +def if_______b_b 16 8 2 Y 160 0 63 +def ifnull___b_b 16 8 2 Y 160 0 63 +def least____b_b 16 8 2 Y 160 0 63 +def greatest_b_b 16 8 2 Y 160 0 63 +___________a 4294967295 +case_______a 4294967295 +case_____a_a 4294967295 +coalesce___a 4294967295 +coalesce_a_a 4294967295 +if_______a_a 4294967295 +ifnull___a_a 4294967295 +least____a_a 4294967295 +greatest_a_a 4294967295 +___________b 2 +case_______b 50 +case_____b_b 50 +coalesce___b 50 +coalesce_b_b 50 +if_______b_b 50 +ifnull___b_b 50 +least____b_b 50 +greatest_b_b 50 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 8 10 10 Y 32928 0 63 +def case_____b_a 8 10 2 Y 32928 0 63 +def coalesce_a_b 8 10 10 Y 32928 0 63 +def coalesce_b_a 8 10 2 Y 32928 0 63 +def if_______a_b 8 10 2 Y 32928 0 63 +def if_______b_a 8 10 10 Y 32928 0 63 +def ifnull___a_b 8 10 10 Y 32928 0 63 +def ifnull___b_a 8 10 2 Y 32928 0 63 +def least____a_b 8 10 2 Y 32928 0 63 +def least____b_a 8 10 2 Y 32928 0 63 +def greatest_a_b 8 10 10 Y 32928 0 63 +def greatest_b_a 8 10 10 Y 32928 0 63 +case_____a_b 4294967295 +case_____b_a 50 +coalesce_a_b 4294967295 +coalesce_b_a 50 +if_______a_b 50 +if_______b_a 4294967295 +ifnull___a_b 4294967295 +ifnull___b_a 50 +least____a_b 50 +least____b_a 50 +greatest_a_b 4294967295 +greatest_b_a 4294967295 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` int(10) unsigned DEFAULT NULL, + `case_______a` int(10) unsigned DEFAULT NULL, + `case_____a_a` int(10) unsigned DEFAULT NULL, + `coalesce___a` int(10) unsigned DEFAULT NULL, + `coalesce_a_a` int(10) unsigned DEFAULT NULL, + `if_______a_a` int(10) unsigned DEFAULT NULL, + `ifnull___a_a` int(10) unsigned DEFAULT NULL, + `least____a_a` int(10) unsigned DEFAULT NULL, + `greatest_a_a` int(10) unsigned DEFAULT NULL, + `___________b` bit(8) DEFAULT NULL, + `case_______b` int(8) unsigned DEFAULT NULL, + `case_____b_b` int(8) unsigned DEFAULT NULL, + `coalesce___b` int(8) unsigned DEFAULT NULL, + `coalesce_b_b` int(8) unsigned DEFAULT NULL, + `if_______b_b` int(8) unsigned DEFAULT NULL, + `ifnull___b_b` bit(8) DEFAULT NULL, + `least____b_b` int(8) unsigned DEFAULT NULL, + `greatest_b_b` int(8) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` int(10) unsigned DEFAULT NULL, + `case_____b_a` int(10) unsigned DEFAULT NULL, + `coalesce_a_b` int(10) unsigned DEFAULT NULL, + `coalesce_b_a` int(10) unsigned DEFAULT NULL, + `if_______a_b` int(10) unsigned DEFAULT NULL, + `if_______b_a` int(10) unsigned DEFAULT NULL, + `ifnull___a_b` bigint(10) unsigned DEFAULT NULL, + `ifnull___b_a` bigint(10) unsigned DEFAULT NULL, + `least____a_b` int(10) unsigned DEFAULT NULL, + `least____b_a` int(10) unsigned DEFAULT NULL, + `greatest_a_b` int(10) unsigned DEFAULT NULL, + `greatest_b_a` int(10) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +CREATE TABLE t1 (a BIT(7), b BIT(8)); +INSERT INTO t1 VALUES (0x32,0x32); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 16 7 1 Y 32 0 63 +def case_______a 16 7 2 Y 160 0 63 +def case_____a_a 16 7 2 Y 160 0 63 +def coalesce___a 16 7 2 Y 160 0 63 +def coalesce_a_a 16 7 2 Y 160 0 63 +def if_______a_a 16 7 2 Y 160 0 63 +def ifnull___a_a 16 7 2 Y 160 0 63 +def least____a_a 16 7 2 Y 160 0 63 +def greatest_a_a 16 7 2 Y 160 0 63 +def test t1 t1 b ___________b 16 8 1 Y 32 0 63 +def case_______b 16 8 2 Y 160 0 63 +def case_____b_b 16 8 2 Y 160 0 63 +def coalesce___b 16 8 2 Y 160 0 63 +def coalesce_b_b 16 8 2 Y 160 0 63 +def if_______b_b 16 8 2 Y 160 0 63 +def ifnull___b_b 16 8 2 Y 160 0 63 +def least____b_b 16 8 2 Y 160 0 63 +def greatest_b_b 16 8 2 Y 160 0 63 +___________a 2 +case_______a 50 +case_____a_a 50 +coalesce___a 50 +coalesce_a_a 50 +if_______a_a 50 +ifnull___a_a 50 +least____a_a 50 +greatest_a_a 50 +___________b 2 +case_______b 50 +case_____b_b 50 +coalesce___b 50 +coalesce_b_b 50 +if_______b_b 50 +ifnull___b_b 50 +least____b_b 50 +greatest_b_b 50 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 16 8 2 Y 160 0 63 +def case_____b_a 16 8 2 Y 160 0 63 +def coalesce_a_b 16 8 2 Y 160 0 63 +def coalesce_b_a 16 8 2 Y 160 0 63 +def if_______a_b 16 8 2 Y 160 0 63 +def if_______b_a 16 8 2 Y 160 0 63 +def ifnull___a_b 16 8 2 Y 160 0 63 +def ifnull___b_a 16 8 2 Y 160 0 63 +def least____a_b 16 8 2 Y 160 0 63 +def least____b_a 16 8 2 Y 160 0 63 +def greatest_a_b 16 8 2 Y 160 0 63 +def greatest_b_a 16 8 2 Y 160 0 63 +case_____a_b 50 +case_____b_a 50 +coalesce_a_b 50 +coalesce_b_a 50 +if_______a_b 50 +if_______b_a 50 +ifnull___a_b 50 +ifnull___b_a 50 +least____a_b 50 +least____b_a 50 +greatest_a_b 50 +greatest_b_a 50 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` bit(7) DEFAULT NULL, + `case_______a` int(7) unsigned DEFAULT NULL, + `case_____a_a` int(7) unsigned DEFAULT NULL, + `coalesce___a` int(7) unsigned DEFAULT NULL, + `coalesce_a_a` int(7) unsigned DEFAULT NULL, + `if_______a_a` int(7) unsigned DEFAULT NULL, + `ifnull___a_a` bit(7) DEFAULT NULL, + `least____a_a` int(7) unsigned DEFAULT NULL, + `greatest_a_a` int(7) unsigned DEFAULT NULL, + `___________b` bit(8) DEFAULT NULL, + `case_______b` int(8) unsigned DEFAULT NULL, + `case_____b_b` int(8) unsigned DEFAULT NULL, + `coalesce___b` int(8) unsigned DEFAULT NULL, + `coalesce_b_b` int(8) unsigned DEFAULT NULL, + `if_______b_b` int(8) unsigned DEFAULT NULL, + `ifnull___b_b` bit(8) DEFAULT NULL, + `least____b_b` int(8) unsigned DEFAULT NULL, + `greatest_b_b` int(8) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` int(8) unsigned DEFAULT NULL, + `case_____b_a` int(8) unsigned DEFAULT NULL, + `coalesce_a_b` int(8) unsigned DEFAULT NULL, + `coalesce_b_a` int(8) unsigned DEFAULT NULL, + `if_______a_b` int(8) unsigned DEFAULT NULL, + `if_______b_a` int(8) unsigned DEFAULT NULL, + `ifnull___a_b` bit(8) DEFAULT NULL, + `ifnull___b_a` bit(8) DEFAULT NULL, + `least____a_b` int(8) unsigned DEFAULT NULL, + `least____b_a` int(8) unsigned DEFAULT NULL, + `greatest_a_b` int(8) unsigned DEFAULT NULL, + `greatest_b_a` int(8) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +CREATE TABLE t1 (a FLOAT, b SMALLINT); +INSERT INTO t1 VALUES (1,-32678); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 4 12 1 Y 32768 31 63 +def case_______a 4 12 1 Y 32896 31 63 +def case_____a_a 4 12 1 Y 32896 31 63 +def coalesce___a 4 12 1 Y 32896 31 63 +def coalesce_a_a 4 12 1 Y 32896 31 63 +def if_______a_a 4 12 1 Y 32896 31 63 +def ifnull___a_a 4 12 1 Y 32896 31 63 +def least____a_a 5 23 1 Y 32896 31 63 +def greatest_a_a 5 23 1 Y 32896 31 63 +def test t1 t1 b ___________b 2 6 6 Y 32768 0 63 +def case_______b 2 6 6 Y 32896 0 63 +def case_____b_b 2 6 6 Y 32896 0 63 +def coalesce___b 2 6 6 Y 32896 0 63 +def coalesce_b_b 2 6 6 Y 32896 0 63 +def if_______b_b 2 6 6 Y 32896 0 63 +def ifnull___b_b 2 6 6 Y 32896 0 63 +def least____b_b 2 6 6 Y 32896 0 63 +def greatest_b_b 2 6 6 Y 32896 0 63 +___________a 1 +case_______a 1 +case_____a_a 1 +coalesce___a 1 +coalesce_a_a 1 +if_______a_a 1 +ifnull___a_a 1 +least____a_a 1 +greatest_a_a 1 +___________b -32678 +case_______b -32678 +case_____b_b -32678 +coalesce___b -32678 +coalesce_b_b -32678 +if_______b_b -32678 +ifnull___b_b -32678 +least____b_b -32678 +greatest_b_b -32678 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 4 12 1 Y 32896 31 63 +def case_____b_a 4 12 6 Y 32896 31 63 +def coalesce_a_b 4 12 1 Y 32896 31 63 +def coalesce_b_a 4 12 6 Y 32896 31 63 +def if_______a_b 4 12 6 Y 32896 31 63 +def if_______b_a 4 12 1 Y 32896 31 63 +def ifnull___a_b 4 12 1 Y 32896 31 63 +def ifnull___b_a 4 12 6 Y 32896 31 63 +def least____a_b 5 23 6 Y 32896 31 63 +def least____b_a 5 23 6 Y 32896 31 63 +def greatest_a_b 5 23 1 Y 32896 31 63 +def greatest_b_a 5 23 1 Y 32896 31 63 +case_____a_b 1 +case_____b_a -32678 +coalesce_a_b 1 +coalesce_b_a -32678 +if_______a_b -32678 +if_______b_a 1 +ifnull___a_b 1 +ifnull___b_a -32678 +least____a_b -32678 +least____b_a -32678 +greatest_a_b 1 +greatest_b_a 1 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` float DEFAULT NULL, + `case_______a` double DEFAULT NULL, + `case_____a_a` double DEFAULT NULL, + `coalesce___a` double DEFAULT NULL, + `coalesce_a_a` double DEFAULT NULL, + `if_______a_a` double DEFAULT NULL, + `ifnull___a_a` float DEFAULT NULL, + `least____a_a` double DEFAULT NULL, + `greatest_a_a` double DEFAULT NULL, + `___________b` smallint(6) DEFAULT NULL, + `case_______b` int(6) DEFAULT NULL, + `case_____b_b` int(6) DEFAULT NULL, + `coalesce___b` int(6) DEFAULT NULL, + `coalesce_b_b` int(6) DEFAULT NULL, + `if_______b_b` int(6) DEFAULT NULL, + `ifnull___b_b` smallint(6) DEFAULT NULL, + `least____b_b` int(6) DEFAULT NULL, + `greatest_b_b` int(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` double DEFAULT NULL, + `case_____b_a` double DEFAULT NULL, + `coalesce_a_b` double DEFAULT NULL, + `coalesce_b_a` double DEFAULT NULL, + `if_______a_b` double DEFAULT NULL, + `if_______b_a` double DEFAULT NULL, + `ifnull___a_b` float DEFAULT NULL, + `ifnull___b_a` float DEFAULT NULL, + `least____a_b` double DEFAULT NULL, + `least____b_a` double DEFAULT NULL, + `greatest_a_b` double DEFAULT NULL, + `greatest_b_a` double DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +CREATE TABLE t1 (a VARCHAR(10), b ENUM('b')); +INSERT INTO t1 VALUES ('a','b'); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 253 10 1 Y 0 0 8 +def case_______a 253 10 1 Y 0 31 8 +def case_____a_a 253 10 1 Y 0 31 8 +def coalesce___a 253 10 1 Y 0 31 8 +def coalesce_a_a 253 10 1 Y 0 31 8 +def if_______a_a 253 10 1 Y 0 31 8 +def ifnull___a_a 253 10 1 Y 0 31 8 +def least____a_a 253 10 1 Y 0 31 8 +def greatest_a_a 253 10 1 Y 0 31 8 +def test t1 t1 b ___________b 254 1 1 Y 256 0 8 +def case_______b 254 1 1 Y 0 31 8 +def case_____b_b 254 1 1 Y 0 31 8 +def coalesce___b 254 1 1 Y 0 31 8 +def coalesce_b_b 254 1 1 Y 0 31 8 +def if_______b_b 254 1 1 Y 0 31 8 +def ifnull___b_b 254 1 1 Y 0 31 8 +def least____b_b 254 1 1 Y 0 0 8 +def greatest_b_b 254 1 1 Y 0 0 8 +___________a a +case_______a a +case_____a_a a +coalesce___a a +coalesce_a_a a +if_______a_a a +ifnull___a_a a +least____a_a a +greatest_a_a a +___________b b +case_______b b +case_____b_b b +coalesce___b b +coalesce_b_b b +if_______b_b b +ifnull___b_b b +least____b_b b +greatest_b_b b +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 253 10 1 Y 0 31 8 +def case_____b_a 253 10 1 Y 0 31 8 +def coalesce_a_b 253 10 1 Y 0 31 8 +def coalesce_b_a 253 10 1 Y 0 31 8 +def if_______a_b 253 10 1 Y 0 31 8 +def if_______b_a 253 10 1 Y 0 31 8 +def ifnull___a_b 253 10 1 Y 0 31 8 +def ifnull___b_a 253 10 1 Y 0 31 8 +def least____a_b 253 10 1 Y 0 31 8 +def least____b_a 253 10 1 Y 0 31 8 +def greatest_a_b 253 10 1 Y 0 31 8 +def greatest_b_a 253 10 1 Y 0 31 8 +case_____a_b a +case_____b_a b +coalesce_a_b a +coalesce_b_a b +if_______a_b b +if_______b_a a +ifnull___a_b a +ifnull___b_a b +least____a_b a +least____b_a a +greatest_a_b b +greatest_b_a b +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` varchar(10) DEFAULT NULL, + `case_______a` varchar(10) DEFAULT NULL, + `case_____a_a` varchar(10) DEFAULT NULL, + `coalesce___a` varchar(10) DEFAULT NULL, + `coalesce_a_a` varchar(10) DEFAULT NULL, + `if_______a_a` varchar(10) DEFAULT NULL, + `ifnull___a_a` varchar(10) DEFAULT NULL, + `least____a_a` varchar(10) DEFAULT NULL, + `greatest_a_a` varchar(10) DEFAULT NULL, + `___________b` enum('b') DEFAULT NULL, + `case_______b` varchar(1) DEFAULT NULL, + `case_____b_b` varchar(1) DEFAULT NULL, + `coalesce___b` varchar(1) DEFAULT NULL, + `coalesce_b_b` varchar(1) DEFAULT NULL, + `if_______b_b` varchar(1) DEFAULT NULL, + `ifnull___b_b` varchar(1) DEFAULT NULL, + `least____b_b` varchar(1) DEFAULT NULL, + `greatest_b_b` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` varchar(10) DEFAULT NULL, + `case_____b_a` varchar(10) DEFAULT NULL, + `coalesce_a_b` varchar(10) DEFAULT NULL, + `coalesce_b_a` varchar(10) DEFAULT NULL, + `if_______a_b` varchar(10) DEFAULT NULL, + `if_______b_a` varchar(10) DEFAULT NULL, + `ifnull___a_b` varchar(10) DEFAULT NULL, + `ifnull___b_a` varchar(10) DEFAULT NULL, + `least____a_b` varchar(10) DEFAULT NULL, + `least____b_a` varchar(10) DEFAULT NULL, + `greatest_a_b` varchar(10) DEFAULT NULL, + `greatest_b_a` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +CREATE TABLE t1 (a INT, b YEAR); +INSERT INTO t1 VALUES (-2147483648,2015); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 3 11 11 Y 32768 0 63 +def case_______a 3 11 11 Y 32896 0 63 +def case_____a_a 3 11 11 Y 32896 0 63 +def coalesce___a 3 11 11 Y 32896 0 63 +def coalesce_a_a 3 11 11 Y 32896 0 63 +def if_______a_a 3 11 11 Y 32896 0 63 +def ifnull___a_a 3 11 11 Y 32896 0 63 +def least____a_a 3 11 11 Y 32896 0 63 +def greatest_a_a 3 11 11 Y 32896 0 63 +def test t1 t1 b ___________b 13 4 4 Y 32864 0 63 +def case_______b 13 4 4 Y 32928 0 63 +def case_____b_b 13 4 4 Y 32928 0 63 +def coalesce___b 13 4 4 Y 32928 0 63 +def coalesce_b_b 13 4 4 Y 32928 0 63 +def if_______b_b 13 4 4 Y 32928 0 63 +def ifnull___b_b 13 4 4 Y 32928 0 63 +def least____b_b 13 4 4 Y 32928 0 63 +def greatest_b_b 13 4 4 Y 32928 0 63 +___________a -2147483648 +case_______a -2147483648 +case_____a_a -2147483648 +coalesce___a -2147483648 +coalesce_a_a -2147483648 +if_______a_a -2147483648 +ifnull___a_a -2147483648 +least____a_a -2147483648 +greatest_a_a -2147483648 +___________b 2015 +case_______b 2015 +case_____b_b 2015 +coalesce___b 2015 +coalesce_b_b 2015 +if_______b_b 2015 +ifnull___b_b 2015 +least____b_b 2015 +greatest_b_b 2015 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 246 11 11 Y 32896 0 63 +def case_____b_a 246 11 4 Y 32896 0 63 +def coalesce_a_b 246 11 11 Y 32896 0 63 +def coalesce_b_a 246 11 4 Y 32896 0 63 +def if_______a_b 246 11 4 Y 32896 0 63 +def if_______b_a 246 11 11 Y 32896 0 63 +def ifnull___a_b 246 11 11 Y 32896 0 63 +def ifnull___b_a 246 11 4 Y 32896 0 63 +def least____a_b 246 11 11 Y 32896 0 63 +def least____b_a 246 11 11 Y 32896 0 63 +def greatest_a_b 246 11 4 Y 32896 0 63 +def greatest_b_a 246 11 4 Y 32896 0 63 +case_____a_b -2147483648 +case_____b_a 2015 +coalesce_a_b -2147483648 +coalesce_b_a 2015 +if_______a_b 2015 +if_______b_a -2147483648 +ifnull___a_b -2147483648 +ifnull___b_a 2015 +least____a_b -2147483648 +least____b_a -2147483648 +greatest_a_b 2015 +greatest_b_a 2015 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` int(11) DEFAULT NULL, + `case_______a` int(11) DEFAULT NULL, + `case_____a_a` int(11) DEFAULT NULL, + `coalesce___a` int(11) DEFAULT NULL, + `coalesce_a_a` int(11) DEFAULT NULL, + `if_______a_a` int(11) DEFAULT NULL, + `ifnull___a_a` int(11) DEFAULT NULL, + `least____a_a` int(11) DEFAULT NULL, + `greatest_a_a` int(11) DEFAULT NULL, + `___________b` year(4) DEFAULT NULL, + `case_______b` int(4) unsigned DEFAULT NULL, + `case_____b_b` int(4) unsigned DEFAULT NULL, + `coalesce___b` int(4) unsigned DEFAULT NULL, + `coalesce_b_b` int(4) unsigned DEFAULT NULL, + `if_______b_b` int(4) unsigned DEFAULT NULL, + `ifnull___b_b` year(4) DEFAULT NULL, + `least____b_b` int(4) unsigned DEFAULT NULL, + `greatest_b_b` int(4) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` decimal(10,0) DEFAULT NULL, + `case_____b_a` decimal(10,0) DEFAULT NULL, + `coalesce_a_b` decimal(10,0) DEFAULT NULL, + `coalesce_b_a` decimal(10,0) DEFAULT NULL, + `if_______a_b` decimal(10,0) DEFAULT NULL, + `if_______b_a` decimal(10,0) DEFAULT NULL, + `ifnull___a_b` decimal(10,0) DEFAULT NULL, + `ifnull___b_a` decimal(10,0) DEFAULT NULL, + `least____a_b` decimal(10,0) DEFAULT NULL, + `least____b_a` decimal(10,0) DEFAULT NULL, + `greatest_a_b` decimal(10,0) DEFAULT NULL, + `greatest_b_a` decimal(10,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +CREATE TABLE t1 (a INT UNSIGNED, b YEAR); +INSERT INTO t1 VALUES (4294967295,2015); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 3 10 10 Y 32800 0 63 +def case_______a 3 10 10 Y 32928 0 63 +def case_____a_a 3 10 10 Y 32928 0 63 +def coalesce___a 3 10 10 Y 32928 0 63 +def coalesce_a_a 3 10 10 Y 32928 0 63 +def if_______a_a 3 10 10 Y 32928 0 63 +def ifnull___a_a 3 10 10 Y 32928 0 63 +def least____a_a 3 10 10 Y 32928 0 63 +def greatest_a_a 3 10 10 Y 32928 0 63 +def test t1 t1 b ___________b 13 4 4 Y 32864 0 63 +def case_______b 13 4 4 Y 32928 0 63 +def case_____b_b 13 4 4 Y 32928 0 63 +def coalesce___b 13 4 4 Y 32928 0 63 +def coalesce_b_b 13 4 4 Y 32928 0 63 +def if_______b_b 13 4 4 Y 32928 0 63 +def ifnull___b_b 13 4 4 Y 32928 0 63 +def least____b_b 13 4 4 Y 32928 0 63 +def greatest_b_b 13 4 4 Y 32928 0 63 +___________a 4294967295 +case_______a 4294967295 +case_____a_a 4294967295 +coalesce___a 4294967295 +coalesce_a_a 4294967295 +if_______a_a 4294967295 +ifnull___a_a 4294967295 +least____a_a 4294967295 +greatest_a_a 4294967295 +___________b 2015 +case_______b 2015 +case_____b_b 2015 +coalesce___b 2015 +coalesce_b_b 2015 +if_______b_b 2015 +ifnull___b_b 2015 +least____b_b 2015 +greatest_b_b 2015 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 3 10 10 Y 32928 0 63 +def case_____b_a 3 10 4 Y 32928 0 63 +def coalesce_a_b 3 10 10 Y 32928 0 63 +def coalesce_b_a 3 10 4 Y 32928 0 63 +def if_______a_b 3 10 4 Y 32928 0 63 +def if_______b_a 3 10 10 Y 32928 0 63 +def ifnull___a_b 3 10 10 Y 32928 0 63 +def ifnull___b_a 3 10 4 Y 32928 0 63 +def least____a_b 3 10 4 Y 32928 0 63 +def least____b_a 3 10 4 Y 32928 0 63 +def greatest_a_b 3 10 10 Y 32928 0 63 +def greatest_b_a 3 10 10 Y 32928 0 63 +case_____a_b 4294967295 +case_____b_a 2015 +coalesce_a_b 4294967295 +coalesce_b_a 2015 +if_______a_b 2015 +if_______b_a 4294967295 +ifnull___a_b 4294967295 +ifnull___b_a 2015 +least____a_b 2015 +least____b_a 2015 +greatest_a_b 4294967295 +greatest_b_a 4294967295 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` int(10) unsigned DEFAULT NULL, + `case_______a` int(10) unsigned DEFAULT NULL, + `case_____a_a` int(10) unsigned DEFAULT NULL, + `coalesce___a` int(10) unsigned DEFAULT NULL, + `coalesce_a_a` int(10) unsigned DEFAULT NULL, + `if_______a_a` int(10) unsigned DEFAULT NULL, + `ifnull___a_a` int(10) unsigned DEFAULT NULL, + `least____a_a` int(10) unsigned DEFAULT NULL, + `greatest_a_a` int(10) unsigned DEFAULT NULL, + `___________b` year(4) DEFAULT NULL, + `case_______b` int(4) unsigned DEFAULT NULL, + `case_____b_b` int(4) unsigned DEFAULT NULL, + `coalesce___b` int(4) unsigned DEFAULT NULL, + `coalesce_b_b` int(4) unsigned DEFAULT NULL, + `if_______b_b` int(4) unsigned DEFAULT NULL, + `ifnull___b_b` year(4) DEFAULT NULL, + `least____b_b` int(4) unsigned DEFAULT NULL, + `greatest_b_b` int(4) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` int(10) unsigned DEFAULT NULL, + `case_____b_a` int(10) unsigned DEFAULT NULL, + `coalesce_a_b` int(10) unsigned DEFAULT NULL, + `coalesce_b_a` int(10) unsigned DEFAULT NULL, + `if_______a_b` int(10) unsigned DEFAULT NULL, + `if_______b_a` int(10) unsigned DEFAULT NULL, + `ifnull___a_b` int(10) unsigned DEFAULT NULL, + `ifnull___b_a` int(10) unsigned DEFAULT NULL, + `least____a_b` int(10) unsigned DEFAULT NULL, + `least____b_a` int(10) unsigned DEFAULT NULL, + `greatest_a_b` int(10) unsigned DEFAULT NULL, + `greatest_b_a` int(10) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03'); +CREATE TABLE t1 (a DATE, b TIME); +INSERT INTO t1 VALUES ('2010-01-01','10:20:30'); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 10 10 10 Y 128 0 63 +def case_______a 10 10 10 Y 128 0 63 +def case_____a_a 10 10 10 Y 128 0 63 +def coalesce___a 10 10 10 Y 128 0 63 +def coalesce_a_a 10 10 10 Y 128 0 63 +def if_______a_a 10 10 10 Y 128 0 63 +def ifnull___a_a 10 10 10 Y 128 0 63 +def least____a_a 10 10 10 Y 128 0 63 +def greatest_a_a 10 10 10 Y 128 0 63 +def test t1 t1 b ___________b 11 10 8 Y 128 0 63 +def case_______b 11 10 8 Y 128 0 63 +def case_____b_b 11 10 8 Y 128 0 63 +def coalesce___b 11 10 8 Y 128 0 63 +def coalesce_b_b 11 10 8 Y 128 0 63 +def if_______b_b 11 10 8 Y 128 0 63 +def ifnull___b_b 11 10 8 Y 128 0 63 +def least____b_b 11 10 8 Y 128 0 63 +def greatest_b_b 11 10 8 Y 128 0 63 +___________a 2010-01-01 +case_______a 2010-01-01 +case_____a_a 2010-01-01 +coalesce___a 2010-01-01 +coalesce_a_a 2010-01-01 +if_______a_a 2010-01-01 +ifnull___a_a 2010-01-01 +least____a_a 2010-01-01 +greatest_a_a 2010-01-01 +___________b 10:20:30 +case_______b 10:20:30 +case_____b_b 10:20:30 +coalesce___b 10:20:30 +coalesce_b_b 10:20:30 +if_______b_b 10:20:30 +ifnull___b_b 10:20:30 +least____b_b 10:20:30 +greatest_b_b 10:20:30 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 12 19 19 Y 128 0 63 +def case_____b_a 12 19 19 Y 128 0 63 +def coalesce_a_b 12 19 19 Y 128 0 63 +def coalesce_b_a 12 19 19 Y 128 0 63 +def if_______a_b 12 19 19 Y 128 0 63 +def if_______b_a 12 19 19 Y 128 0 63 +def ifnull___a_b 12 19 19 Y 128 0 63 +def ifnull___b_a 12 19 19 Y 128 0 63 +def least____a_b 12 10 19 Y 128 0 63 +def least____b_a 12 10 19 Y 128 0 63 +def greatest_a_b 12 10 19 Y 128 0 63 +def greatest_b_a 12 10 19 Y 128 0 63 +case_____a_b 2010-01-01 00:00:00 +case_____b_a 2001-01-01 10:20:30 +coalesce_a_b 2010-01-01 00:00:00 +coalesce_b_a 2001-01-01 10:20:30 +if_______a_b 2001-01-01 10:20:30 +if_______b_a 2010-01-01 00:00:00 +ifnull___a_b 2010-01-01 00:00:00 +ifnull___b_a 2001-01-01 10:20:30 +least____a_b 2001-01-01 10:20:30 +least____b_a 2001-01-01 10:20:30 +greatest_a_b 2010-01-01 00:00:00 +greatest_b_a 2010-01-01 00:00:00 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` date DEFAULT NULL, + `case_______a` date DEFAULT NULL, + `case_____a_a` date DEFAULT NULL, + `coalesce___a` date DEFAULT NULL, + `coalesce_a_a` date DEFAULT NULL, + `if_______a_a` date DEFAULT NULL, + `ifnull___a_a` date DEFAULT NULL, + `least____a_a` date DEFAULT NULL, + `greatest_a_a` date DEFAULT NULL, + `___________b` time DEFAULT NULL, + `case_______b` time DEFAULT NULL, + `case_____b_b` time DEFAULT NULL, + `coalesce___b` time DEFAULT NULL, + `coalesce_b_b` time DEFAULT NULL, + `if_______b_b` time DEFAULT NULL, + `ifnull___b_b` time DEFAULT NULL, + `least____b_b` time DEFAULT NULL, + `greatest_b_b` time DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` datetime DEFAULT NULL, + `case_____b_a` datetime DEFAULT NULL, + `coalesce_a_b` datetime DEFAULT NULL, + `coalesce_b_a` datetime DEFAULT NULL, + `if_______a_b` datetime DEFAULT NULL, + `if_______b_a` datetime DEFAULT NULL, + `ifnull___a_b` datetime DEFAULT NULL, + `ifnull___b_a` datetime DEFAULT NULL, + `least____a_b` datetime DEFAULT NULL, + `least____b_a` datetime DEFAULT NULL, + `greatest_a_b` datetime DEFAULT NULL, + `greatest_b_a` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +SET timestamp=DEFAULT; +# +SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03'); +CREATE TABLE t1 (a TIMESTAMP, b TIME); +INSERT INTO t1 VALUES ('2010-01-01 00:00:00','10:20:30'); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 7 19 19 N 9377 0 63 +def case_______a 7 19 19 Y 128 0 63 +def case_____a_a 7 19 19 N 129 0 63 +def coalesce___a 7 19 19 N 129 0 63 +def coalesce_a_a 7 19 19 N 129 0 63 +def if_______a_a 7 19 19 N 129 0 63 +def ifnull___a_a 7 19 19 N 129 0 63 +def least____a_a 7 19 19 N 161 0 63 +def greatest_a_a 7 19 19 N 161 0 63 +def test t1 t1 b ___________b 11 10 8 Y 128 0 63 +def case_______b 11 10 8 Y 128 0 63 +def case_____b_b 11 10 8 Y 128 0 63 +def coalesce___b 11 10 8 Y 128 0 63 +def coalesce_b_b 11 10 8 Y 128 0 63 +def if_______b_b 11 10 8 Y 128 0 63 +def ifnull___b_b 11 10 8 Y 128 0 63 +def least____b_b 11 10 8 Y 128 0 63 +def greatest_b_b 11 10 8 Y 128 0 63 +___________a 2010-01-01 00:00:00 +case_______a 2010-01-01 00:00:00 +case_____a_a 2010-01-01 00:00:00 +coalesce___a 2010-01-01 00:00:00 +coalesce_a_a 2010-01-01 00:00:00 +if_______a_a 2010-01-01 00:00:00 +ifnull___a_a 2010-01-01 00:00:00 +least____a_a 2010-01-01 00:00:00 +greatest_a_a 2010-01-01 00:00:00 +___________b 10:20:30 +case_______b 10:20:30 +case_____b_b 10:20:30 +coalesce___b 10:20:30 +coalesce_b_b 10:20:30 +if_______b_b 10:20:30 +ifnull___b_b 10:20:30 +least____b_b 10:20:30 +greatest_b_b 10:20:30 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 12 19 19 Y 128 0 63 +def case_____b_a 12 19 19 Y 128 0 63 +def coalesce_a_b 12 19 19 Y 128 0 63 +def coalesce_b_a 12 19 19 Y 128 0 63 +def if_______a_b 12 19 19 Y 128 0 63 +def if_______b_a 12 19 19 Y 128 0 63 +def ifnull___a_b 12 19 19 Y 128 0 63 +def ifnull___b_a 12 19 19 N 129 0 63 +def least____a_b 12 19 19 Y 128 0 63 +def least____b_a 12 19 19 Y 128 0 63 +def greatest_a_b 12 19 19 Y 128 0 63 +def greatest_b_a 12 19 19 Y 128 0 63 +case_____a_b 2010-01-01 00:00:00 +case_____b_a 2001-01-01 10:20:30 +coalesce_a_b 2010-01-01 00:00:00 +coalesce_b_a 2001-01-01 10:20:30 +if_______a_b 2001-01-01 10:20:30 +if_______b_a 2010-01-01 00:00:00 +ifnull___a_b 2010-01-01 00:00:00 +ifnull___b_a 2001-01-01 10:20:30 +least____a_b 2001-01-01 10:20:30 +least____b_a 2001-01-01 10:20:30 +greatest_a_b 2010-01-01 00:00:00 +greatest_b_a 2010-01-01 00:00:00 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `case_______a` timestamp NULL DEFAULT NULL, + `case_____a_a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `coalesce___a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `coalesce_a_a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `if_______a_a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `ifnull___a_a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `least____a_a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `greatest_a_a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `___________b` time DEFAULT NULL, + `case_______b` time DEFAULT NULL, + `case_____b_b` time DEFAULT NULL, + `coalesce___b` time DEFAULT NULL, + `coalesce_b_b` time DEFAULT NULL, + `if_______b_b` time DEFAULT NULL, + `ifnull___b_b` time DEFAULT NULL, + `least____b_b` time DEFAULT NULL, + `greatest_b_b` time DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` datetime DEFAULT NULL, + `case_____b_a` datetime DEFAULT NULL, + `coalesce_a_b` datetime DEFAULT NULL, + `coalesce_b_a` datetime DEFAULT NULL, + `if_______a_b` datetime DEFAULT NULL, + `if_______b_a` datetime DEFAULT NULL, + `ifnull___a_b` datetime DEFAULT NULL, + `ifnull___b_a` datetime NOT NULL, + `least____a_b` datetime DEFAULT NULL, + `least____b_a` datetime DEFAULT NULL, + `greatest_a_b` datetime DEFAULT NULL, + `greatest_b_a` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +SET timestamp=DEFAULT; +# +SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03'); +CREATE TABLE t1 (a DATETIME, b TIME); +INSERT INTO t1 VALUES ('2010-01-01 00:00:00','10:20:30'); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 12 19 19 Y 128 0 63 +def case_______a 12 19 19 Y 128 0 63 +def case_____a_a 12 19 19 Y 128 0 63 +def coalesce___a 12 19 19 Y 128 0 63 +def coalesce_a_a 12 19 19 Y 128 0 63 +def if_______a_a 12 19 19 Y 128 0 63 +def ifnull___a_a 12 19 19 Y 128 0 63 +def least____a_a 12 19 19 Y 128 0 63 +def greatest_a_a 12 19 19 Y 128 0 63 +def test t1 t1 b ___________b 11 10 8 Y 128 0 63 +def case_______b 11 10 8 Y 128 0 63 +def case_____b_b 11 10 8 Y 128 0 63 +def coalesce___b 11 10 8 Y 128 0 63 +def coalesce_b_b 11 10 8 Y 128 0 63 +def if_______b_b 11 10 8 Y 128 0 63 +def ifnull___b_b 11 10 8 Y 128 0 63 +def least____b_b 11 10 8 Y 128 0 63 +def greatest_b_b 11 10 8 Y 128 0 63 +___________a 2010-01-01 00:00:00 +case_______a 2010-01-01 00:00:00 +case_____a_a 2010-01-01 00:00:00 +coalesce___a 2010-01-01 00:00:00 +coalesce_a_a 2010-01-01 00:00:00 +if_______a_a 2010-01-01 00:00:00 +ifnull___a_a 2010-01-01 00:00:00 +least____a_a 2010-01-01 00:00:00 +greatest_a_a 2010-01-01 00:00:00 +___________b 10:20:30 +case_______b 10:20:30 +case_____b_b 10:20:30 +coalesce___b 10:20:30 +coalesce_b_b 10:20:30 +if_______b_b 10:20:30 +ifnull___b_b 10:20:30 +least____b_b 10:20:30 +greatest_b_b 10:20:30 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 12 19 19 Y 128 0 63 +def case_____b_a 12 19 19 Y 128 0 63 +def coalesce_a_b 12 19 19 Y 128 0 63 +def coalesce_b_a 12 19 19 Y 128 0 63 +def if_______a_b 12 19 19 Y 128 0 63 +def if_______b_a 12 19 19 Y 128 0 63 +def ifnull___a_b 12 19 19 Y 128 0 63 +def ifnull___b_a 12 19 19 Y 128 0 63 +def least____a_b 12 19 19 Y 128 0 63 +def least____b_a 12 19 19 Y 128 0 63 +def greatest_a_b 12 19 19 Y 128 0 63 +def greatest_b_a 12 19 19 Y 128 0 63 +case_____a_b 2010-01-01 00:00:00 +case_____b_a 2001-01-01 10:20:30 +coalesce_a_b 2010-01-01 00:00:00 +coalesce_b_a 2001-01-01 10:20:30 +if_______a_b 2001-01-01 10:20:30 +if_______b_a 2010-01-01 00:00:00 +ifnull___a_b 2010-01-01 00:00:00 +ifnull___b_a 2001-01-01 10:20:30 +least____a_b 2001-01-01 10:20:30 +least____b_a 2001-01-01 10:20:30 +greatest_a_b 2010-01-01 00:00:00 +greatest_b_a 2010-01-01 00:00:00 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` datetime DEFAULT NULL, + `case_______a` datetime DEFAULT NULL, + `case_____a_a` datetime DEFAULT NULL, + `coalesce___a` datetime DEFAULT NULL, + `coalesce_a_a` datetime DEFAULT NULL, + `if_______a_a` datetime DEFAULT NULL, + `ifnull___a_a` datetime DEFAULT NULL, + `least____a_a` datetime DEFAULT NULL, + `greatest_a_a` datetime DEFAULT NULL, + `___________b` time DEFAULT NULL, + `case_______b` time DEFAULT NULL, + `case_____b_b` time DEFAULT NULL, + `coalesce___b` time DEFAULT NULL, + `coalesce_b_b` time DEFAULT NULL, + `if_______b_b` time DEFAULT NULL, + `ifnull___b_b` time DEFAULT NULL, + `least____b_b` time DEFAULT NULL, + `greatest_b_b` time DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` datetime DEFAULT NULL, + `case_____b_a` datetime DEFAULT NULL, + `coalesce_a_b` datetime DEFAULT NULL, + `coalesce_b_a` datetime DEFAULT NULL, + `if_______a_b` datetime DEFAULT NULL, + `if_______b_a` datetime DEFAULT NULL, + `ifnull___a_b` datetime DEFAULT NULL, + `ifnull___b_a` datetime DEFAULT NULL, + `least____a_b` datetime DEFAULT NULL, + `least____b_a` datetime DEFAULT NULL, + `greatest_a_b` datetime DEFAULT NULL, + `greatest_b_a` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +SET timestamp=DEFAULT; +# +SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03'); +CREATE TABLE t1 (a DATETIME, b DATE); +INSERT INTO t1 VALUES ('2010-01-01 10:20:30','2001-01-02'); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 12 19 19 Y 128 0 63 +def case_______a 12 19 19 Y 128 0 63 +def case_____a_a 12 19 19 Y 128 0 63 +def coalesce___a 12 19 19 Y 128 0 63 +def coalesce_a_a 12 19 19 Y 128 0 63 +def if_______a_a 12 19 19 Y 128 0 63 +def ifnull___a_a 12 19 19 Y 128 0 63 +def least____a_a 12 19 19 Y 128 0 63 +def greatest_a_a 12 19 19 Y 128 0 63 +def test t1 t1 b ___________b 10 10 10 Y 128 0 63 +def case_______b 10 10 10 Y 128 0 63 +def case_____b_b 10 10 10 Y 128 0 63 +def coalesce___b 10 10 10 Y 128 0 63 +def coalesce_b_b 10 10 10 Y 128 0 63 +def if_______b_b 10 10 10 Y 128 0 63 +def ifnull___b_b 10 10 10 Y 128 0 63 +def least____b_b 10 10 10 Y 128 0 63 +def greatest_b_b 10 10 10 Y 128 0 63 +___________a 2010-01-01 10:20:30 +case_______a 2010-01-01 10:20:30 +case_____a_a 2010-01-01 10:20:30 +coalesce___a 2010-01-01 10:20:30 +coalesce_a_a 2010-01-01 10:20:30 +if_______a_a 2010-01-01 10:20:30 +ifnull___a_a 2010-01-01 10:20:30 +least____a_a 2010-01-01 10:20:30 +greatest_a_a 2010-01-01 10:20:30 +___________b 2001-01-02 +case_______b 2001-01-02 +case_____b_b 2001-01-02 +coalesce___b 2001-01-02 +coalesce_b_b 2001-01-02 +if_______b_b 2001-01-02 +ifnull___b_b 2001-01-02 +least____b_b 2001-01-02 +greatest_b_b 2001-01-02 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 12 19 19 Y 128 0 63 +def case_____b_a 12 19 19 Y 128 0 63 +def coalesce_a_b 12 19 19 Y 128 0 63 +def coalesce_b_a 12 19 19 Y 128 0 63 +def if_______a_b 12 19 19 Y 128 0 63 +def if_______b_a 12 19 19 Y 128 0 63 +def ifnull___a_b 12 19 19 Y 128 0 63 +def ifnull___b_a 12 19 19 Y 128 0 63 +def least____a_b 12 19 19 Y 128 0 63 +def least____b_a 12 19 19 Y 128 0 63 +def greatest_a_b 12 19 19 Y 128 0 63 +def greatest_b_a 12 19 19 Y 128 0 63 +case_____a_b 2010-01-01 10:20:30 +case_____b_a 2001-01-02 00:00:00 +coalesce_a_b 2010-01-01 10:20:30 +coalesce_b_a 2001-01-02 00:00:00 +if_______a_b 2001-01-02 00:00:00 +if_______b_a 2010-01-01 10:20:30 +ifnull___a_b 2010-01-01 10:20:30 +ifnull___b_a 2001-01-02 00:00:00 +least____a_b 2001-01-02 00:00:00 +least____b_a 2001-01-02 00:00:00 +greatest_a_b 2010-01-01 10:20:30 +greatest_b_a 2010-01-01 10:20:30 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` datetime DEFAULT NULL, + `case_______a` datetime DEFAULT NULL, + `case_____a_a` datetime DEFAULT NULL, + `coalesce___a` datetime DEFAULT NULL, + `coalesce_a_a` datetime DEFAULT NULL, + `if_______a_a` datetime DEFAULT NULL, + `ifnull___a_a` datetime DEFAULT NULL, + `least____a_a` datetime DEFAULT NULL, + `greatest_a_a` datetime DEFAULT NULL, + `___________b` date DEFAULT NULL, + `case_______b` date DEFAULT NULL, + `case_____b_b` date DEFAULT NULL, + `coalesce___b` date DEFAULT NULL, + `coalesce_b_b` date DEFAULT NULL, + `if_______b_b` date DEFAULT NULL, + `ifnull___b_b` date DEFAULT NULL, + `least____b_b` date DEFAULT NULL, + `greatest_b_b` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` datetime DEFAULT NULL, + `case_____b_a` datetime DEFAULT NULL, + `coalesce_a_b` datetime DEFAULT NULL, + `coalesce_b_a` datetime DEFAULT NULL, + `if_______a_b` datetime DEFAULT NULL, + `if_______b_a` datetime DEFAULT NULL, + `ifnull___a_b` datetime DEFAULT NULL, + `ifnull___b_a` datetime DEFAULT NULL, + `least____a_b` datetime DEFAULT NULL, + `least____b_a` datetime DEFAULT NULL, + `greatest_a_b` datetime DEFAULT NULL, + `greatest_b_a` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +SET timestamp=DEFAULT; +# +# MDEV-8873 Wrong field type or metadata for LEAST(int_column,string_column) +# +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES (-2147483648,'100x'); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 3 11 11 Y 32768 0 63 +def case_______a 3 11 11 Y 32896 0 63 +def case_____a_a 3 11 11 Y 32896 0 63 +def coalesce___a 3 11 11 Y 32896 0 63 +def coalesce_a_a 3 11 11 Y 32896 0 63 +def if_______a_a 3 11 11 Y 32896 0 63 +def ifnull___a_a 3 11 11 Y 32896 0 63 +def least____a_a 3 11 11 Y 32896 0 63 +def greatest_a_a 3 11 11 Y 32896 0 63 +def test t1 t1 b ___________b 253 10 4 Y 0 0 8 +def case_______b 253 10 4 Y 0 31 8 +def case_____b_b 253 10 4 Y 0 31 8 +def coalesce___b 253 10 4 Y 0 31 8 +def coalesce_b_b 253 10 4 Y 0 31 8 +def if_______b_b 253 10 4 Y 0 31 8 +def ifnull___b_b 253 10 4 Y 0 31 8 +def least____b_b 253 10 4 Y 0 31 8 +def greatest_b_b 253 10 4 Y 0 31 8 +___________a -2147483648 +case_______a -2147483648 +case_____a_a -2147483648 +coalesce___a -2147483648 +coalesce_a_a -2147483648 +if_______a_a -2147483648 +ifnull___a_a -2147483648 +least____a_a -2147483648 +greatest_a_a -2147483648 +___________b 100x +case_______b 100x +case_____b_b 100x +coalesce___b 100x +coalesce_b_b 100x +if_______b_b 100x +ifnull___b_b 100x +least____b_b 100x +greatest_b_b 100x +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 253 11 11 Y 0 31 8 +def case_____b_a 253 11 4 Y 0 31 8 +def coalesce_a_b 253 11 11 Y 0 31 8 +def coalesce_b_a 253 11 4 Y 0 31 8 +def if_______a_b 253 11 4 Y 0 31 8 +def if_______b_a 253 11 11 Y 0 31 8 +def ifnull___a_b 253 11 11 Y 0 31 8 +def ifnull___b_a 253 11 4 Y 0 31 8 +def least____a_b 5 23 11 Y 32896 31 63 +def least____b_a 5 23 11 Y 32896 31 63 +def greatest_a_b 5 23 3 Y 32896 31 63 +def greatest_b_a 5 23 3 Y 32896 31 63 +case_____a_b -2147483648 +case_____b_a 100x +coalesce_a_b -2147483648 +coalesce_b_a 100x +if_______a_b 100x +if_______b_a -2147483648 +ifnull___a_b -2147483648 +ifnull___b_a 100x +least____a_b -2147483648 +least____b_a -2147483648 +greatest_a_b 100 +greatest_b_a 100 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect DOUBLE value: '100x' +Level Warning +Code 1292 +Message Truncated incorrect DOUBLE value: '100x' +Level Warning +Code 1292 +Message Truncated incorrect DOUBLE value: '100x' +Level Warning +Code 1292 +Message Truncated incorrect DOUBLE value: '100x' +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` int(11) DEFAULT NULL, + `case_______a` int(11) DEFAULT NULL, + `case_____a_a` int(11) DEFAULT NULL, + `coalesce___a` int(11) DEFAULT NULL, + `coalesce_a_a` int(11) DEFAULT NULL, + `if_______a_a` int(11) DEFAULT NULL, + `ifnull___a_a` int(11) DEFAULT NULL, + `least____a_a` int(11) DEFAULT NULL, + `greatest_a_a` int(11) DEFAULT NULL, + `___________b` varchar(10) DEFAULT NULL, + `case_______b` varchar(10) DEFAULT NULL, + `case_____b_b` varchar(10) DEFAULT NULL, + `coalesce___b` varchar(10) DEFAULT NULL, + `coalesce_b_b` varchar(10) DEFAULT NULL, + `if_______b_b` varchar(10) DEFAULT NULL, + `ifnull___b_b` varchar(10) DEFAULT NULL, + `least____b_b` varchar(10) DEFAULT NULL, + `greatest_b_b` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '100x' +Warning 1292 Truncated incorrect DOUBLE value: '100x' +Warning 1292 Truncated incorrect DOUBLE value: '100x' +Warning 1292 Truncated incorrect DOUBLE value: '100x' +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` varchar(11) DEFAULT NULL, + `case_____b_a` varchar(11) DEFAULT NULL, + `coalesce_a_b` varchar(11) DEFAULT NULL, + `coalesce_b_a` varchar(11) DEFAULT NULL, + `if_______a_b` varchar(11) DEFAULT NULL, + `if_______b_a` varchar(11) DEFAULT NULL, + `ifnull___a_b` varchar(11) DEFAULT NULL, + `ifnull___b_a` varchar(11) DEFAULT NULL, + `least____a_b` double DEFAULT NULL, + `least____b_a` double DEFAULT NULL, + `greatest_a_b` double DEFAULT NULL, + `greatest_b_a` double DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +# MDEV-4848 Wrong metadata or column type for LEAST(1.0,'10') +# +SELECT LEAST(1.0,'10'); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(1.0,'10') 5 23 1 N 32897 31 63 +LEAST(1.0,'10') +1 +CREATE TABLE t1 AS SELECT LEAST(1.0,'10'); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `LEAST(1.0,'10')` double NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# MDEV-657 LP:873142 - GREATEST() does not always return same signness of argument types +# +CREATE TABLE t1 (a BIGINT(20) UNSIGNED NOT NULL PRIMARY KEY); +INSERT INTO t1 (a) VALUES (13836376518955650385) ON DUPLICATE KEY UPDATE a=GREATEST(a,VALUES(a)); +INSERT INTO t1 (a) VALUES (13836376518955650385) ON DUPLICATE KEY UPDATE a=GREATEST(a,VALUES(a)); +SELECT * FROM t1; +a +13836376518955650385 +DROP TABLE t1; +# +# MDEV-5694 GREATEST(date, time) returns a wrong data type +# +SET timestamp=UNIX_TIMESTAMP('2010-01-01 01:02:03'); +SELECT GREATEST(CURRENT_TIME, CURRENT_DATE), COALESCE(CURRENT_TIME, CURRENT_DATE); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def GREATEST(CURRENT_TIME, CURRENT_DATE) 12 10 19 N 129 0 63 +def COALESCE(CURRENT_TIME, CURRENT_DATE) 12 19 19 N 129 0 63 +GREATEST(CURRENT_TIME, CURRENT_DATE) COALESCE(CURRENT_TIME, CURRENT_DATE) +2010-01-01 01:02:03 2010-01-01 01:02:03 +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES ('2010-01-01 10:20:30'); +SELECT GREATEST(a,a) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def GREATEST(a,a) 7 19 19 N 161 0 63 +GREATEST(a,a) +2010-01-01 10:20:30 +DROP TABLE t1; +CREATE TABLE t1 (a TIMESTAMP, b DATETIME); +CREATE TABLE t2 AS SELECT LEAST(a,a),LEAST(b,b),LEAST(a,b) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `LEAST(a,a)` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `LEAST(b,b)` datetime DEFAULT NULL, + `LEAST(a,b)` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +SET timestamp=DEFAULT; +# +# MDEV-8910 Wrong metadata or field type for MAX(COALESCE(string_field)) +# +CREATE TABLE t1 (c1 TINYBLOB, c2 MEDIUMBLOB, c3 BLOB, c4 LONGBLOB); +CREATE TABLE t2 AS +SELECT +MAX(COALESCE(c1)) AS c1, +MAX(COALESCE(c2)) AS c2, +MAX(COALESCE(c3)) AS c3, +MAX(COALESCE(c4)) AS c4 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varbinary(255) DEFAULT NULL, + `c2` mediumblob, + `c3` blob, + `c4` longblob +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +MAX(COALESCE(c1)) AS c1, +MAX(COALESCE(c2)) AS c2, +MAX(COALESCE(c3)) AS c3, +MAX(COALESCE(c4)) AS c4 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 255 0 Y 128 31 63 +def c2 250 16777215 0 Y 128 31 63 +def c3 252 65535 0 Y 128 31 63 +def c4 251 4294967295 0 Y 128 31 63 +c1 c2 c3 c4 +NULL NULL NULL NULL +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 CHAR(1), c2 CHAR(255)) CHARACTER SET latin1; +CREATE TABLE t2 AS +SELECT +MAX(COALESCE(c1)) AS c1, +MAX(COALESCE(c2)) AS c2 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) DEFAULT NULL, + `c2` varchar(255) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +MAX(COALESCE(c1)) AS c1, +MAX(COALESCE(c2)) AS c2 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 31 8 +def c2 253 255 0 Y 0 31 8 +c1 c2 +NULL NULL +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 CHAR(1), c2 CHAR(255)) CHARACTER SET utf8; +CREATE TABLE t2 AS +SELECT +MAX(COALESCE(c1)) AS c1, +MAX(COALESCE(c2)) AS c2 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL, + `c2` varchar(255) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +MAX(COALESCE(c1)) AS c1, +MAX(COALESCE(c2)) AS c2 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 31 8 +def c2 253 255 0 Y 0 31 8 +c1 c2 +NULL NULL +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(1), c2 VARCHAR(255), c3 VARCHAR(20000)) CHARACTER SET latin1; +CREATE TABLE t2 AS +SELECT +MAX(COALESCE(c1)) AS c1, +MAX(COALESCE(c2)) AS c2, +MAX(COALESCE(c3)) AS c3 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) DEFAULT NULL, + `c2` varchar(255) DEFAULT NULL, + `c3` text +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +MAX(COALESCE(c1)) AS c1, +MAX(COALESCE(c2)) AS c2, +MAX(COALESCE(c3)) AS c3 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 31 8 +def c2 253 255 0 Y 0 31 8 +def c3 252 20000 0 Y 0 31 8 +c1 c2 c3 +NULL NULL NULL +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(1), c2 VARCHAR(255), c3 VARCHAR(20000)) CHARACTER SET utf8; +CREATE TABLE t2 AS +SELECT +MAX(COALESCE(c1)) AS c1, +MAX(COALESCE(c2)) AS c2, +MAX(COALESCE(c3)) AS c3 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL, + `c2` varchar(255) CHARACTER SET utf8 DEFAULT NULL, + `c3` text CHARACTER SET utf8 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +MAX(COALESCE(c1)) AS c1, +MAX(COALESCE(c2)) AS c2, +MAX(COALESCE(c3)) AS c3 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 31 8 +def c2 253 255 0 Y 0 31 8 +def c3 252 60000 0 Y 0 31 8 +c1 c2 c3 +NULL NULL NULL +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 ENUM('a')) CHARACTER SET latin1; +CREATE TABLE t2 AS +SELECT +MAX(COALESCE(c1)) AS c1 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +MAX(COALESCE(c1)) AS c1 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 31 8 +c1 +NULL +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 ENUM('a')) CHARACTER SET utf8; +CREATE TABLE t2 AS +SELECT +MAX(COALESCE(c1)) AS c1 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +MAX(COALESCE(c1)) AS c1 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 31 8 +c1 +NULL +DROP TABLE t2; +DROP TABLE t1; +# +# MDEV-8912 Wrong metadata or type for @c:=string_or_blob_field +# +CREATE TABLE t1 (c1 TINYBLOB, c2 BLOB, c3 MEDIUMBLOB, c4 LONGBLOB); +CREATE TABLE t2 AS +SELECT +@c1:=c1 AS c1, +@c2:=c2 AS c2, +@c3:=c3 AS c3, +@c4:=c4 AS c4 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varbinary(255) DEFAULT NULL, + `c2` blob, + `c3` mediumblob, + `c4` longblob +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +@c1:=c1 AS c1, +@c2:=c2 AS c2, +@c3:=c3 AS c3, +@c4:=c4 AS c4 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 255 0 Y 128 31 63 +def c2 252 65535 0 Y 128 31 63 +def c3 250 16777215 0 Y 128 31 63 +def c4 251 4294967295 0 Y 128 31 63 +c1 c2 c3 c4 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 CHAR(1), c2 CHAR(255)) CHARACTER SET latin1; +CREATE TABLE t2 AS +SELECT +@c1:=c1 AS c1, +@c2:=c2 AS c2 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) DEFAULT NULL, + `c2` varchar(255) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +@c1:=c1 AS c1, +@c2:=c2 AS c2 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 31 8 +def c2 253 255 0 Y 0 31 8 +c1 c2 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 CHAR(1), c2 CHAR(255)) CHARACTER SET utf8; +CREATE TABLE t2 AS +SELECT +@c1:=c1 AS c1, +@c2:=c2 AS c2 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL, + `c2` varchar(255) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +@c1:=c1 AS c1, +@c2:=c2 AS c2 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 31 8 +def c2 253 255 0 Y 0 31 8 +c1 c2 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(1), c2 VARCHAR(255), c3 VARCHAR(20000)) CHARACTER SET latin1; +CREATE TABLE t2 AS +SELECT +@c:=c1 AS c1, +@c:=c2 AS c2, +@c:=c3 AS c3 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) DEFAULT NULL, + `c2` varchar(255) DEFAULT NULL, + `c3` text +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +@c:=c1 AS c1, +@c:=c2 AS c2, +@c:=c3 AS c3 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 31 8 +def c2 253 255 0 Y 0 31 8 +def c3 252 20000 0 Y 0 31 8 +c1 c2 c3 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(1), c2 VARCHAR(255), c3 VARCHAR(20000)) CHARACTER SET utf8; +CREATE TABLE t2 AS +SELECT +@c:=c1 AS c1, +@c:=c2 AS c2, +@c:=c3 AS c3 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL, + `c2` varchar(255) CHARACTER SET utf8 DEFAULT NULL, + `c3` text CHARACTER SET utf8 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +@c:=c1 AS c1, +@c:=c2 AS c2, +@c:=c3 AS c3 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 31 8 +def c2 253 255 0 Y 0 31 8 +def c3 252 60000 0 Y 0 31 8 +c1 c2 c3 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 ENUM('a')) CHARACTER SET latin1; +CREATE TABLE t2 AS +SELECT +@c:=c1 AS c1 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +@c:=c1 AS c1 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 0 8 +c1 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 ENUM('a')) CHARACTER SET utf8; +CREATE TABLE t2 AS +SELECT +@c:=c1 AS c1 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +@c:=c1 AS c1 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 0 8 +c1 +DROP TABLE t2; +DROP TABLE t1; +# +# MDEV-9653 Assertion `length || !scale' failed in uint my_decimal_length_to_precision(uint, uint, bool) +# +SELECT CASE 0 WHEN 1 THEN (CASE 2 WHEN 3 THEN NULL END) WHEN 4 THEN 5 END; +CASE 0 WHEN 1 THEN (CASE 2 WHEN 3 THEN NULL END) WHEN 4 THEN 5 END +NULL +SELECT CASE 0 WHEN 1 THEN (COALESCE(NULL)) WHEN 4 THEN 5 END; +CASE 0 WHEN 1 THEN (COALESCE(NULL)) WHEN 4 THEN 5 END +NULL +SELECT CASE WHEN TRUE THEN COALESCE(NULL) ELSE 4 END; +CASE WHEN TRUE THEN COALESCE(NULL) ELSE 4 END +NULL +SELECT COALESCE(COALESCE(NULL), 1.1) AS c0, IF(0, COALESCE(NULL), 1.1) AS c1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0 246 4 3 Y 32896 1 63 +def c1 246 4 3 Y 32896 1 63 +c0 c1 +1.1 1.1 +# +# MDEV-9752 Wrong data type for COALEASCE(?,1) in prepared statements +# +PREPARE stmt FROM "CREATE TABLE t1 AS SELECT CONCAT(COALESCE(?,1)) AS a, CONCAT(CASE WHEN TRUE THEN ? ELSE 1 END) AS b"; +SET @a=1; +EXECUTE stmt USING @a,@a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(21) DEFAULT NULL, + `b` varchar(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result index 61f63cc7253..637fd8cd2a2 100644 --- a/mysql-test/r/func_if.result +++ b/mysql-test/r/func_if.result @@ -240,10 +240,7 @@ End of 5.2 tests # CREATE TABLE `t1` ( `datas` VARCHAR(25) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -Warnings: -Warning 1286 Unknown storage engine 'InnoDB' -Warning 1266 Using storage engine MyISAM for table 't1' +) DEFAULT CHARSET=utf8; INSERT INTO `t1` VALUES ('1,2'), ('2,3'), ('3,4'); SELECT IF(FIND_IN_SET('1', `datas`), 1.5, IF(FIND_IN_SET('2', `datas`), 2, NULL)) AS `First`, '1' AS `Second`, '2' AS `Third` FROM `t1`; First Second Third diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index fc56660ac62..33a997c8004 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -271,7 +271,7 @@ select * from t2 where a NOT IN ( '2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00', '2006-04-25 10:06:00', '2006-04-25 10:08:00'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 9 NULL 18 Using index condition +1 SIMPLE t2 range a a 6 NULL 12 Using index condition select * from t2 where a NOT IN ( '2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00', '2006-04-25 10:06:00', '2006-04-25 10:08:00'); @@ -701,11 +701,11 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN SELECT * FROM t1 WHERE c_datetime IN ('2009-09-01 00:00:01', '2009-09-02 00:00:01', '2009-09-03 00:00:01'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_datetime c_datetime 8 NULL 3 Using index condition +1 SIMPLE t1 range c_datetime c_datetime 5 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_datetime IN (NULL, '2009-09-01 00:00:01', '2009-09-02 00:00:01', '2009-09-03 00:00:01'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_datetime c_datetime 8 NULL 3 Using index condition +1 SIMPLE t1 range c_datetime c_datetime 5 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_datetime IN (NULL); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables @@ -812,3 +812,27 @@ EXECUTE s; 1 DROP TABLE t1; # End of 5.3 tests +# +# MDEV-8755 Equal field propagation is not performed any longer for the IN list when multiple comparison types +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +# Ok to propagate equalities into the left IN argument in case of a single comparison type +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND a IN (1,2,3); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 1) +# Ok to propagate equalities into IN () list, even if multiple comparison types +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND 1 IN (1,a,'3'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 1) +# Not Ok to propagate equalities into the left IN argument in case of multiple comparison types +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND a IN (1,2,'3'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and (`test`.`t1`.`a` in (1,2,'3'))) +DROP TABLE t1; diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result index 8d72b818cf8..9c8e9727d16 100644 --- a/mysql-test/r/func_like.result +++ b/mysql-test/r/func_like.result @@ -200,3 +200,57 @@ SELECT 'a' LIKE REPEAT('',0); SELECT 'a' LIKE EXTRACTVALUE('bar','qux'); 'a' LIKE EXTRACTVALUE('bar','qux') 0 +# +# End of 10.0 tests +# +# +# Start of 10.1 tests +# +# +# MDEV-8257 Erroneous "Impossible where" when mixing decimal comparison and LIKE +# +CREATE TABLE t1 (a DECIMAL(8,2)); +INSERT INTO t1 VALUES (10),(20); +SELECT * FROM t1 WHERE a=10.0; +a +10.00 +SELECT * FROM t1 WHERE a LIKE 10.00; +a +10.00 +SELECT * FROM t1 WHERE a=10.0 AND a LIKE 10.00; +a +10.00 +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10.0 AND a LIKE 10.00; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 10.0) and (`test`.`t1`.`a` like 10.00)) +DROP TABLE t1; +# +# MDEV-8599 "WHERE varchar_field LIKE temporal_const" does not use range optimizer +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1, KEY(a)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('00:00:00'); +INSERT INTO t1 VALUES ('00:00:01'); +INSERT INTO t1 VALUES ('00:00:02'); +INSERT INTO t1 VALUES ('00:00:03'); +INSERT INTO t1 VALUES ('00:00:04'); +INSERT INTO t1 VALUES ('00:00:05'); +INSERT INTO t1 VALUES ('00:00:06'); +INSERT INTO t1 VALUES ('00:00:07'); +EXPLAIN SELECT * FROM t1 WHERE a LIKE '00:00:00'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 13 NULL 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a LIKE TIME'00:00:00'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 13 NULL 1 Using where; Using index +SELECT * FROM t1 WHERE a LIKE '00:00:00'; +a +00:00:00 +SELECT * FROM t1 WHERE a LIKE TIME'00:00:00'; +a +00:00:00 +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index 1259661f0b6..f8e89dbc1c2 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -165,7 +165,7 @@ create table t1 select round(1, 6); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `round(1, 6)` int(1) NOT NULL DEFAULT '0' + `round(1, 6)` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t1; round(1, 6) @@ -214,7 +214,9 @@ CAST(RAND(2) * 1000 AS UNSIGNED) CAST(RAND(?) * 1000 AS UNSIGNED) 122 122 645 645 DROP TABLE t1; +set sql_mode=""; create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb default charset=utf8; +set sql_mode=default; insert into t1 values ('http://www.foo.com/', now()); select a from t1 where a='http://www.foo.com/' order by abs(timediff(ts, 0)); a @@ -474,8 +476,13 @@ CREATE TABLE t1(f1 LONGTEXT) engine=myisam; INSERT INTO t1 VALUES ('a'); SELECT 1 FROM (SELECT ROUND(f1) AS a FROM t1) AS s WHERE a LIKE 'a'; 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' SELECT 1 FROM (SELECT ROUND(f1, f1) AS a FROM t1) AS s WHERE a LIKE 'a'; 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect INTEGER value: 'a' DROP TABLE t1; End of 5.0 tests SELECT 1e308 + 1e308; @@ -700,6 +707,9 @@ SELECT floor(log10(format(concat_ws(5445796E25, 5306463, 30837), -358821))) as foo; foo 2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '53064635.445796e3130837' +Warning 1292 Truncated incorrect DOUBLE value: '179,769,313,486,231,570,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,' # # Bug #58137 char(0) column cause: # my_gcvt: Assertion `width > 0 && to != ((void *)0)' failed diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index bab360d677d..700fda2e182 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -100,8 +100,8 @@ create table t1 as select uuid(), length(uuid()); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `uuid()` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT '', - `length(uuid())` int(10) NOT NULL DEFAULT '0' + `uuid()` varchar(36) CHARACTER SET utf8 NOT NULL, + `length(uuid())` int(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 select INET_ATON('255.255.0.1') as `a`; @@ -295,6 +295,8 @@ INSERT INTO t1 VALUES ('', 0); SELECT COALESCE(a) = COALESCE(b) FROM t1; COALESCE(a) = COALESCE(b) 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' DROP TABLE t1; # # Bug #54461: crash with longblob and union or update with subquery @@ -334,10 +336,7 @@ CREATE TABLE t1 (a char(2) not null ); INSERT INTO t1 VALUES (4),(7),(1); set @optimizer_switch_save= @@optimizer_switch; set optimizer_switch='materialization=off'; -CREATE TABLE tv (e char(2) not null ) engine=mysql; -Warnings: -Warning 1286 Unknown storage engine 'mysql' -Warning 1266 Using storage engine MyISAM for table 'tv' +CREATE TABLE tv (e char(2) not null ); INSERT INTO tv VALUES (1); CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv; CREATE ALGORITHM=MERGE VIEW vm AS SELECT * FROM tv; @@ -1380,6 +1379,46 @@ INET6_NTOA(ip) HEX(ip) LENGTH(ip) DROP TABLE t1; DROP TABLE t2; +# +# MDEV-4018 : Microseconds in GET_LOCK() +# +# -> Switching to connection 'default' +select is_used_lock('test') = connection_id(); +is_used_lock('test') = connection_id() +NULL +# GET_LOCK returns 1 if it manages to acquire a lock +select get_lock('test', 0); +get_lock('test', 0) +1 +# -> Switching to connection 'con1' +select is_used_lock('test') = connection_id(); +is_used_lock('test') = connection_id() +0 +select get_lock('test', 0); +get_lock('test', 0) +0 +select get_lock('test', 1.0); +get_lock('test', 1.0) +0 +select get_lock('test', 1.5); +get_lock('test', 1.5) +0 +select get_lock('test', 0.1); +get_lock('test', 0.1) +0 +select get_lock('test', 0.000001); +get_lock('test', 0.000001) +0 +select get_lock('test', 0.0000000000000001); +get_lock('test', 0.0000000000000001) +0 +# -> Switching to connection 'default' +select is_used_lock('test') = connection_id(); +is_used_lock('test') = connection_id() +1 +select release_lock('test'); +release_lock('test') +1 # -- Done. diff --git a/mysql-test/r/func_regexp_pcre.result b/mysql-test/r/func_regexp_pcre.result index aa090c9faf6..fcff0484b65 100644 --- a/mysql-test/r/func_regexp_pcre.result +++ b/mysql-test/r/func_regexp_pcre.result @@ -445,10 +445,12 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select regexp_replace('abc','b','x') AS `REGEXP_REPLACE('abc','b','x')` CREATE TABLE t1 AS SELECT REGEXP_REPLACE('abc','b','x')+0; +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'axc' SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `REGEXP_REPLACE('abc','b','x')+0` double NOT NULL DEFAULT '0' + `REGEXP_REPLACE('abc','b','x')+0` double NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; SELECT REGEXP_REPLACE(NULL,'b','c'); @@ -736,7 +738,7 @@ CREATE TABLE t1 AS SELECT REGEXP_SUBSTR('abc','b'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `REGEXP_SUBSTR('abc','b')` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '' + `REGEXP_SUBSTR('abc','b')` varchar(3) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; EXPLAIN EXTENDED SELECT REGEXP_SUBSTR('abc','b'); @@ -745,10 +747,12 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select regexp_substr('abc','b') AS `REGEXP_SUBSTR('abc','b')` CREATE TABLE t1 AS SELECT REGEXP_SUBSTR('abc','b')+0; +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'b' SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `REGEXP_SUBSTR('abc','b')+0` double NOT NULL DEFAULT '0' + `REGEXP_SUBSTR('abc','b')+0` double NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; SELECT REGEXP_SUBSTR('See https://mariadb.org/en/foundation/ for details', 'https?://[^/]*'); diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result index dfc3faf3fac..96af966d367 100644 --- a/mysql-test/r/func_set.result +++ b/mysql-test/r/func_set.result @@ -172,8 +172,8 @@ INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 ) 8 8 Warnings: -Warning 1292 Incorrect datetime value: '10' -Warning 1292 Incorrect datetime value: '11' +Warning 1292 Incorrect datetime value: '10' for column 'pk' at row 1 +Warning 1292 Incorrect datetime value: '11' for column 'pk' at row 2 DROP TABLE t1; # # End of 5.3 tests @@ -233,8 +233,8 @@ INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 ) 8 8 Warnings: -Warning 1292 Incorrect datetime value: '10' -Warning 1292 Incorrect datetime value: '11' +Warning 1292 Incorrect datetime value: '10' for column 'pk' at row 1 +Warning 1292 Incorrect datetime value: '11' for column 'pk' at row 2 DROP TABLE t1; # # End of 5.3 tests diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 8f08d7acd25..f196571218f 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -1,4 +1,5 @@ drop table if exists t1,t2; +set global max_allowed_packet=1048576; set names latin1; select 'hello',"'hello'",'""hello""','''h''e''l''l''o''',"hel""lo",'hel\'lo'; hello 'hello' ""hello"" 'h'e'l'l'o' hel"lo hel'lo @@ -264,6 +265,9 @@ NULL select aes_decrypt(aes_encrypt("","a"),"a"); aes_decrypt(aes_encrypt("","a"),"a") +select aes_decrypt("", "a"); +aes_decrypt("", "a") +NULL select repeat('monty',5),concat('*',space(5),'*'); repeat('monty',5) concat('*',space(5),'*') montymontymontymontymonty * * @@ -723,34 +727,34 @@ t1 CREATE TABLE `t1` ( `bin(130)` varchar(64) DEFAULT NULL, `oct(130)` varchar(64) DEFAULT NULL, `conv(130,16,10)` varchar(64) DEFAULT NULL, - `hex(130)` varchar(6) NOT NULL DEFAULT '', - `char(130)` varbinary(4) NOT NULL DEFAULT '', - `format(130,10)` varchar(37) NOT NULL DEFAULT '', - `left(_latin2'a',1)` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '', - `right(_latin2'a',1)` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '', - `lcase(_latin2'a')` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '', - `ucase(_latin2'a')` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '', - `substring(_latin2'a',1,1)` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '', - `concat(_latin2'a',_latin2'b')` varchar(2) CHARACTER SET latin2 NOT NULL DEFAULT '', - `lpad(_latin2'a',4,_latin2'b')` varchar(4) CHARACTER SET latin2 NOT NULL DEFAULT '', - `rpad(_latin2'a',4,_latin2'b')` varchar(4) CHARACTER SET latin2 NOT NULL DEFAULT '', - `concat_ws(_latin2'a',_latin2'b')` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '', - `make_set(255,_latin2'a',_latin2'b',_latin2'c')` varchar(5) CHARACTER SET latin2 NOT NULL DEFAULT '', - `export_set(255,_latin2'y',_latin2'n',_latin2' ')` varchar(127) CHARACTER SET latin2 NOT NULL DEFAULT '', - `trim(_latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL DEFAULT '', - `ltrim(_latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL DEFAULT '', - `rtrim(_latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL DEFAULT '', - `trim(LEADING _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL DEFAULT '', - `trim(TRAILING _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL DEFAULT '', - `trim(BOTH _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL DEFAULT '', - `repeat(_latin2'a',10)` varchar(10) CHARACTER SET latin2 NOT NULL DEFAULT '', - `reverse(_latin2'ab')` varchar(2) CHARACTER SET latin2 NOT NULL DEFAULT '', - `quote(_latin2'ab')` varchar(6) CHARACTER SET latin2 NOT NULL DEFAULT '', - `soundex(_latin2'ab')` varchar(4) CHARACTER SET latin2 NOT NULL DEFAULT '', - `substring(_latin2'ab',1)` varchar(2) CHARACTER SET latin2 NOT NULL DEFAULT '', - `insert(_latin2'abcd',2,3,_latin2'ef')` varchar(6) CHARACTER SET latin2 NOT NULL DEFAULT '', - `replace(_latin2'abcd',_latin2'b',_latin2'B')` varchar(4) CHARACTER SET latin2 NOT NULL DEFAULT '', - `encode('abcd','ab')` varbinary(4) NOT NULL DEFAULT '' + `hex(130)` varchar(6) NOT NULL, + `char(130)` varbinary(4) NOT NULL, + `format(130,10)` varchar(37) NOT NULL, + `left(_latin2'a',1)` varchar(1) CHARACTER SET latin2 NOT NULL, + `right(_latin2'a',1)` varchar(1) CHARACTER SET latin2 NOT NULL, + `lcase(_latin2'a')` varchar(1) CHARACTER SET latin2 NOT NULL, + `ucase(_latin2'a')` varchar(1) CHARACTER SET latin2 NOT NULL, + `substring(_latin2'a',1,1)` varchar(1) CHARACTER SET latin2 NOT NULL, + `concat(_latin2'a',_latin2'b')` varchar(2) CHARACTER SET latin2 NOT NULL, + `lpad(_latin2'a',4,_latin2'b')` varchar(4) CHARACTER SET latin2 NOT NULL, + `rpad(_latin2'a',4,_latin2'b')` varchar(4) CHARACTER SET latin2 NOT NULL, + `concat_ws(_latin2'a',_latin2'b')` varchar(1) CHARACTER SET latin2 NOT NULL, + `make_set(255,_latin2'a',_latin2'b',_latin2'c')` varchar(5) CHARACTER SET latin2 NOT NULL, + `export_set(255,_latin2'y',_latin2'n',_latin2' ')` varchar(127) CHARACTER SET latin2 NOT NULL, + `trim(_latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL, + `ltrim(_latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL, + `rtrim(_latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL, + `trim(LEADING _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL, + `trim(TRAILING _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL, + `trim(BOTH _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 NOT NULL, + `repeat(_latin2'a',10)` varchar(10) CHARACTER SET latin2 NOT NULL, + `reverse(_latin2'ab')` varchar(2) CHARACTER SET latin2 NOT NULL, + `quote(_latin2'ab')` varchar(6) CHARACTER SET latin2 NOT NULL, + `soundex(_latin2'ab')` varchar(4) CHARACTER SET latin2 NOT NULL, + `substring(_latin2'ab',1)` varchar(2) CHARACTER SET latin2 NOT NULL, + `insert(_latin2'abcd',2,3,_latin2'ef')` varchar(6) CHARACTER SET latin2 NOT NULL, + `replace(_latin2'abcd',_latin2'b',_latin2'B')` varchar(4) CHARACTER SET latin2 NOT NULL, + `encode('abcd','ab')` varbinary(4) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a char character set latin2); @@ -1156,6 +1160,8 @@ Warning 1292 Truncated incorrect DOUBLE value: 'notnumber' SELECT * FROM t1, t2 WHERE num=substring(str from 1 for 6); str num notnumber 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'notnum' DROP TABLE t1,t2; CREATE TABLE t1( id int(11) NOT NULL auto_increment, @@ -1348,6 +1354,8 @@ cast(rtrim(' 20.06 ') as decimal(19,2)) select cast(ltrim(' 20.06 ') as decimal(19,2)); cast(ltrim(' 20.06 ') as decimal(19,2)) 20.06 +Warnings: +Note 1292 Truncated incorrect DECIMAL value: '20.06 ' select cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2)); cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2)) 20.06 @@ -2845,7 +2853,7 @@ CREATE TABLE t1 AS SELECT format(123,2,'no_NO'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `format(123,2,'no_NO')` varchar(37) NOT NULL DEFAULT '' + `format(123,2,'no_NO')` varchar(37) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t1; format(123,2,'no_NO') @@ -2889,6 +2897,8 @@ NULL SELECT ((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1))); ((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1))) 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' SELECT ((0xf3) * (rpad(1.0,2048,1)) << (0xcc)); ((0xf3) * (rpad(1.0,2048,1)) << (0xcc)) 0 @@ -2909,7 +2919,7 @@ format(rpad('111111111.1', 1111111, '999999999999999999999999999999999999999999'),0,'be_BY') ; -DO +SELECT round( concat( ( coalesce( ( @@ -2924,9 +2934,14 @@ sha1('P'), ) ) ) -); +) AS r; +r +0 Warnings: +Warning 1292 Truncated incorrect INTEGER value: '511993d3c99719e38a6779073019dacd7178ddb9' Warning 1292 Truncated incorrect DECIMAL value: '[.DC2.]' +Warning 1292 Truncated incorrect INTEGER value: '511993d3c99719e38a6779073019dacd7178ddb9' +Warning 1292 Truncated incorrect DOUBLE value: '0.000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' SET @@global.max_allowed_packet:= @tmp_max; SELECT @tmp_max:= @@global.max_allowed_packet; @tmp_max:= @@global.max_allowed_packet @@ -2977,7 +2992,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',63)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(85) NOT NULL DEFAULT '' + `to_base64` varchar(85) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -2999,7 +3014,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',62)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(85) NOT NULL DEFAULT '' + `to_base64` varchar(85) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3021,7 +3036,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',61)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(85) NOT NULL DEFAULT '' + `to_base64` varchar(85) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3043,7 +3058,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',60)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(81) NOT NULL DEFAULT '' + `to_base64` varchar(81) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3065,7 +3080,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',59)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(81) NOT NULL DEFAULT '' + `to_base64` varchar(81) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3087,7 +3102,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',58)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(81) NOT NULL DEFAULT '' + `to_base64` varchar(81) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3109,7 +3124,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',57)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(76) NOT NULL DEFAULT '' + `to_base64` varchar(76) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3130,7 +3145,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',56)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(76) NOT NULL DEFAULT '' + `to_base64` varchar(76) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3151,7 +3166,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',55)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(76) NOT NULL DEFAULT '' + `to_base64` varchar(76) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3172,7 +3187,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',54)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(72) NOT NULL DEFAULT '' + `to_base64` varchar(72) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3193,7 +3208,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',53)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(72) NOT NULL DEFAULT '' + `to_base64` varchar(72) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3214,7 +3229,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',52)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(72) NOT NULL DEFAULT '' + `to_base64` varchar(72) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3235,7 +3250,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',51)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(68) NOT NULL DEFAULT '' + `to_base64` varchar(68) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3256,7 +3271,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',50)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(68) NOT NULL DEFAULT '' + `to_base64` varchar(68) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3277,7 +3292,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',49)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(68) NOT NULL DEFAULT '' + `to_base64` varchar(68) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3298,7 +3313,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',48)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(64) NOT NULL DEFAULT '' + `to_base64` varchar(64) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3319,7 +3334,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',47)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(64) NOT NULL DEFAULT '' + `to_base64` varchar(64) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3340,7 +3355,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',46)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(64) NOT NULL DEFAULT '' + `to_base64` varchar(64) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3361,7 +3376,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',45)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(60) NOT NULL DEFAULT '' + `to_base64` varchar(60) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3382,7 +3397,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',44)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(60) NOT NULL DEFAULT '' + `to_base64` varchar(60) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3403,7 +3418,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',43)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(60) NOT NULL DEFAULT '' + `to_base64` varchar(60) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3424,7 +3439,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',42)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(56) NOT NULL DEFAULT '' + `to_base64` varchar(56) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3445,7 +3460,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',41)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(56) NOT NULL DEFAULT '' + `to_base64` varchar(56) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3466,7 +3481,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',40)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(56) NOT NULL DEFAULT '' + `to_base64` varchar(56) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3487,7 +3502,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',39)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(52) NOT NULL DEFAULT '' + `to_base64` varchar(52) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3508,7 +3523,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',38)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(52) NOT NULL DEFAULT '' + `to_base64` varchar(52) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3529,7 +3544,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',37)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(52) NOT NULL DEFAULT '' + `to_base64` varchar(52) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3550,7 +3565,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',36)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(48) NOT NULL DEFAULT '' + `to_base64` varchar(48) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3571,7 +3586,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',35)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(48) NOT NULL DEFAULT '' + `to_base64` varchar(48) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3592,7 +3607,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',34)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(48) NOT NULL DEFAULT '' + `to_base64` varchar(48) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3613,7 +3628,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',33)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(44) NOT NULL DEFAULT '' + `to_base64` varchar(44) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3634,7 +3649,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',32)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(44) NOT NULL DEFAULT '' + `to_base64` varchar(44) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3655,7 +3670,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',31)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(44) NOT NULL DEFAULT '' + `to_base64` varchar(44) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3676,7 +3691,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',30)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(40) NOT NULL DEFAULT '' + `to_base64` varchar(40) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3697,7 +3712,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',29)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(40) NOT NULL DEFAULT '' + `to_base64` varchar(40) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3718,7 +3733,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',28)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(40) NOT NULL DEFAULT '' + `to_base64` varchar(40) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3739,7 +3754,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',27)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(36) NOT NULL DEFAULT '' + `to_base64` varchar(36) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3760,7 +3775,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',26)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(36) NOT NULL DEFAULT '' + `to_base64` varchar(36) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3781,7 +3796,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',25)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(36) NOT NULL DEFAULT '' + `to_base64` varchar(36) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3802,7 +3817,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',24)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(32) NOT NULL DEFAULT '' + `to_base64` varchar(32) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3823,7 +3838,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',23)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(32) NOT NULL DEFAULT '' + `to_base64` varchar(32) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3844,7 +3859,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',22)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(32) NOT NULL DEFAULT '' + `to_base64` varchar(32) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3865,7 +3880,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',21)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(28) NOT NULL DEFAULT '' + `to_base64` varchar(28) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3886,7 +3901,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',20)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(28) NOT NULL DEFAULT '' + `to_base64` varchar(28) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3907,7 +3922,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',19)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(28) NOT NULL DEFAULT '' + `to_base64` varchar(28) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3928,7 +3943,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',18)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(24) NOT NULL DEFAULT '' + `to_base64` varchar(24) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3949,7 +3964,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',17)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(24) NOT NULL DEFAULT '' + `to_base64` varchar(24) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3970,7 +3985,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',16)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(24) NOT NULL DEFAULT '' + `to_base64` varchar(24) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -3991,7 +4006,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',15)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(20) NOT NULL DEFAULT '' + `to_base64` varchar(20) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -4012,7 +4027,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',14)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(20) NOT NULL DEFAULT '' + `to_base64` varchar(20) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -4033,7 +4048,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',13)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(20) NOT NULL DEFAULT '' + `to_base64` varchar(20) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -4054,7 +4069,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',12)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(16) NOT NULL DEFAULT '' + `to_base64` varchar(16) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -4075,7 +4090,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',11)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(16) NOT NULL DEFAULT '' + `to_base64` varchar(16) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -4096,7 +4111,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',10)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(16) NOT NULL DEFAULT '' + `to_base64` varchar(16) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -4117,7 +4132,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',9)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(12) NOT NULL DEFAULT '' + `to_base64` varchar(12) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -4138,7 +4153,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',8)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(12) NOT NULL DEFAULT '' + `to_base64` varchar(12) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -4159,7 +4174,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',7)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(12) NOT NULL DEFAULT '' + `to_base64` varchar(12) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -4180,7 +4195,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',6)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(8) NOT NULL DEFAULT '' + `to_base64` varchar(8) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -4201,7 +4216,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',5)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(8) NOT NULL DEFAULT '' + `to_base64` varchar(8) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -4222,7 +4237,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',4)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(8) NOT NULL DEFAULT '' + `to_base64` varchar(8) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -4243,7 +4258,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',3)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(4) NOT NULL DEFAULT '' + `to_base64` varchar(4) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -4264,7 +4279,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',2)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(4) NOT NULL DEFAULT '' + `to_base64` varchar(4) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -4285,7 +4300,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',1)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` varchar(4) NOT NULL DEFAULT '' + `to_base64` varchar(4) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -4306,7 +4321,7 @@ CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',0)) AS to_base64; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `to_base64` char(0) NOT NULL DEFAULT '' + `to_base64` char(0) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT to_base64, LENGTH(to_base64) FROM t1; to_base64 LENGTH(to_base64) @@ -4527,6 +4542,45 @@ SET NAMES latin2; EXECUTE stmt; COLLATION(space(2)) latin2_general_ci +set global max_allowed_packet=default; # # End of 5.6 tests # +# +# Start of 10.1 tests +# +# +# MDEV-8369 Unexpected impossible WHERE for a condition on a ZEROFILL field +# +CREATE TABLE t1 (a BIGINT(20) ZEROFILL); +INSERT INTO t1 VALUES (18446744073709551615),(0); +SELECT * FROM t1 WHERE a=18446744073709551615; +a +18446744073709551615 +SELECT * FROM t1 WHERE FORMAT(a,0)='18,446,744,073,709,551,615'; +a +18446744073709551615 +SELECT * FROM t1 WHERE a=18446744073709551615 AND FORMAT(a,0)='18,446,744,073,709,551,615'; +a +18446744073709551615 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a=18446744073709551615 AND FORMAT(a,0)='18,446,744,073,709,551,615'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 18446744073709551615) and (format(`test`.`t1`.`a`,0) = '18,446,744,073,709,551,615')) +DROP TABLE t1; +# +# Bug#58081 Duplicate entry error when doing GROUP BY +# MDEV-9332 Bug after upgrade to 10.1.10 +# +SET NAMES latin1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0),(0),(1),(0),(0); +SELECT COUNT(*) FROM t1, t1 t2 GROUP BY INSERT('', t2.a, t1.a, @@global.max_binlog_size); +COUNT(*) +25 +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/func_system.result b/mysql-test/r/func_system.result index 1452cf7e533..2fc0a59f5d2 100644 --- a/mysql-test/r/func_system.result +++ b/mysql-test/r/func_system.result @@ -47,7 +47,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `database()` varchar(34) CHARACTER SET utf8 DEFAULT NULL, - `user()` varchar(141) CHARACTER SET utf8 NOT NULL DEFAULT '', + `user()` varchar(141) CHARACTER SET utf8 NOT NULL, `version` char(60) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; @@ -61,8 +61,8 @@ create table t1 select charset(_utf8'a'), collation(_utf8'a'); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `charset(_utf8'a')` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT '', - `collation(_utf8'a')` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT '' + `charset(_utf8'a')` varchar(64) CHARACTER SET utf8 NOT NULL, + `collation(_utf8'a')` varchar(64) CHARACTER SET utf8 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select TRUE,FALSE,NULL; diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result index 97ef61047a5..387b8545f59 100644 --- a/mysql-test/r/func_test.result +++ b/mysql-test/r/func_test.result @@ -337,3 +337,84 @@ Note 1003 select (strcmp('a','b') <> 0) AS `NOT NOT strcmp('a','b')` # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-8167 XOR returns bad results for an indexed column +# +CREATE TABLE t1 ( +id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, +k INTEGER UNSIGNED DEFAULT '0' NOT NULL, +c CHAR(120) DEFAULT '' NOT NULL, +pad CHAR(60) DEFAULT '' NOT NULL, +PRIMARY KEY (id) +) ENGINE=MyISAM; +INSERT INTO t1 (k, c, pad) VALUES (10, 'a', 'xxx'); +INSERT INTO t1 (k, c, pad) VALUES (11, 'a', 'xxx'); +INSERT INTO t1 (k, c, pad) VALUES (12, 'a', 'xxx'); +INSERT INTO t1 (k, c, pad) VALUES (13, 'a', 'xxx'); +INSERT INTO t1 (k, c, pad) VALUES (14, 'a', 'xxx'); +INSERT INTO t1 (k, c, pad) VALUES (15, 'a', 'xxx'); +INSERT INTO t1 (k, c, pad) VALUES (16, 'a', 'xxx'); +SELECT * FROM t1 WHERE id XOR 0; +id k c pad +1 10 a xxx +2 11 a xxx +3 12 a xxx +4 13 a xxx +5 14 a xxx +6 15 a xxx +7 16 a xxx +SELECT * FROM t1 IGNORE KEY(PRIMARY) WHERE id XOR 0; +id k c pad +1 10 a xxx +2 11 a xxx +3 12 a xxx +4 13 a xxx +5 14 a xxx +6 15 a xxx +7 16 a xxx +DROP TABLE t1; +# +# MDEV-8871 Wrong result for CREATE TABLE .. SELECT LEAST(unsigned_column,unsigned_column) +# +CREATE TABLE t1 (a INT,b INT UNSIGNED); +INSERT INTO t1 VALUES (-2147483648,4294967295); +SELECT a, b, LEAST(a,a), LEAST(b,b), LEAST(a,b), LEAST(b,a), GREATEST(a,b), GREATEST(b,a) FROM t1; +a -2147483648 +b 4294967295 +LEAST(a,a) -2147483648 +LEAST(b,b) 4294967295 +LEAST(a,b) -2147483648 +LEAST(b,a) -2147483648 +GREATEST(a,b) 4294967295 +GREATEST(b,a) 4294967295 +CREATE TABLE t2 AS +SELECT a, b, LEAST(a,a), LEAST(b,b), LEAST(a,b), LEAST(b,a), GREATEST(a,b), GREATEST(b,a) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL, + `b` int(10) unsigned DEFAULT NULL, + `LEAST(a,a)` int(11) DEFAULT NULL, + `LEAST(b,b)` int(10) unsigned DEFAULT NULL, + `LEAST(a,b)` decimal(10,0) DEFAULT NULL, + `LEAST(b,a)` decimal(10,0) DEFAULT NULL, + `GREATEST(a,b)` decimal(10,0) DEFAULT NULL, + `GREATEST(b,a)` decimal(10,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT * FROM t2; +a -2147483648 +b 4294967295 +LEAST(a,a) -2147483648 +LEAST(b,b) 4294967295 +LEAST(a,b) -2147483648 +LEAST(b,a) -2147483648 +GREATEST(a,b) 4294967295 +GREATEST(b,a) 4294967295 +DROP TABLE t2; +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 85ba5d73f36..ad51010de30 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -163,6 +163,8 @@ Saturday 5 select monthname("1972-03-04"),monthname("1972-03-04")+0; monthname("1972-03-04") monthname("1972-03-04")+0 March 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'March' select time_format(000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T'); time_format(000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T') date_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T') 00|12|0|12|00|AM|12:00:00 AM|00|00:00:00 00|12|0|12|00|AM|12:00:00 AM|00|00:00:00 @@ -872,7 +874,7 @@ explain extended select period_add("9602",-12),period_diff(199505,"9404"),from_d id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select period_add('9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,'9404') AS `period_diff(199505,"9404")`,from_days(to_days('960101')) AS `from_days(to_days("960101"))`,dayofmonth('1997-01-02') AS `dayofmonth("1997-01-02")`,month('1997-01-02') AS `month("1997-01-02")`,monthname('1972-03-04') AS `monthname("1972-03-04")`,dayofyear('0000-00-00') AS `dayofyear("0000-00-00")`,hour('1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute('23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week('1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek('2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year('98-02-03') AS `year("98-02-03")`,(weekday(curdate()) - weekday(now())) AS `weekday(curdate())-weekday(now())`,dayname('1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec('0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format('1997-01-02 03:04:05','%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp('1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,('1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,('1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,('1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from '1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,('1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)` +Note 1003 select period_add('9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,'9404') AS `period_diff(199505,"9404")`,from_days(to_days('960101')) AS `from_days(to_days("960101"))`,dayofmonth('1997-01-02') AS `dayofmonth("1997-01-02")`,month('1997-01-02') AS `month("1997-01-02")`,monthname('1972-03-04') AS `monthname("1972-03-04")`,dayofyear('0000-00-00') AS `dayofyear("0000-00-00")`,hour('1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute('23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week('1998-03-03',@@default_week_format) AS `WEEK("1998-03-03")`,yearweek('2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year('98-02-03') AS `year("98-02-03")`,(weekday(curdate()) - weekday(now())) AS `weekday(curdate())-weekday(now())`,dayname('1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec('0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format('1997-01-02 03:04:05','%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp('1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,('1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,('1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,('1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from '1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,('1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)` SET @TMP='2007-08-01 12:22:49'; CREATE TABLE t1 (d DATETIME); INSERT INTO t1 VALUES ('2007-08-01 12:22:59'); @@ -948,8 +950,8 @@ sec_to_time(1) + 0, from_unixtime(1) + 0; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `now() - now()` bigint(21) NOT NULL DEFAULT '0', - `curtime() - curtime()` bigint(12) NOT NULL DEFAULT '0', + `now() - now()` bigint(21) NOT NULL, + `curtime() - curtime()` bigint(12) NOT NULL, `sec_to_time(1) + 0` bigint(12) DEFAULT NULL, `from_unixtime(1) + 0` bigint(21) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -1714,14 +1716,19 @@ min(timestampadd(month, 1>'', from_days('%Z'))) NULL Warnings: Warning 1292 Truncated incorrect INTEGER value: '%Z' +Warning 1292 Truncated incorrect DOUBLE value: '' Warning 1292 Incorrect datetime value: '0000-00-00' +SET timestamp=UNIX_TIMESTAMP('2001-01-01 00:00:00'); create table t1(a time); insert into t1 values ('00:00:00'),('00:01:00'); select 1 from t1 where 1 < some (select cast(a as datetime) from t1); 1 1 1 +Warnings: +Warning 1292 Incorrect datetime value: '1' drop table t1; +SET timestamp=DEFAULT; # # Bug #21564557: INCONSISTENT OUTPUT FROM 5.5 AND 5.6 # UNIX_TIMESTAMP(STR_TO_DATE('201506', "%Y%M" @@ -1739,6 +1746,8 @@ Warning 1292 Incorrect datetime value: '2015-06-00' SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s')); UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s')) NULL +Warnings: +Warning 1411 Incorrect datetime value: '0000-00-00 10:30:30' for function str_to_date set sql_mode= 'TRADITIONAL'; SELECT @@sql_mode; @@sql_mode @@ -1860,8 +1869,6 @@ create table t1 (f1 datetime, key (f1)); insert into t1 values ('2000-09-12 00:00:00'), ('2007-04-25 05:08:49'); select * from t1 where f1 > time('-23:00:06'); f1 -2000-09-12 00:00:00 -2007-04-25 05:08:49 drop table t1; select maketime(20,61,10)+0; maketime(20,61,10)+0 @@ -1872,25 +1879,14 @@ select last_day(f2) from t1; last_day(f2) NULL NULL -Warnings: -Warning 1292 Incorrect datetime value: '0' -Warning 1292 Incorrect datetime value: '0' select last_day(f2) from t1 where last_day(f2) is null; last_day(f2) NULL NULL -Warnings: -Warning 1292 Incorrect datetime value: '0' -Warning 1292 Incorrect datetime value: '0' -Warning 1292 Incorrect datetime value: '0' -Warning 1292 Incorrect datetime value: '0' select * from t1 order by last_day (f2); f2 0 0 -Warnings: -Warning 1292 Incorrect datetime value: '0' -Warning 1292 Incorrect datetime value: '0' drop table t1; SET timestamp=unix_timestamp('2001-02-03 10:20:30'); select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow'); @@ -1946,8 +1942,6 @@ insert ignore t1 values ('04:38:11','0000-00-00 00:00:00',0,'0000-00-00 00:00:00 select least(greatest(f3, f2, f4), f5) from t1; least(greatest(f3, f2, f4), f5) 0000-00-00 00:00:00 -Warnings: -Warning 1292 Incorrect datetime value: '0' drop table t1; select day(coalesce(null)); day(coalesce(null)) @@ -1964,16 +1958,19 @@ drop table t1; SET timestamp=UNIX_TIMESTAMP('2014-06-01 10:20:30'); select greatest(cast("0-0-0" as date), cast("10:20:05" as time)); greatest(cast("0-0-0" as date), cast("10:20:05" as time)) -2014-06-01 +2014-06-01 10:20:05 select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00'; greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00' 0 select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01'; greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01' +0 +select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01 10:20:05'; +greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01 10:20:05' 1 select cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6)); cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6)) -2014-06-01 00:00:00.000000 +2014-06-01 10:20:05.000000 SET timestamp=DEFAULT; select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010'); microsecond('12:00:00.123456') microsecond('2009-12-31 23:59:59.000010') @@ -2017,6 +2014,9 @@ SELECT * FROM t1 GROUP BY SEC_TO_TIME(concat(a,'10'))*1; a 2000-02-23 2005-05-04 +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410' +Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310' DROP TABLE t1; CREATE TABLE t1 (a DATE) ENGINE=MyISAM; INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23'); @@ -2066,22 +2066,37 @@ SELECT * FROM t1 GROUP BY FROM_UNIXTIME(concat(a,'10'))*1; a 2000-02-23 2005-05-04 +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410' +Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310' SELECT * FROM t1 GROUP BY (-FROM_UNIXTIME(concat(a,'10')))*1; a 2005-05-04 2000-02-23 +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410' +Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310' SELECT * FROM t1 GROUP BY (-FROM_UNIXTIME(concat(a,'10'))); a 2005-05-04 2000-02-23 +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410' +Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310' SELECT * FROM t1 GROUP BY ABS(FROM_UNIXTIME(concat(a,'10'))); a 2000-02-23 2005-05-04 +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410' +Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310' SELECT * FROM t1 GROUP BY @a:=(FROM_UNIXTIME(concat(a,'10'))*1); a 2000-02-23 2005-05-04 +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410' +Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310' DROP TABLE t1; SET TIME_ZONE='+02:00'; # @@ -2093,10 +2108,18 @@ SELECT a, FROM_UNIXTIME(CONCAT(a,'10')) AS f1, FROM_UNIXTIME(CONCAT(a,'10'))+0 A a f1 f2 2005-05-04 1970-01-01 02:33:25 19700101023325.000000 2000-02-23 1970-01-01 02:33:20 19700101023320.000000 +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410' +Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410' +Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310' +Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310' SELECT * FROM t1 GROUP BY FROM_UNIXTIME(CONCAT(a,'10'))+0; a 2000-02-23 2005-05-04 +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410' +Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310' DROP TABLE t1; CREATE TABLE t1 (a DATE) ENGINE=MyISAM; INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23'); @@ -2104,16 +2127,28 @@ SELECT * FROM t1 GROUP BY FROM_UNIXTIME(concat(a,'10'))/1; a 2000-02-23 2005-05-04 +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410' +Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310' DROP TABLE t1; CREATE TABLE t1 (a DATE); INSERT INTO t1 VALUES ('2005-05-04'); SELECT CONCAT(FROM_UNIXTIME(CONCAT(a,'10')) MOD FROM_UNIXTIME(CONCAT(a,'10'))) AS f2 FROM t1; f2 0.000000 +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410' +Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410' SELECT CHAR_LENGTH(CONCAT(FROM_UNIXTIME(CONCAT(a,'10')) MOD FROM_UNIXTIME(CONCAT(a,'10')))) AS f2 FROM t1; f2 8 +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410' +Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410' CREATE TABLE t2 AS SELECT CONCAT(FROM_UNIXTIME(CONCAT(a,'10')) MOD FROM_UNIXTIME(CONCAT(a,'10'))) AS f2 FROM t1; +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410' +Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410' SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -2570,18 +2605,12 @@ CREATE TABLE t1 (t TIME); INSERT INTO t1 VALUES ('03:22:30'),('18:30:05'); SELECT CONVERT_TZ(GREATEST(t, CURRENT_DATE()), '+02:00', '+10:00') FROM t1; CONVERT_TZ(GREATEST(t, CURRENT_DATE()), '+02:00', '+10:00') -2014-02-26 06:59:59 -2014-02-26 06:59:59 -Warnings: -Warning 1292 Truncated incorrect time value: '1296:00:00' -Warning 1292 Truncated incorrect time value: '1296:00:00' +2014-01-22 11:22:30 +2014-01-23 02:30:05 SELECT GREATEST(t, CURRENT_DATE()) FROM t1; GREATEST(t, CURRENT_DATE()) -838:59:59 -838:59:59 -Warnings: -Warning 1292 Truncated incorrect time value: '1296:00:00' -Warning 1292 Truncated incorrect time value: '1296:00:00' +2014-01-22 03:22:30 +2014-01-22 18:30:05 DROP TABLE t1; SET TIMESTAMP=DEFAULT; # @@ -2702,18 +2731,15 @@ SET timestamp=DEFAULT; # # MDEV-5750 Assertion `ltime->year == 0' fails on a query with EXTRACT DAY_MINUTE and TIME column # +SET timestamp=UNIX_TIMESTAMP('2010-01-01 00:00:00'); CREATE TABLE t1 ( d DATE, t TIME ); INSERT INTO t1 VALUES ('2008-12-05','22:34:09'),('2005-03-27','14:26:02'); SELECT EXTRACT(DAY_MINUTE FROM GREATEST(t,d)), GREATEST(t,d) FROM t1; EXTRACT(DAY_MINUTE FROM GREATEST(t,d)) GREATEST(t,d) -342259 838:59:59 -342259 838:59:59 -Warnings: -Warning 1292 Truncated incorrect time value: '9336:00:00' -Warning 1292 Truncated incorrect time value: '9336:00:00' -Warning 1292 Truncated incorrect time value: '2952:00:00' -Warning 1292 Truncated incorrect time value: '2952:00:00' +12234 2010-01-01 22:34:09 +11426 2010-01-01 14:26:02 DROP TABLE t1; +SET timestamp=DEFAULT; # # MDEV-7221 from_days fails after null value # diff --git a/mysql-test/r/func_time_hires.result b/mysql-test/r/func_time_hires.result index 62004687c22..baa53b11fd6 100644 --- a/mysql-test/r/func_time_hires.result +++ b/mysql-test/r/func_time_hires.result @@ -39,14 +39,14 @@ t1 CREATE TABLE `t1` ( `sec_to_time(12345)` time DEFAULT NULL, `sec_to_time(12345.6789)` time(4) DEFAULT NULL, `sec_to_time(1234567e-2)` time(6) DEFAULT NULL, - `now()` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `curtime(0)` time NOT NULL DEFAULT '00:00:00', - `utc_timestamp(1)` datetime(1) NOT NULL DEFAULT '0000-00-00 00:00:00.0', - `utc_time(2)` time(2) NOT NULL DEFAULT '00:00:00.00', - `current_time(3)` time(3) NOT NULL DEFAULT '00:00:00.000', - `current_timestamp(4)` datetime(4) NOT NULL DEFAULT '0000-00-00 00:00:00.0000', - `localtime(5)` datetime(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000', - `localtimestamp(6)` datetime(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', + `now()` datetime NOT NULL, + `curtime(0)` time NOT NULL, + `utc_timestamp(1)` datetime(1) NOT NULL, + `utc_time(2)` time(2) NOT NULL, + `current_time(3)` time(3) NOT NULL, + `current_timestamp(4)` datetime(4) NOT NULL, + `localtime(5)` datetime(5) NOT NULL, + `localtimestamp(6)` datetime(6) NOT NULL, `time_to_sec(123456)` bigint(17) DEFAULT NULL, `time_to_sec('12:34:56.789')` decimal(19,3) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 diff --git a/mysql-test/r/func_weight_string.result b/mysql-test/r/func_weight_string.result index 91ca9f68076..e63ee4267ea 100644 --- a/mysql-test/r/func_weight_string.result +++ b/mysql-test/r/func_weight_string.result @@ -1,4 +1,5 @@ drop table if exists t1; +set global max_allowed_packet=1048576; set names latin1; select hex(weight_string(0x010203)); hex(weight_string(0x010203)) @@ -90,3 +91,52 @@ NULL Warnings: Warning 1301 Result of cast_as_binary() was larger than max_allowed_packet (1048576) - truncated Warning 1301 Result of weight_string() was larger than max_allowed_packet (1048576) - truncated +set global max_allowed_packet=default; +# +# Start of 10.1 tests +# +# +# MDEV-8369 Unexpected impossible WHERE for a condition on a ZEROFILL field +# +CREATE TABLE t1 (a INT(6) ZEROFILL); +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM t1 WHERE a=1; +a +000001 +SELECT * FROM t1 WHERE WEIGHT_STRING(a) IS NULL; +a +000001 +000002 +SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL; +a +000001 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and isnull(weight_string(`test`.`t1`.`a`))) +ALTER TABLE t1 MODIFY a DOUBLE ZEROFILL; +SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL; +a +0000000000000000000001 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and isnull(weight_string(`test`.`t1`.`a`))) +ALTER TABLE t1 MODIFY a DECIMAL(10,1) ZEROFILL; +SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL; +a +000000001.0 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and isnull(weight_string(`test`.`t1`.`a`))) +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/gis-alter_table_online.result b/mysql-test/r/gis-alter_table_online.result new file mode 100644 index 00000000000..ea7ab3b66bd --- /dev/null +++ b/mysql-test/r/gis-alter_table_online.result @@ -0,0 +1,51 @@ +# +# Start of 10.1 tests +# +# +# MDEV-8948 ALTER ... INPLACE does work for BINARY, BLOB +# +CREATE TABLE t1 (a TINYBLOB); +ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMBLOB); +ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a BLOB); +ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a LONGBLOB); +ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY); +ALTER TABLE t1 MODIFY a TINYBLOB, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY); +ALTER TABLE t1 MODIFY a MEDIUMBLOB, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY); +ALTER TABLE t1 MODIFY a BLOB, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY); +ALTER TABLE t1 MODIFY a LONGBLOB, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY); +ALTER TABLE t1 MODIFY a POLYGON, ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY. +DROP TABLE t1; +CREATE TABLE t1 (a POLYGON); +ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE; +DROP TABLE t1; +CREATE TABLE t1 (a POLYGON); +ALTER TABLE t1 MODIFY a POLYGON, ALGORITHM=INPLACE; +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/gis-debug.result b/mysql-test/r/gis-debug.result index 8593f434c2b..5e8b4747f6d 100644 --- a/mysql-test/r/gis-debug.result +++ b/mysql-test/r/gis-debug.result @@ -267,6 +267,8 @@ POLYGON # Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER # DO ST_BUFFER(ST_GEOMCOLLFROMTEXT('linestring(1 1,2 2)'),''); +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' SELECT ST_WITHIN( LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '), ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) '), diff --git a/mysql-test/r/gis-precise.result b/mysql-test/r/gis-precise.result index c0b8b85d216..3824ba6afbb 100644 --- a/mysql-test/r/gis-precise.result +++ b/mysql-test/r/gis-precise.result @@ -175,7 +175,7 @@ st_touches(geomfromtext('point(0 0)'), geomfromtext('point(1 1)')) 0 select st_touches(geomfromtext('point(1 1)'), geomfromtext('point(1 1)')); st_touches(geomfromtext('point(1 1)'), geomfromtext('point(1 1)')) -1 +0 select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 1)')); st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 1)')) 1 @@ -187,7 +187,7 @@ st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 0 select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1.2, 1 0, 2 0, 1 1.2))')); st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1.2, 1 0, 2 0, 1 1.2))')) -1 +0 select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1, 1 0, 2 0, 1 1))')); st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1, 1 0, 2 0, 1 1))')) 1 @@ -477,6 +477,15 @@ ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 -3.0, select astext(buffer(st_linestringfromwkb(linestring(point(-1,1), point(-1,-2))),-1)); astext(buffer(st_linestringfromwkb(linestring(point(-1,1), point(-1,-2))),-1)) GEOMETRYCOLLECTION EMPTY +select ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)')); +ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)')) +1 +select ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)')); +ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)')) +1 +select ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)')); +ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)')) +0 DROP TABLE IF EXISTS p1; CREATE PROCEDURE p1(dist DOUBLE, geom TEXT) BEGIN @@ -745,6 +754,8 @@ POLYGON # Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER # DO ST_BUFFER(ST_GEOMCOLLFROMTEXT('linestring(1 1,2 2)'),''); +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' SELECT ST_WITHIN( LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '), ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) '), diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result index c400ebb39ef..0506a0b2a0a 100644 --- a/mysql-test/r/gis-rtree.result +++ b/mysql-test/r/gis-rtree.result @@ -1596,3 +1596,51 @@ SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)' COUNT(*) 1 DROP TABLE t1; +# +# Start of 10.1 tests +# +# +# MDEV-8239 Reverse spatial operations OP(const, field) do not get optimized +# +CREATE TABLE t1 (a GEOMETRY NOT NULL, SPATIAL KEY(a)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (Point(1,2)),(Point(1,3)); +EXPLAIN SELECT * FROM t1 WHERE MBRINTERSECTS(a,Point(1,2)); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 34 NULL 1 Using where +EXPLAIN SELECT * FROM t1 WHERE ST_INTERSECTS(a,Point(1,2)); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 34 NULL 1 Using where +EXPLAIN SELECT * FROM t1 WHERE MBRINTERSECTS(Point(1,2),a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 34 NULL 1 Using where +EXPLAIN SELECT * FROM t1 WHERE ST_INTERSECTS(Point(1,2),a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 34 NULL 1 Using where +DROP TABLE t1; +# +# MDEV-8610 "WHERE CONTAINS(indexed_geometry_column,1)" causes full table scan +# +CREATE TABLE t1 (a GEOMETRY NOT NULL, SPATIAL KEY(a)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (Point(1,1)),(Point(2,2)),(Point(3,3)); +EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,1.0); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,1e0); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,TIME'00:00:00'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,DATE'2001-01-01'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,TIMESTAMP'2001-01-01 00:00:00'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 174088bf944..33080509114 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -1,5 +1,3 @@ -DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; -DROP VIEW IF EXISTS v1; CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT); CREATE TABLE gis_line (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING); CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON); @@ -405,12 +403,12 @@ Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; first second w c o e d t i r -120 120 1 1 0 1 0 1 1 0 +120 120 1 1 0 1 0 0 1 0 120 121 0 0 1 0 0 0 1 0 120 122 NULL NULL NULL NULL NULL NULL NULL NULL 120 123 NULL NULL NULL NULL NULL NULL NULL NULL 121 120 0 0 1 0 0 0 1 0 -121 121 1 1 0 1 0 1 1 0 +121 121 1 1 0 1 0 0 1 0 121 122 NULL NULL NULL NULL NULL NULL NULL NULL 121 123 NULL NULL NULL NULL NULL NULL NULL NULL 122 120 NULL NULL NULL NULL NULL NULL NULL NULL @@ -811,7 +809,7 @@ drop procedure if exists fn3; create function fn3 () returns point deterministic return GeomFromText("point(1 1)"); show create function fn3; Function sql_mode Create Function character_set_client collation_connection Database Collation -fn3 CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS point +fn3 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS point DETERMINISTIC return GeomFromText("point(1 1)") latin1 latin1_swedish_ci latin1_swedish_ci select astext(fn3()); @@ -879,7 +877,7 @@ mbroverlaps down,left,right,up SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; mbrtouches -big,center,down,down2,left,left2,right,right2,small,up,up2 +down2,left2,right2,up2 SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; mbrwithin big,center @@ -900,7 +898,7 @@ overlaps down,left,right,up SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; touches -big,center,down,down2,left,left2,right,right2,small,up,up2 +down2,left2,right2,up2 SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; within big,center @@ -1113,7 +1111,7 @@ DROP TABLE t0, t1, t2; # SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))); ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))) -NULL +-1 # # BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN # GEOMETRY FUNCTION ARGUMENTS @@ -1327,6 +1325,18 @@ WHERE name = 'Route 5' AND aliases = 'Main Street'; IsEmpty(centerline) 0 +# Conformance Item T12 +SELECT IsSimple(shore) +FROM lakes +WHERE name = 'Blue Lake'; +IsSimple(shore) +1 +# Conformance Item T13 +SELECT AsText(ST_Boundary(boundary)) +FROM named_places +WHERE name = 'Goose Island'; +AsText(ST_Boundary(boundary)) +LINESTRING(67 13,67 18,59 18,59 13,67 13) # Conformance Item T14 SELECT AsText(Envelope(boundary)) FROM named_places @@ -1357,6 +1367,17 @@ FROM road_segments WHERE fid = 102; AsText(EndPoint(centerline)) POINT(44 31) +SELECT IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) +FROM named_places +WHERE name = 'Goose Island'; +IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) +1 +# Conformance Item T20 +SELECT IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) +FROM named_places +WHERE name = 'Goose Island'; +IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) +1 # Conformance Item T21 SELECT GLength(centerline) FROM road_segments @@ -1381,6 +1402,11 @@ FROM named_places WHERE name = 'Goose Island'; AsText(Centroid(boundary)) POINT(63 15.5) +SELECT ST_Contains(boundary, PointOnSurface(boundary)) +FROM named_places +WHERE name = 'Goose Island'; +ST_Contains(boundary, PointOnSurface(boundary)) +1 # Conformance Item T26 SELECT Area(boundary) FROM named_places @@ -1435,6 +1461,12 @@ FROM ponds WHERE fid = 120; AsText(Centroid(shores)) POINT(25 42) +# Conformance Item T35 +SELECT Contains(shores, PointOnSurface(shores)) +FROM ponds +WHERE fid = 120; +Contains(shores, PointOnSurface(shores)) +1 # Conformance Item T36 SELECT Area(shores) FROM ponds @@ -1463,6 +1495,20 @@ WHERE streams.name = 'Cam Stream' AND lakes.name = 'Blue Lake'; ST_Touches(centerline, shore) 1 +# Conformance Item T40 +SELECT ST_Within(footprint, boundary) +FROM named_places, buildings +WHERE named_places.name = 'Ashton' +AND buildings.address = '215 Main Street'; +ST_Within(footprint, boundary) +1 +# Conformance Item T41 +SELECT ST_Overlaps(forests.boundary, named_places.boundary) +FROM forests, named_places +WHERE forests.name = 'Green Forest' +AND named_places.name = 'Ashton'; +ST_Overlaps(forests.boundary, named_places.boundary) +1 # Conformance Item T42 SELECT Crosses(road_segments.centerline, divided_routes.centerlines) FROM road_segments, divided_routes @@ -1484,6 +1530,13 @@ WHERE forests.name = 'Green Forest' AND named_places.name = 'Ashton'; ST_Contains(forests.boundary, named_places.boundary) 0 +# Conformance Item T45 +SELECT ST_Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT') +FROM forests, named_places +WHERE forests.name = 'Green Forest' +AND named_places.name = 'Ashton'; +ST_Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT') +1 # Conformance Item T46 SELECT ST_Distance(position, boundary) FROM bridges, named_places @@ -1491,6 +1544,13 @@ WHERE bridges.name = 'Cam Bridge' AND named_places.name = 'Ashton'; ST_Distance(position, boundary) 12 +# Conformance Item T47 +SELECT AsText(ST_Intersection(centerline, shore)) +FROM streams, lakes +WHERE streams.name = 'Cam Stream' +AND lakes.name = 'Blue Lake'; +AsText(ST_Intersection(centerline, shore)) +POINT(52 18) # Conformance Item T48 SELECT AsText(ST_Difference(named_places.boundary, forests.boundary)) FROM named_places, forests @@ -1517,6 +1577,12 @@ FROM buildings, bridges WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1; count(*) 1 +# Conformance Item T52 +SELECT AsText(ConvexHull(shore)) +FROM lakes +WHERE lakes.name = 'Blue Lake'; +AsText(ConvexHull(shore)) +POLYGON((48 6,52 18,66 23,73 9,48 6)) DROP DATABASE gis_ogs; USE test; # @@ -1552,11 +1618,16 @@ insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)")); select equals(`a`,convert(`a` using utf8)) from `t1`; equals(`a`,convert(`a` using utf8)) 1 +0 +0 +Warnings: +Warning 1300 Invalid utf8 character string: '\xE0C' +Warning 1300 Invalid utf8 character string: '\xE0C' +select equals(`a`,left(`a`,23)) from `t1`; +equals(`a`,left(`a`,23)) +NULL NULL NULL -Warnings: -Warning 1300 Invalid utf8 character string: 'E043' -Warning 1300 Invalid utf8 character string: 'E043' drop table t1; # # MDEV-6883 ST_WITHIN crashes server if (0,0) is matched to POLYGON((0 0)) @@ -1590,6 +1661,9 @@ INSERT INTO g1 VALUES ('a'),('a'); SELECT 1 FROM g1 WHERE a >= ANY (SELECT 1 FROM g1 WHERE a = geomfromtext('') OR a) ; 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'a' DROP TABLE g1; # # Bug#16451878 GEOMETRY QUERY CRASHES SERVER @@ -1630,3 +1704,130 @@ SELECT ASTEXT(p) FROM v1; ASTEXT(p) POINT(1 1) DROP VIEW v1; +End of 5.5 tests +SHOW CREATE TABLE information_schema.geometry_columns; +Table Create Table +GEOMETRY_COLUMNS CREATE TEMPORARY TABLE `GEOMETRY_COLUMNS` ( + `F_TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', + `F_TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', + `F_TABLE_NAME` varchar(64) NOT NULL DEFAULT '', + `F_GEOMETRY_COLUMN` varchar(64) NOT NULL DEFAULT '', + `G_TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', + `G_TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', + `G_TABLE_NAME` varchar(64) NOT NULL DEFAULT '', + `G_GEOMETRY_COLUMN` varchar(64) NOT NULL DEFAULT '', + `STORAGE_TYPE` tinyint(2) NOT NULL DEFAULT '0', + `GEOMETRY_TYPE` int(7) NOT NULL DEFAULT '0', + `COORD_DIMENSION` tinyint(2) NOT NULL DEFAULT '0', + `MAX_PPR` tinyint(2) NOT NULL DEFAULT '0', + `SRID` smallint(5) NOT NULL DEFAULT '0' +) ENGINE=MEMORY DEFAULT CHARSET=utf8 +SHOW CREATE TABLE information_schema.spatial_ref_sys; +Table Create Table +SPATIAL_REF_SYS CREATE TEMPORARY TABLE `SPATIAL_REF_SYS` ( + `SRID` smallint(5) NOT NULL DEFAULT '0', + `AUTH_NAME` varchar(512) NOT NULL DEFAULT '', + `AUTH_SRID` int(5) NOT NULL DEFAULT '0', + `SRTEXT` varchar(2048) NOT NULL DEFAULT '' +) ENGINE=MEMORY DEFAULT CHARSET=utf8 +create table t1(g GEOMETRY, pt POINT); +create table t2(g LINESTRING, pl POLYGON); +select * from information_schema.geometry_columns; +F_TABLE_CATALOG F_TABLE_SCHEMA F_TABLE_NAME F_GEOMETRY_COLUMN G_TABLE_CATALOG G_TABLE_SCHEMA G_TABLE_NAME G_GEOMETRY_COLUMN STORAGE_TYPE GEOMETRY_TYPE COORD_DIMENSION MAX_PPR SRID +def test t1 def test t1 g 1 0 2 0 0 +def test t1 def test t1 pt 1 1 2 0 0 +def test t2 def test t2 g 1 2 2 0 0 +def test t2 def test t2 pl 1 3 2 0 0 +drop table t1, t2; +10.1 tests +create table t1(g GEOMETRY(9,4) REF_SYSTEM_ID=101, pt POINT(8,2), pg GEOMETRY REF_SYSTEM_ID=102); +SELECT SRID from information_schema.geometry_columns WHERE G_TABLE_NAME='t1'; +SRID +101 +0 +102 +drop table t1; +# Expect an int(1) column to be created +CREATE TABLE t1 AS SELECT CONTAINS(NULL, NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `CONTAINS(NULL, NULL)` int(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# MDEV-7334 valgrind warning "unitialized bytes" in 10.1. +# +CREATE TABLE t1 ( +gp point, +ln linestring, +pg polygon, +mp multipoint, +mln multilinestring, +mpg multipolygon, +gc geometrycollection, +gm geometry +); +ALTER TABLE t1 ADD fid INT NOT NULL; +select SRID from information_schema.geometry_columns where F_TABLE_NAME='t1'; +SRID +0 +0 +0 +0 +0 +0 +0 +0 +drop table t1; +# +# MDEV-7510 GIS: IsRing returns false for a primitive triangle. +# +select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,0 0)')); +ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,0 0)')) +1 +select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)')); +ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)')) +0 +# +# MDEV-7514 GIS: PointOnSurface returns NULL instead of the point. +# +SELECT ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))'))); +ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))'))) +NULL +# +# MDEV-7529 GIS: ST_Relate returns unexpected results for POINT relations +# +select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*F**FFF*') AS equals; +equals +1 +select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*****FF*') AS contains; +contains +1 +select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*F**F***') AS within; +within +1 +select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(1 1)'),'FF*FF****') as disjoint; +disjoint +1 +select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'FF*FF****') as disjoint; +disjoint +0 +# +# MDEV-7528 GIS: Functions return NULL instead of specified -1 for NULL arguments. +# +select ST_IsRing(NULL); +ST_IsRing(NULL) +-1 +# +# MDEV-8675 Different results of GIS functions on NULL vs NOT NULL columns +# +CREATE TABLE t1 (g1 GEOMETRY NOT NULL,g2 GEOMETRY NULL); +CREATE TABLE t2 AS SELECT WITHIN(g1,g1) as w1,WITHIN(g2,g2) AS w2 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `w1` int(1) DEFAULT NULL, + `w2` int(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1,t2; diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 3194573e2ef..3020c7deba7 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -1,3 +1,5 @@ +set GLOBAL sql_mode=""; +set LOCAL sql_mode=""; SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; drop table if exists t1; @@ -57,6 +59,8 @@ plugin authentication_string password_expired N is_role N +default_role +max_statement_time 0.000000 show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA' @@ -84,7 +88,7 @@ delete from mysql.user where user='mysqltest_1'; flush privileges; delete from mysql.user where user='mysqltest_1'; flush privileges; -grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 10; +grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 10 max_statement_time 60; select * from mysql.user where user="mysqltest_1"; Host localhost User mysqltest_1 @@ -130,10 +134,12 @@ plugin authentication_string password_expired N is_role N +default_role +max_statement_time 60.000000 show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost -GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 -grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 20 max_connections_per_hour 30; +GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 MAX_STATEMENT_TIME 60.000000 +grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 20 max_connections_per_hour 30 max_statement_time 0; select * from mysql.user where user="mysqltest_1"; Host localhost User mysqltest_1 @@ -179,6 +185,8 @@ plugin authentication_string password_expired N is_role N +default_role +max_statement_time 0.000000 show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 MAX_UPDATES_PER_HOUR 20 MAX_CONNECTIONS_PER_HOUR 30 @@ -2574,3 +2582,4 @@ Grants for mysqltest_u1@% GRANT USAGE ON *.* TO 'mysqltest_u1'@'%' drop database mysqltest_db1; drop user mysqltest_u1; +set GLOBAL sql_mode=default; diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result index 3df9a5480d3..bd14f21010b 100644 --- a/mysql-test/r/grant2.result +++ b/mysql-test/r/grant2.result @@ -1,3 +1,5 @@ +set GLOBAL sql_mode=""; +set LOCAL sql_mode=""; SET NAMES binary; drop database if exists mysqltest; drop database if exists mysqltest_1; @@ -335,7 +337,7 @@ delete from mysql.user where user like 'mysqltest\_1'; flush privileges; drop database mysqltest_1; set password = password("changed"); -ERROR 42000: You are using MariaDB as an anonymous user and anonymous users are not allowed to change passwords +ERROR 42000: You are using MariaDB as an anonymous user and anonymous users are not allowed to modify user settings lock table mysql.user write; flush privileges; grant all on *.* to 'mysqltest_1'@'localhost'; @@ -845,3 +847,4 @@ DROP USER mysqltest_u2@localhost; DROP USER mysqltest_u3@localhost; DROP USER mysqltest_u4@localhost; DROP USER mysqltest_u5@localhost; +set GLOBAL sql_mode=default; diff --git a/mysql-test/r/grant3.result b/mysql-test/r/grant3.result index fd51a83d4b2..d1722fc8ea9 100644 --- a/mysql-test/r/grant3.result +++ b/mysql-test/r/grant3.result @@ -1,3 +1,5 @@ +set global sql_mode=""; +set local sql_mode=""; SET NAMES binary; drop table if exists t1; delete from mysql.user where user like 'mysqltest\_%'; @@ -177,4 +179,5 @@ SELECT b FROM temp.t1; ERROR 42000: SELECT command denied to user 'user2'@'localhost' for column 'b' in table 't1' DROP USER 'user2'@'%'; DROP DATABASE temp; +set global sql_mode=default; End of 5.0 tests diff --git a/mysql-test/r/grant4.result b/mysql-test/r/grant4.result index 60617acbd1f..5a0032cd338 100644 --- a/mysql-test/r/grant4.result +++ b/mysql-test/r/grant4.result @@ -1,4 +1,6 @@ drop database if exists mysqltest_db1; +set GLOBAL sql_mode=""; +set LOCAL sql_mode=""; create database mysqltest_db1; use mysqltest_db1; create table t_column_priv_only (a int, b int); @@ -178,3 +180,38 @@ mysqltest_db1.t1 repair status OK # Switching to connection 'default'. drop database mysqltest_db1; drop user mysqltest_u1@localhost; +create user foo1 identified by password '11111111111111111111111111111111111111111'; +create user foo2 identified by password '2222222222222222'; +create user foo3 identified via mysql_native_password using '11111111111111111111111111111111111111111'; +create user foo4 identified via mysql_old_password using '2222222222222222'; +grant select on test.* to foo5 identified by password '11111111111111111111111111111111111111111'; +grant select on test.* to foo6 identified by password '2222222222222222'; +grant select on test.* to foo7 identified via mysql_native_password using '11111111111111111111111111111111111111111'; +grant select on test.* to foo8 identified via mysql_old_password using '2222222222222222'; +select user,password,plugin,authentication_string from mysql.user where user like 'foo%'; +user password plugin authentication_string +foo1 11111111111111111111111111111111111111111 +foo2 2222222222222222 +foo3 11111111111111111111111111111111111111111 +foo4 2222222222222222 +foo5 11111111111111111111111111111111111111111 +foo6 2222222222222222 +foo7 11111111111111111111111111111111111111111 +foo8 2222222222222222 +drop user foo1; +drop user foo2; +drop user foo3; +drop user foo4; +drop user foo5; +drop user foo6; +drop user foo7; +drop user foo8; +create user foo1 identified via mysql_native_password using '00'; +ERROR HY000: Password hash should be a 41-digit hexadecimal number +create user foo2 identified via mysql_native_password using '2222222222222222'; +ERROR HY000: Password hash should be a 41-digit hexadecimal number +create user foo3 identified via mysql_old_password using '00'; +ERROR HY000: Password hash should be a 16-digit hexadecimal number +create user foo4 identified via mysql_old_password using '11111111111111111111111111111111111111111'; +ERROR HY000: Password hash should be a 16-digit hexadecimal number +set GLOBAL sql_mode=default; diff --git a/mysql-test/r/grant_4332.result b/mysql-test/r/grant_4332.result index 5a475bed6d8..93c0a24d164 100644 --- a/mysql-test/r/grant_4332.result +++ b/mysql-test/r/grant_4332.result @@ -1,3 +1,5 @@ +set GLOBAL sql_mode=""; +set LOCAL sql_mode=""; alter table mysql.user modify User char(16) binary not null default ''; alter table mysql.db modify User char(16) binary not null default ''; alter table mysql.tables_priv modify User char(16) binary not null default ''; @@ -30,3 +32,4 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def user() 253 141 14 N 1 31 8 user() root@localhost +set GLOBAL sql_mode=default; diff --git a/mysql-test/r/grant_cache_no_prot.result b/mysql-test/r/grant_cache_no_prot.result index 777eb10cda6..34abd96f026 100644 --- a/mysql-test/r/grant_cache_no_prot.result +++ b/mysql-test/r/grant_cache_no_prot.result @@ -1,5 +1,9 @@ +set GLOBAL sql_mode=""; +set LOCAL sql_mode=""; drop table if exists test.t1,mysqltest.t1,mysqltest.t2; drop database if exists mysqltest; +set GLOBAL query_cache_type=ON; +set LOCAL query_cache_type=ON; set GLOBAL query_cache_size=1355776; reset query cache; flush status; @@ -219,3 +223,7 @@ flush privileges; drop table test.t1,mysqltest.t1,mysqltest.t2; drop database mysqltest; set GLOBAL query_cache_size=default; +set GLOBAL query_cache_type=ON; +set LOCAL query_cache_type=ON; +set GLOBAL sql_mode=default; +set GLOBAL query_cache_type=default; diff --git a/mysql-test/r/grant_cache_ps_prot.result b/mysql-test/r/grant_cache_ps_prot.result index b504dc4be35..5fe57c7c35d 100644 --- a/mysql-test/r/grant_cache_ps_prot.result +++ b/mysql-test/r/grant_cache_ps_prot.result @@ -1,5 +1,9 @@ +set GLOBAL sql_mode=""; +set LOCAL sql_mode=""; drop table if exists test.t1,mysqltest.t1,mysqltest.t2; drop database if exists mysqltest; +set GLOBAL query_cache_type=ON; +set LOCAL query_cache_type=ON; set GLOBAL query_cache_size=1355776; reset query cache; flush status; @@ -219,3 +223,7 @@ flush privileges; drop table test.t1,mysqltest.t1,mysqltest.t2; drop database mysqltest; set GLOBAL query_cache_size=default; +set GLOBAL query_cache_type=ON; +set LOCAL query_cache_type=ON; +set GLOBAL sql_mode=default; +set GLOBAL query_cache_type=default; diff --git a/mysql-test/r/grant_explain_non_select.result b/mysql-test/r/grant_explain_non_select.result index 85b0ae5c4b4..1dbb5b1e3c0 100644 --- a/mysql-test/r/grant_explain_non_select.result +++ b/mysql-test/r/grant_explain_non_select.result @@ -1,3 +1,5 @@ +set GLOBAL sql_mode=""; +set LOCAL sql_mode=""; CREATE DATABASE privtest_db; CREATE TABLE privtest_db.t1 (a INT); CREATE TABLE privtest_db.t2 (a INT); @@ -140,7 +142,7 @@ REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost'; CREATE VIEW privtest_db.v1 (a) AS SELECT a FROM privtest_db.t1; GRANT SELECT, INSERT, UPDATE, DELETE ON privtest_db.v1 TO 'privtest'@'localhost'; EXPLAIN SELECT * FROM v1; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table SELECT * FROM v1; a 11 @@ -150,29 +152,31 @@ a 4 4 EXPLAIN INSERT INTO v1 VALUES (10); -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table INSERT INTO v1 VALUES (10); EXPLAIN INSERT INTO v1 SELECT * FROM t2; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table INSERT INTO v1 SELECT * FROM t2; EXPLAIN REPLACE INTO v1 VALUES (10); -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table REPLACE INTO v1 VALUES (10); EXPLAIN REPLACE INTO v1 SELECT * FROM t2; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table REPLACE INTO v1 SELECT * FROM t2; EXPLAIN UPDATE v1 SET a = a + 1; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table UPDATE v1 SET a = a + 1; EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; EXPLAIN DELETE FROM v1 WHERE a = 10; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table DELETE FROM v1 WHERE a = 10; EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; DROP USER 'privtest'@localhost; USE test; DROP DATABASE privtest_db; +set GLOBAL sql_mode=default; +set LOCAL sql_mode=default; diff --git a/mysql-test/r/grant_lowercase.result b/mysql-test/r/grant_lowercase.result index f13b077c214..b449453a47a 100644 --- a/mysql-test/r/grant_lowercase.result +++ b/mysql-test/r/grant_lowercase.result @@ -1,3 +1,4 @@ +set sql_mode=""; grant file on *.* to user1@localhost with grant option; grant select on `a%`.* to user1@localhost with grant option; grant file on aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.* to 'user'@'%' identified by 'secret'; @@ -5,7 +6,7 @@ ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa drop user user1@localhost; call mtr.add_suppression("Incorrect database name"); alter table mysql.host modify Db varchar(200); -alter table mysql.db modify User char(16), modify Db varchar(200); +alter table mysql.db modify User char(16) default "", modify Db varchar(200) default ""; insert mysql.host set db=concat('=>', repeat(_utf8 'й', 200)); Warnings: Warning 1265 Data truncated for column 'Db' at row 1 @@ -15,6 +16,6 @@ Warning 1265 Data truncated for column 'Db' at row 1 flush privileges; delete from mysql.host where db like '=>%'; delete from mysql.db where db like '=>%'; -alter table mysql.host modify Db char(64); -alter table mysql.db modify Db char(64), modify User char(80); +alter table mysql.host modify Db char(64) default ""; +alter table mysql.db modify Db char(64) default "", modify User char(80) default ""; flush privileges; diff --git a/mysql-test/r/grant_lowercase_fs.result b/mysql-test/r/grant_lowercase_fs.result index 5a3087ed5cd..eb27b1d7ea0 100644 --- a/mysql-test/r/grant_lowercase_fs.result +++ b/mysql-test/r/grant_lowercase_fs.result @@ -1,4 +1,6 @@ create database db1; +create user user_1@localhost; +create user USER_1@localhost; GRANT CREATE ON db1.* to user_1@localhost; GRANT SELECT ON db1.* to USER_1@localhost; CREATE TABLE t1(f1 int); diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 38abbfef261..3ef73bb1943 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -522,6 +522,7 @@ NULL 9 3 b 1 drop table t1; +set big_tables=0; create table t1 (a int not null, b int not null); insert into t1 values (1,1),(1,2),(3,1),(3,2),(2,2),(2,1); create table t2 (a int not null, b int not null, key(a)); @@ -659,7 +660,10 @@ insert into t1 (a,b) values (1,2),(1,3),(2,5); select a, 0.1*0+1 r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2=1; a r2 r1 1 1.0 2 -select a, round(rand(100)*10) r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2<=2; +select a, round(rand(100)*10) r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2<=2; +a r2 r1 +1 2 2 +select a, round(rand(100)*10) r2, sum(1) r1 from t1 group by a having r1>1 and r2<=2; a r2 r1 1 2 2 select a,sum(b) from t1 where a=1 group by c; @@ -668,6 +672,12 @@ a sum(b) select a*sum(b) from t1 where a=1 group by c; a*sum(b) 5 +select a*sum(b) as f1 from t1 where a=1 group by c having f1 <= 10; +f1 +5 +select a,a*sum(b) as f1 from t1 where a=1 group by c having a*sum(b)+0 <= 10; +a f1 +1 5 select sum(a)*sum(b) from t1 where a=1 group by c; sum(a)*sum(b) 10 @@ -1988,12 +1998,12 @@ SHOW SESSION STATUS LIKE 'Sort_scan%'; Variable_name Value Sort_scan 0 EXPLAIN SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2 -FROM t1 GROUP BY field1, field2;; +FROM t1 GROUP BY field1, field2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL idx 5 NULL 20 Using index; Using filesort FLUSH STATUS; SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2 -FROM t1 GROUP BY field1, field2;; +FROM t1 GROUP BY field1, field2; field1 field2 1 1 2 2 @@ -2082,6 +2092,58 @@ f1 f2 19 19 20 20 explain +select col1 f1, col1 f2 from t1 group by f1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL idx 5 NULL 20 Using index +select col1 f1, col1 f2 from t1 group by f1; +f1 f2 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +10 10 +11 11 +12 12 +13 13 +14 14 +15 15 +16 16 +17 17 +18 18 +19 19 +20 20 +explain +select col1 f1, col1 f2 from t1 group by f1, f2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL idx 5 NULL 20 Using index +select col1 f1, col1 f2 from t1 group by f1, f2; +f1 f2 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +10 10 +11 11 +12 12 +13 13 +14 14 +15 15 +16 16 +17 17 +18 18 +19 19 +20 20 +explain select col1 f1, col1 f2 from t1 group by f2 order by f2, f1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL idx 5 NULL 20 Using index @@ -2141,6 +2203,22 @@ INSERT INTO t2(col1, col2) VALUES (1,20),(2,19),(3,18),(4,17),(5,16),(6,15),(7,14),(8,13),(9,12),(10,11), (11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1); explain +select col1 f1, col2 f2, col1 f3 from t2 group by f1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range NULL idx 5 NULL 7 Using index for group-by +explain +select SQL_BIG_RESULT col1 f1, col2 f2, col1 f3 from t2 group by f1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range NULL idx 5 NULL 7 Using index for group-by +explain +select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index NULL idx 10 NULL 20 Using index +explain +select col1 f1, col1 f2 from t2 group by f1, 1+1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range NULL idx 5 NULL 7 Using index for group-by +explain select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3+0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 index NULL idx 10 NULL 20 Using index; Using temporary; Using filesort @@ -2167,6 +2245,10 @@ f1 f2 f3 19 2 19 20 1 20 explain +select col1 f1, col2 f2, col1 f3 from t2 order by f1,f2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index NULL idx 10 NULL 20 Using index +explain select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3+0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 index NULL idx 10 NULL 20 Using index; Using filesort @@ -2207,20 +2289,16 @@ field1 field2 2004-10-11 18:13:00 1 2009-02-19 02:05:00 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'x' Warning 1292 Truncated incorrect DOUBLE value: 'g' Warning 1292 Truncated incorrect DOUBLE value: 'o' -Warning 1292 Truncated incorrect DOUBLE value: 'g' Warning 1292 Truncated incorrect DOUBLE value: 'v' SELECT alias2.f3 AS field1 , alias2.f1 AS field2 FROM t1 AS alias1 JOIN t1 AS alias2 ON alias2.f1 = alias1.f2 AND alias2.f1 != alias1.f4 GROUP BY field1 , field2 ; field1 field2 2004-10-11 18:13:00 1 2009-02-19 02:05:00 5 Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'x' Warning 1292 Truncated incorrect DOUBLE value: 'g' Warning 1292 Truncated incorrect DOUBLE value: 'o' -Warning 1292 Truncated incorrect DOUBLE value: 'g' Warning 1292 Truncated incorrect DOUBLE value: 'v' SET SESSION SQL_MODE=default; drop table t1; @@ -2562,3 +2640,55 @@ field1 field2 DROP TABLE t1; DROP TABLE where_subselect; # End of Bug #58782 +# +# MDEV-8988: Apparently valid SQL query gives wrong result (nested WHERE) +# +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (a int, b int, c int); +insert into t1 select A.a + 10*B.a, A.a, A.a + 10*B.a from t0 A, t0 B; +insert into t1 values (NULL, NULL, NULL); +create table t2 (c int, col1 int, key(c)); +insert into t2 select t1.a, 100000 from t1; +analyze table t2; +Table Op Msg_type Msg_text +test.t2 analyze status Table is already up to date +explain +select +max(a)+ (select col1 from t2 where t2.c=t1.c) +from t1 +group by t1.b; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 101 Using temporary; Using filesort +2 DEPENDENT SUBQUERY t2 ref c c 5 func 1 +select +max(a) + (select col1 from t2 where t2.c=t1.c) +from t1 +group by t1.b; +max(a) + (select col1 from t2 where t2.c=t1.c) +NULL +100090 +100091 +100092 +100093 +100094 +100095 +100096 +100097 +100098 +100099 +drop table t0,t1,t2; +# +# MDEV-9602 crash in st_key::actual_rec_per_key when group by constant +# +create table t1 (a date not null,unique (a)) engine=innodb; +Warnings: +Warning 1286 Unknown storage engine 'innodb' +Warning 1266 Using storage engine MyISAM for table 't1' +select distinct a from t1 group by 'a'; +a +insert into t1 values("2001-02-02"),("2001-02-03"); +select distinct a from t1 group by 'a'; +a +2001-02-02 +drop table t1; diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result index 9421ea9e740..cf867dd1e18 100644 --- a/mysql-test/r/group_min_max.result +++ b/mysql-test/r/group_min_max.result @@ -3727,3 +3727,163 @@ DROP TABLE t1; # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-6990 GROUP_MIN_MAX optimization is not applied in some cases when it could +# +CREATE TABLE t1 (id INT NOT NULL, a DATE, KEY(id,a)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1,'2001-01-01'); +INSERT INTO t1 VALUES (1,'2001-01-02'); +INSERT INTO t1 VALUES (1,'2001-01-03'); +INSERT INTO t1 VALUES (1,'2001-01-04'); +INSERT INTO t1 VALUES (2,'2001-01-01'); +INSERT INTO t1 VALUES (2,'2001-01-02'); +INSERT INTO t1 VALUES (2,'2001-01-03'); +INSERT INTO t1 VALUES (2,'2001-01-04'); +INSERT INTO t1 VALUES (3,'2001-01-01'); +INSERT INTO t1 VALUES (3,'2001-01-02'); +INSERT INTO t1 VALUES (3,'2001-01-03'); +INSERT INTO t1 VALUES (3,'2001-01-04'); +INSERT INTO t1 VALUES (4,'2001-01-01'); +INSERT INTO t1 VALUES (4,'2001-01-02'); +INSERT INTO t1 VALUES (4,'2001-01-03'); +INSERT INTO t1 VALUES (4,'2001-01-04'); +EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='2001-01-04' GROUP BY id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range NULL id 8 NULL 9 Using where; Using index for group-by +EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104.0 GROUP BY id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range NULL id 8 NULL 9 Using where; Using index for group-by +EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range NULL id 8 NULL 9 Using where; Using index for group-by +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='2001-01-04' GROUP BY id; +id MIN(a) MAX(a) +1 2001-01-04 2001-01-04 +2 2001-01-04 2001-01-04 +3 2001-01-04 2001-01-04 +4 2001-01-04 2001-01-04 +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104.0 GROUP BY id; +id MIN(a) MAX(a) +1 2001-01-04 2001-01-04 +2 2001-01-04 2001-01-04 +3 2001-01-04 2001-01-04 +4 2001-01-04 2001-01-04 +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id; +id MIN(a) MAX(a) +1 2001-01-04 2001-01-04 +2 2001-01-04 2001-01-04 +3 2001-01-04 2001-01-04 +4 2001-01-04 2001-01-04 +DROP TABLE t1; +# +# MDEV-8229 GROUP_MIN_MAX is erroneously applied for BETWEEN in some cases +# +SET NAMES latin1; +CREATE TABLE t1 (id INT NOT NULL, a VARCHAR(20)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1,'2001-01-01'); +INSERT INTO t1 VALUES (1,'2001-01-02'); +INSERT INTO t1 VALUES (1,'2001-01-03'); +INSERT INTO t1 VALUES (1,' 2001-01-04'); +INSERT INTO t1 VALUES (2,'2001-01-01'); +INSERT INTO t1 VALUES (2,'2001-01-02'); +INSERT INTO t1 VALUES (2,'2001-01-03'); +INSERT INTO t1 VALUES (2,' 2001-01-04'); +INSERT INTO t1 VALUES (3,'2001-01-01'); +INSERT INTO t1 VALUES (3,'2001-01-02'); +INSERT INTO t1 VALUES (3,'2001-01-03'); +INSERT INTO t1 VALUES (3,' 2001-01-04'); +INSERT INTO t1 VALUES (4,'2001-01-01'); +INSERT INTO t1 VALUES (4,'2001-01-02'); +INSERT INTO t1 VALUES (4,'2001-01-03'); +INSERT INTO t1 VALUES (4,' 2001-01-04'); +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN ' 2001-01-04' AND '2001-01-05' GROUP BY id; +id MIN(a) MAX(a) +1 2001-01-04 2001-01-03 +2 2001-01-04 2001-01-03 +3 2001-01-04 2001-01-03 +4 2001-01-04 2001-01-03 +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND '2001-01-05' GROUP BY id; +id MIN(a) MAX(a) +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND DATE'2001-01-05' GROUP BY id; +id MIN(a) MAX(a) +1 2001-01-04 2001-01-04 +2 2001-01-04 2001-01-04 +3 2001-01-04 2001-01-04 +4 2001-01-04 2001-01-04 +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND '2001-01-05' GROUP BY id; +id MIN(a) MAX(a) +1 2001-01-04 2001-01-04 +2 2001-01-04 2001-01-04 +3 2001-01-04 2001-01-04 +4 2001-01-04 2001-01-04 +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND DATE'2001-01-05' GROUP BY id; +id MIN(a) MAX(a) +1 2001-01-04 2001-01-04 +2 2001-01-04 2001-01-04 +3 2001-01-04 2001-01-04 +4 2001-01-04 2001-01-04 +ALTER TABLE t1 ADD KEY(id,a); +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN ' 2001-01-04' AND '2001-01-05' GROUP BY id; +id MIN(a) MAX(a) +1 2001-01-04 2001-01-03 +2 2001-01-04 2001-01-03 +3 2001-01-04 2001-01-03 +4 2001-01-04 2001-01-03 +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND '2001-01-05' GROUP BY id; +id MIN(a) MAX(a) +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND DATE'2001-01-05' GROUP BY id; +id MIN(a) MAX(a) +1 2001-01-04 2001-01-04 +2 2001-01-04 2001-01-04 +3 2001-01-04 2001-01-04 +4 2001-01-04 2001-01-04 +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND '2001-01-05' GROUP BY id; +id MIN(a) MAX(a) +1 2001-01-04 2001-01-04 +2 2001-01-04 2001-01-04 +3 2001-01-04 2001-01-04 +4 2001-01-04 2001-01-04 +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND DATE'2001-01-05' GROUP BY id; +id MIN(a) MAX(a) +1 2001-01-04 2001-01-04 +2 2001-01-04 2001-01-04 +3 2001-01-04 2001-01-04 +4 2001-01-04 2001-01-04 +EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN ' 2001-01-04' AND '2001-01-05' GROUP BY id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range NULL id 27 NULL 9 Using where; Using index for group-by +EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND '2001-01-05' GROUP BY id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range NULL id 27 NULL 9 Using where; Using index for group-by +EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND DATE'2001-01-05' GROUP BY id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL id 27 NULL 16 Using where; Using index +EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND '2001-01-05' GROUP BY id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL id 27 NULL 16 Using where; Using index +EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND DATE'2001-01-05' GROUP BY id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL id 27 NULL 16 Using where; Using index +DROP TABLE t1; +# +# MIN() optimization didn't work correctly with BETWEEN when using too +# long strings. +# +create table t1 (a varchar(10), key (a)) engine=myisam; +insert into t1 values("bar"),("Cafe"); +explain select min(a) from t1 where a between "a" and "Cafe2"; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +explain select min(a) from t1 where a between "a" and "Cafeeeeeeeeeeeeeeeeeeeeeeeeee"; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index a a 13 NULL 2 Using where; Using index +explain select min(a) from t1 where a between "abbbbbbbbbbbbbbbbbbbb" and "Cafe2"; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index a a 13 NULL 2 Using where; Using index +drop table t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/handlersocket.result b/mysql-test/r/handlersocket.result index b519e2e7c93..e38de6bf5c2 100644 --- a/mysql-test/r/handlersocket.result +++ b/mysql-test/r/handlersocket.result @@ -5,7 +5,7 @@ plugin_version 1.0 plugin_status ACTIVE plugin_type DAEMON plugin_library handlersocket.so -plugin_library_version 1.8 +plugin_library_version 1.11 plugin_author higuchi dot akira at dena dot jp plugin_description Direct access into InnoDB plugin_license BSD diff --git a/mysql-test/r/have_mutex_deadlock_detector.require b/mysql-test/r/have_mutex_deadlock_detector.require deleted file mode 100644 index 6ed281c757a..00000000000 --- a/mysql-test/r/have_mutex_deadlock_detector.require +++ /dev/null @@ -1,2 +0,0 @@ -1 -1 diff --git a/mysql-test/r/have_ndb_extra.require b/mysql-test/r/have_ndb_extra.require deleted file mode 100644 index 8f7c125196a..00000000000 --- a/mysql-test/r/have_ndb_extra.require +++ /dev/null @@ -1,3 +0,0 @@ -select 1; -1 -1 diff --git a/mysql-test/r/have_ndbapi_examples.require b/mysql-test/r/have_ndbapi_examples.require deleted file mode 100644 index 924d2d51708..00000000000 --- a/mysql-test/r/have_ndbapi_examples.require +++ /dev/null @@ -1,2 +0,0 @@ -have_ndb_example -1 diff --git a/mysql-test/r/help.result b/mysql-test/r/help.result index 16719cc8193..3a266567175 100644 --- a/mysql-test/r/help.result +++ b/mysql-test/r/help.result @@ -148,10 +148,12 @@ help 'impossible_category_1'; source_category_name name is_it_category impossible_category_1 impossible_function_1 N impossible_category_1 impossible_function_2 N +set sql_mode=""; alter table mysql.help_relation engine=innodb; alter table mysql.help_keyword engine=innodb; alter table mysql.help_topic engine=innodb; alter table mysql.help_category engine=innodb; +set sql_mode=default; help 'function_of_my_dream'; name is_it_category help '%possible_f%'; diff --git a/mysql-test/r/host_cache_size_functionality.result b/mysql-test/r/host_cache_size_functionality.result index e7f9e09fd2f..069cf61bcad 100644 --- a/mysql-test/r/host_cache_size_functionality.result +++ b/mysql-test/r/host_cache_size_functionality.result @@ -6,7 +6,7 @@ echo '##' #################################################################### SELECT COUNT(@@GLOBAL.Host_Cache_Size) 1 Expected -set @Default_host_cache_size=128; +set @Default_host_cache_size=279; select @@global.Host_Cache_Size=@Default_host_cache_size; @@global.Host_Cache_Size=@Default_host_cache_size 1 diff --git a/mysql-test/r/implicit_commit.result b/mysql-test/r/implicit_commit.result index d568d05e7b7..07536ab0719 100644 --- a/mysql-test/r/implicit_commit.result +++ b/mysql-test/r/implicit_commit.result @@ -1,3 +1,4 @@ +SET SQL_MODE=""; SET GLOBAL EVENT_SCHEDULER = OFF; SET BINLOG_FORMAT = STATEMENT; CREATE DATABASE db1; diff --git a/mysql-test/r/index_intersect.result b/mysql-test/r/index_intersect.result index 1337c3fac2d..7a0633d4dc8 100644 --- a/mysql-test/r/index_intersect.result +++ b/mysql-test/r/index_intersect.result @@ -1013,10 +1013,7 @@ f4 varchar(32), f5 int, PRIMARY KEY (f1), KEY (f4) -) ENGINE=InnoDB; -Warnings: -Warning 1286 Unknown storage engine 'InnoDB' -Warning 1266 Using storage engine MyISAM for table 't1' +); INSERT INTO t1 VALUES (5,'H',1), (9,'g',0), (527,'i',0), (528,'y',1), (529,'S',6), (530,'m',7), (531,'b',2), (532,'N',1), (533,'V',NULL), (534,'l',1), diff --git a/mysql-test/r/index_intersect_innodb.result b/mysql-test/r/index_intersect_innodb.result index 33f2247e5d1..9c3a501111d 100644 --- a/mysql-test/r/index_intersect_innodb.result +++ b/mysql-test/r/index_intersect_innodb.result @@ -1014,7 +1014,7 @@ f4 varchar(32), f5 int, PRIMARY KEY (f1), KEY (f4) -) ENGINE=InnoDB; +); INSERT INTO t1 VALUES (5,'H',1), (9,'g',0), (527,'i',0), (528,'y',1), (529,'S',6), (530,'m',7), (531,'b',2), (532,'N',1), (533,'V',NULL), (534,'l',1), diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result index fcd5eebefa4..a857e2a21ff 100644 --- a/mysql-test/r/index_merge_myisam.result +++ b/mysql-test/r/index_merge_myisam.result @@ -74,7 +74,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 17 Using sort_union(i1,i2); Using where explain select * from t0 where key2 = 45 or key1 <=> null; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 range i1,i2 i2 4 NULL 1 Using where +1 SIMPLE t0 range i1,i2 i2 4 NULL 1 Using index condition explain select * from t0 where key2 = 45 or key1 is not null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 ALL i1,i2 NULL NULL NULL 1024 Using where diff --git a/mysql-test/r/information_schema-big.result b/mysql-test/r/information_schema-big.result index 9bf015d1b37..112d4842e42 100644 --- a/mysql-test/r/information_schema-big.result +++ b/mysql-test/r/information_schema-big.result @@ -31,6 +31,7 @@ ENABLED_ROLES ROLE_NAME ENGINES ENGINE EVENTS EVENT_SCHEMA FILES TABLE_SCHEMA +GEOMETRY_COLUMNS F_TABLE_SCHEMA GLOBAL_STATUS VARIABLE_NAME GLOBAL_VARIABLES VARIABLE_NAME INDEX_STATISTICS TABLE_SCHEMA @@ -47,7 +48,9 @@ SCHEMATA SCHEMA_NAME SCHEMA_PRIVILEGES TABLE_SCHEMA SESSION_STATUS VARIABLE_NAME SESSION_VARIABLES VARIABLE_NAME +SPATIAL_REF_SYS SRID STATISTICS TABLE_SCHEMA +SYSTEM_VARIABLES VARIABLE_NAME TABLES TABLE_SCHEMA TABLESPACES TABLESPACE_NAME TABLE_CONSTRAINTS CONSTRAINT_SCHEMA @@ -85,6 +88,7 @@ ENABLED_ROLES ROLE_NAME ENGINES ENGINE EVENTS EVENT_SCHEMA FILES TABLE_SCHEMA +GEOMETRY_COLUMNS F_TABLE_SCHEMA GLOBAL_STATUS VARIABLE_NAME GLOBAL_VARIABLES VARIABLE_NAME INDEX_STATISTICS TABLE_SCHEMA @@ -101,7 +105,9 @@ SCHEMATA SCHEMA_NAME SCHEMA_PRIVILEGES TABLE_SCHEMA SESSION_STATUS VARIABLE_NAME SESSION_VARIABLES VARIABLE_NAME +SPATIAL_REF_SYS SRID STATISTICS TABLE_SCHEMA +SYSTEM_VARIABLES VARIABLE_NAME TABLES TABLE_SCHEMA TABLESPACES TABLESPACE_NAME TABLE_CONSTRAINTS CONSTRAINT_SCHEMA diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 6980b5d30ed..fa5280df2b4 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1,3 +1,5 @@ +set global sql_mode=""; +set local sql_mode=""; DROP TABLE IF EXISTS t0,t1,t2,t3,t4,t5; DROP VIEW IF EXISTS v1; show variables where variable_name like "skip_show_database"; @@ -42,7 +44,7 @@ insert into t5 values (10); create view v1 (c) as SELECT table_name FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND -table_name not like 'ndb_%' AND table_name not like 'innodb_%' AND +table_name not like 'innodb_%' AND table_name not like 'xtradb_%'; select * from v1; c @@ -58,6 +60,7 @@ ENABLED_ROLES ENGINES EVENTS FILES +GEOMETRY_COLUMNS GLOBAL_STATUS GLOBAL_VARIABLES INDEX_STATISTICS @@ -74,7 +77,9 @@ SCHEMATA SCHEMA_PRIVILEGES SESSION_STATUS SESSION_VARIABLES +SPATIAL_REF_SYS STATISTICS +SYSTEM_VARIABLES TABLES TABLESPACES TABLE_CONSTRAINTS @@ -128,6 +133,11 @@ TABLE_CONSTRAINTS TABLE_CONSTRAINTS TABLE_PRIVILEGES TABLE_PRIVILEGES TABLE_STATISTICS TABLE_STATISTICS TRIGGERS TRIGGERS +t1 t1 +t2 t2 +t3 t3 +t4 t4 +t5 t5 table_stats table_stats tables_priv tables_priv time_zone time_zone @@ -135,11 +145,6 @@ time_zone_leap_second time_zone_leap_second time_zone_name time_zone_name time_zone_transition time_zone_transition time_zone_transition_type time_zone_transition_type -t1 t1 -t4 t4 -t2 t2 -t3 t3 -t5 t5 select c,table_name from v1 left join information_schema.TABLES v2 on (v1.c=v2.table_name) where v1.c like "t%"; @@ -150,6 +155,11 @@ TABLE_CONSTRAINTS TABLE_CONSTRAINTS TABLE_PRIVILEGES TABLE_PRIVILEGES TABLE_STATISTICS TABLE_STATISTICS TRIGGERS TRIGGERS +t1 t1 +t2 t2 +t3 t3 +t4 t4 +t5 t5 table_stats table_stats tables_priv tables_priv time_zone time_zone @@ -157,11 +167,6 @@ time_zone_leap_second time_zone_leap_second time_zone_name time_zone_name time_zone_transition time_zone_transition time_zone_transition_type time_zone_transition_type -t1 t1 -t4 t4 -t2 t2 -t3 t3 -t5 t5 select c, v2.table_name from v1 right join information_schema.TABLES v2 on (v1.c=v2.table_name) where v1.c like "t%"; @@ -172,6 +177,11 @@ TABLE_CONSTRAINTS TABLE_CONSTRAINTS TABLE_PRIVILEGES TABLE_PRIVILEGES TABLE_STATISTICS TABLE_STATISTICS TRIGGERS TRIGGERS +t1 t1 +t2 t2 +t3 t3 +t4 t4 +t5 t5 table_stats table_stats tables_priv tables_priv time_zone time_zone @@ -179,11 +189,6 @@ time_zone_leap_second time_zone_leap_second time_zone_name time_zone_name time_zone_transition time_zone_transition time_zone_transition_type time_zone_transition_type -t1 t1 -t4 t4 -t2 t2 -t3 t3 -t5 t5 select table_name from information_schema.TABLES where table_schema = "mysqltest" and table_name like "t%"; table_name @@ -237,7 +242,7 @@ where table_schema = 'mysqltest' and table_name = 'v1'; table_name column_name privileges v1 c select explain select * from v1; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table drop view v1, mysqltest.v1; drop tables mysqltest.t4, mysqltest.t1, t2, t3, t5; drop database mysqltest; @@ -423,12 +428,12 @@ latin1_spanish_ci show keys from v4; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment select * from information_schema.views where TABLE_NAME like "v%"; -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def test v0 select `information_schema`.`schemata`.`SCHEMA_NAME` AS `c` from `information_schema`.`schemata` NONE NO root@localhost DEFINER latin1 latin1_swedish_ci -def test v1 select `information_schema`.`tables`.`TABLE_NAME` AS `c` from `information_schema`.`tables` where (`information_schema`.`tables`.`TABLE_NAME` = 'v1') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci -def test v2 select `information_schema`.`columns`.`COLUMN_NAME` AS `c` from `information_schema`.`columns` where (`information_schema`.`columns`.`TABLE_NAME` = 'v2') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci -def test v3 select `information_schema`.`character_sets`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`character_sets` where (`information_schema`.`character_sets`.`CHARACTER_SET_NAME` like 'latin1%') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci -def test v4 select `information_schema`.`collations`.`COLLATION_NAME` AS `c` from `information_schema`.`collations` where (`information_schema`.`collations`.`COLLATION_NAME` like 'latin1%') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def test v0 select `information_schema`.`schemata`.`SCHEMA_NAME` AS `c` from `information_schema`.`schemata` NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED +def test v1 select `information_schema`.`tables`.`TABLE_NAME` AS `c` from `information_schema`.`tables` where (`information_schema`.`tables`.`TABLE_NAME` = 'v1') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED +def test v2 select `information_schema`.`columns`.`COLUMN_NAME` AS `c` from `information_schema`.`columns` where (`information_schema`.`columns`.`TABLE_NAME` = 'v2') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED +def test v3 select `information_schema`.`character_sets`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`character_sets` where (`information_schema`.`character_sets`.`CHARACTER_SET_NAME` like 'latin1%') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED +def test v4 select `information_schema`.`collations`.`COLLATION_NAME` AS `c` from `information_schema`.`collations` where (`information_schema`.`collations`.`COLLATION_NAME` like 'latin1%') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED drop view v0, v1, v2, v3, v4; create table t1 (a int); grant select,update,insert on t1 to mysqltest_1@localhost; @@ -485,7 +490,7 @@ Note 1831 Duplicate index 'key_2' defined on the table 'test.t1'. This is deprec show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, PRIMARY KEY (`a`), UNIQUE KEY `constraint_1` (`a`), UNIQUE KEY `key_1` (`a`), @@ -524,10 +529,10 @@ create view v1 (c) as select a from t1 with check option; create view v2 (c) as select a from t1 WITH LOCAL CHECK OPTION; create view v3 (c) as select a from t1 WITH CASCADED CHECK OPTION; select * from information_schema.views; -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def test v1 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER latin1 latin1_swedish_ci -def test v2 select `test`.`t1`.`a` AS `c` from `test`.`t1` LOCAL YES root@localhost DEFINER latin1 latin1_swedish_ci -def test v3 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER latin1 latin1_swedish_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def test v1 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED +def test v2 select `test`.`t1`.`a` AS `c` from `test`.`t1` LOCAL YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED +def test v3 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED grant select (a) on test.t1 to joe@localhost with grant option; select * from INFORMATION_SCHEMA.COLUMN_PRIVILEGES; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE @@ -715,6 +720,7 @@ max_user_connections select,insert,update,references authentication_string select,insert,update,references password_expired select,insert,update,references is_role select,insert,update,references +default_role select,insert,update,references use test; create function sub1(i int) returns int return i+1; @@ -781,6 +787,7 @@ Database Table In_use Name_locked mysql user 0 0 show status where variable_name like "%database%"; Variable_name Value +Acl_database_grants 2 Com_show_databases 3 show variables where variable_name like "skip_show_databas"; Variable_name Value @@ -818,6 +825,7 @@ information_schema PROCESSLIST INFO information_schema ROUTINES DTD_IDENTIFIER information_schema ROUTINES ROUTINE_DEFINITION information_schema ROUTINES ROUTINE_COMMENT +information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST information_schema TRIGGERS ACTION_CONDITION information_schema TRIGGERS ACTION_STATEMENT information_schema VIEWS VIEW_DEFINITION @@ -1217,9 +1225,9 @@ create definer = mysqltest_1@localhost sql security definer view v2 as select 1; select * from information_schema.views where table_name='v1' or table_name='v2'; -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def test v1 NONE YES root@localhost DEFINER latin1 latin1_swedish_ci -def test v2 select 1 AS `1` NONE NO mysqltest_1@localhost DEFINER latin1 latin1_swedish_ci +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def test v1 NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED +def test v2 select 1 AS `1` NONE NO mysqltest_1@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED drop view v1, v2; drop table t1; drop user mysqltest_1@localhost; @@ -1540,9 +1548,9 @@ TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATA select * from `information_schema`.`TRIGGERS` where `EVENT_OBJECT_TABLE` = NULL; TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION select * from `information_schema`.`VIEWS` where `TABLE_SCHEMA` = NULL; -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM select * from `information_schema`.`VIEWS` where `TABLE_NAME` = NULL; -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM explain extended select 1 from information_schema.tables; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE tables ALL NULL NULL NULL NULL NULL NULL Skip_open_table; Scanned all databases @@ -1627,9 +1635,32 @@ drop table if exists t1;drop table if exists t1; drop table if exists t1;drop table if exists t1; drop table if exists t1;drop table if exists t1; drop table if exists t1;drop table if exists t1; -drop table if exists t1;drop table if exists -Warnings: -Warning 1265 Data truncated for column 'VARIABLE_VALUE' at row 1 +drop table if exists t1;drop table if exists t1; +select * from information_schema.global_variables where variable_name like 'init%' order by variable_name; +VARIABLE_NAME VARIABLE_VALUE +INIT_CONNECT drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +INIT_FILE +INIT_SLAVE set global init_connect=""; create table t0 select * from information_schema.global_status where VARIABLE_NAME='COM_SELECT'; SELECT 1; @@ -1829,6 +1860,7 @@ DEFINER root@localhost SECURITY_TYPE DEFINER CHARACTER_SET_CLIENT latin1 COLLATION_CONNECTION latin1_swedish_ci +ALGORITHM UNDEFINED Warnings: Level Warning Code 1356 @@ -2036,3 +2068,4 @@ Variable_name Value Opened_tables 3 drop database mysqltest; drop database db1; +set global sql_mode=default; diff --git a/mysql-test/r/information_schema_all_engines.result b/mysql-test/r/information_schema_all_engines.result index 7e6cfd176a4..7f79dd883e2 100644 --- a/mysql-test/r/information_schema_all_engines.result +++ b/mysql-test/r/information_schema_all_engines.result @@ -13,6 +13,7 @@ ENABLED_ROLES ENGINES EVENTS FILES +GEOMETRY_COLUMNS GLOBAL_STATUS GLOBAL_VARIABLES INDEX_STATISTICS @@ -22,8 +23,8 @@ INNODB_CMPMEM INNODB_CMPMEM_RESET INNODB_CMP_PER_INDEX INNODB_CMP_RESET -INNODB_LOCKS INNODB_LOCK_WAITS +INNODB_MUTEXES INNODB_SYS_COLUMNS INNODB_SYS_FIELDS INNODB_SYS_FOREIGN @@ -31,6 +32,8 @@ INNODB_SYS_FOREIGN_COLS INNODB_SYS_INDEXES INNODB_SYS_TABLES INNODB_SYS_TABLESTATS +INNODB_TABLESPACES_ENCRYPTION +INNODB_TABLESPACES_SCRUBBING INNODB_TRX KEY_CACHES KEY_COLUMN_USAGE @@ -45,7 +48,9 @@ SCHEMATA SCHEMA_PRIVILEGES SESSION_STATUS SESSION_VARIABLES +SPATIAL_REF_SYS STATISTICS +SYSTEM_VARIABLES TABLES TABLESPACES TABLE_CONSTRAINTS @@ -82,6 +87,7 @@ ENABLED_ROLES ROLE_NAME ENGINES ENGINE EVENTS EVENT_SCHEMA FILES TABLE_SCHEMA +GEOMETRY_COLUMNS F_TABLE_SCHEMA GLOBAL_STATUS VARIABLE_NAME GLOBAL_VARIABLES VARIABLE_NAME INDEX_STATISTICS TABLE_SCHEMA @@ -91,8 +97,8 @@ INNODB_CMPMEM page_size INNODB_CMPMEM_RESET page_size INNODB_CMP_PER_INDEX database_name INNODB_CMP_RESET page_size -INNODB_LOCKS lock_id INNODB_LOCK_WAITS requesting_trx_id +INNODB_MUTEXES NAME INNODB_SYS_COLUMNS TABLE_ID INNODB_SYS_FIELDS INDEX_ID INNODB_SYS_FOREIGN ID @@ -100,6 +106,8 @@ INNODB_SYS_FOREIGN_COLS ID INNODB_SYS_INDEXES INDEX_ID INNODB_SYS_TABLES TABLE_ID INNODB_SYS_TABLESTATS TABLE_ID +INNODB_TABLESPACES_ENCRYPTION SPACE +INNODB_TABLESPACES_SCRUBBING SPACE INNODB_TRX trx_id KEY_CACHES KEY_CACHE_NAME KEY_COLUMN_USAGE CONSTRAINT_SCHEMA @@ -114,7 +122,9 @@ SCHEMATA SCHEMA_NAME SCHEMA_PRIVILEGES TABLE_SCHEMA SESSION_STATUS VARIABLE_NAME SESSION_VARIABLES VARIABLE_NAME +SPATIAL_REF_SYS SRID STATISTICS TABLE_SCHEMA +SYSTEM_VARIABLES VARIABLE_NAME TABLES TABLE_SCHEMA TABLESPACES TABLESPACE_NAME TABLE_CONSTRAINTS CONSTRAINT_SCHEMA @@ -151,6 +161,7 @@ ENABLED_ROLES ROLE_NAME ENGINES ENGINE EVENTS EVENT_SCHEMA FILES TABLE_SCHEMA +GEOMETRY_COLUMNS F_TABLE_SCHEMA GLOBAL_STATUS VARIABLE_NAME GLOBAL_VARIABLES VARIABLE_NAME INDEX_STATISTICS TABLE_SCHEMA @@ -160,8 +171,8 @@ INNODB_CMPMEM page_size INNODB_CMPMEM_RESET page_size INNODB_CMP_PER_INDEX database_name INNODB_CMP_RESET page_size -INNODB_LOCKS lock_id INNODB_LOCK_WAITS requesting_trx_id +INNODB_MUTEXES NAME INNODB_SYS_COLUMNS TABLE_ID INNODB_SYS_FIELDS INDEX_ID INNODB_SYS_FOREIGN ID @@ -169,6 +180,8 @@ INNODB_SYS_FOREIGN_COLS ID INNODB_SYS_INDEXES INDEX_ID INNODB_SYS_TABLES TABLE_ID INNODB_SYS_TABLESTATS TABLE_ID +INNODB_TABLESPACES_ENCRYPTION SPACE +INNODB_TABLESPACES_SCRUBBING SPACE INNODB_TRX trx_id KEY_CACHES KEY_CACHE_NAME KEY_COLUMN_USAGE CONSTRAINT_SCHEMA @@ -183,7 +196,9 @@ SCHEMATA SCHEMA_NAME SCHEMA_PRIVILEGES TABLE_SCHEMA SESSION_STATUS VARIABLE_NAME SESSION_VARIABLES VARIABLE_NAME +SPATIAL_REF_SYS SRID STATISTICS TABLE_SCHEMA +SYSTEM_VARIABLES VARIABLE_NAME TABLES TABLE_SCHEMA TABLESPACES TABLESPACE_NAME TABLE_CONSTRAINTS CONSTRAINT_SCHEMA @@ -225,6 +240,7 @@ COLUMN_PRIVILEGES information_schema.COLUMN_PRIVILEGES 1 ENGINES information_schema.ENGINES 1 EVENTS information_schema.EVENTS 1 FILES information_schema.FILES 1 +GEOMETRY_COLUMNS information_schema.GEOMETRY_COLUMNS 1 GLOBAL_STATUS information_schema.GLOBAL_STATUS 1 GLOBAL_VARIABLES information_schema.GLOBAL_VARIABLES 1 INDEX_STATISTICS information_schema.INDEX_STATISTICS 1 @@ -234,8 +250,8 @@ INNODB_CMPMEM information_schema.INNODB_CMPMEM 1 INNODB_CMPMEM_RESET information_schema.INNODB_CMPMEM_RESET 1 INNODB_CMP_PER_INDEX information_schema.INNODB_CMP_PER_INDEX 1 INNODB_CMP_RESET information_schema.INNODB_CMP_RESET 1 -INNODB_LOCKS information_schema.INNODB_LOCKS 1 INNODB_LOCK_WAITS information_schema.INNODB_LOCK_WAITS 1 +INNODB_MUTEXES information_schema.INNODB_MUTEXES 1 INNODB_SYS_COLUMNS information_schema.INNODB_SYS_COLUMNS 1 INNODB_SYS_FIELDS information_schema.INNODB_SYS_FIELDS 1 INNODB_SYS_FOREIGN information_schema.INNODB_SYS_FOREIGN 1 @@ -243,6 +259,8 @@ INNODB_SYS_FOREIGN_COLS information_schema.INNODB_SYS_FOREIGN_COLS 1 INNODB_SYS_INDEXES information_schema.INNODB_SYS_INDEXES 1 INNODB_SYS_TABLES information_schema.INNODB_SYS_TABLES 1 INNODB_SYS_TABLESTATS information_schema.INNODB_SYS_TABLESTATS 1 +INNODB_TABLESPACES_ENCRYPTION information_schema.INNODB_TABLESPACES_ENCRYPTION 1 +INNODB_TABLESPACES_SCRUBBING information_schema.INNODB_TABLESPACES_SCRUBBING 1 INNODB_TRX information_schema.INNODB_TRX 1 KEY_CACHES information_schema.KEY_CACHES 1 KEY_COLUMN_USAGE information_schema.KEY_COLUMN_USAGE 1 @@ -257,7 +275,9 @@ SCHEMATA information_schema.SCHEMATA 1 SCHEMA_PRIVILEGES information_schema.SCHEMA_PRIVILEGES 1 SESSION_STATUS information_schema.SESSION_STATUS 1 SESSION_VARIABLES information_schema.SESSION_VARIABLES 1 +SPATIAL_REF_SYS information_schema.SPATIAL_REF_SYS 1 STATISTICS information_schema.STATISTICS 1 +SYSTEM_VARIABLES information_schema.SYSTEM_VARIABLES 1 TABLES information_schema.TABLES 1 TABLESPACES information_schema.TABLESPACES 1 TABLE_CONSTRAINTS information_schema.TABLE_CONSTRAINTS 1 @@ -284,6 +304,7 @@ Database: information_schema | ENGINES | | EVENTS | | FILES | +| GEOMETRY_COLUMNS | | GLOBAL_STATUS | | GLOBAL_VARIABLES | | INDEX_STATISTICS | @@ -293,8 +314,8 @@ Database: information_schema | INNODB_CMPMEM_RESET | | INNODB_CMP_PER_INDEX | | INNODB_CMP_RESET | -| INNODB_LOCKS | | INNODB_LOCK_WAITS | +| INNODB_MUTEXES | | INNODB_SYS_COLUMNS | | INNODB_SYS_FIELDS | | INNODB_SYS_FOREIGN | @@ -302,6 +323,8 @@ Database: information_schema | INNODB_SYS_INDEXES | | INNODB_SYS_TABLES | | INNODB_SYS_TABLESTATS | +| INNODB_TABLESPACES_ENCRYPTION | +| INNODB_TABLESPACES_SCRUBBING | | INNODB_TRX | | KEY_CACHES | | KEY_COLUMN_USAGE | @@ -316,7 +339,9 @@ Database: information_schema | SCHEMA_PRIVILEGES | | SESSION_STATUS | | SESSION_VARIABLES | +| SPATIAL_REF_SYS | | STATISTICS | +| SYSTEM_VARIABLES | | TABLES | | TABLESPACES | | TABLE_CONSTRAINTS | @@ -343,6 +368,7 @@ Database: INFORMATION_SCHEMA | ENGINES | | EVENTS | | FILES | +| GEOMETRY_COLUMNS | | GLOBAL_STATUS | | GLOBAL_VARIABLES | | INDEX_STATISTICS | @@ -352,8 +378,8 @@ Database: INFORMATION_SCHEMA | INNODB_CMPMEM_RESET | | INNODB_CMP_PER_INDEX | | INNODB_CMP_RESET | -| INNODB_LOCKS | | INNODB_LOCK_WAITS | +| INNODB_MUTEXES | | INNODB_SYS_COLUMNS | | INNODB_SYS_FIELDS | | INNODB_SYS_FOREIGN | @@ -361,6 +387,8 @@ Database: INFORMATION_SCHEMA | INNODB_SYS_INDEXES | | INNODB_SYS_TABLES | | INNODB_SYS_TABLESTATS | +| INNODB_TABLESPACES_ENCRYPTION | +| INNODB_TABLESPACES_SCRUBBING | | INNODB_TRX | | KEY_CACHES | | KEY_COLUMN_USAGE | @@ -375,7 +403,9 @@ Database: INFORMATION_SCHEMA | SCHEMA_PRIVILEGES | | SESSION_STATUS | | SESSION_VARIABLES | +| SPATIAL_REF_SYS | | STATISTICS | +| SYSTEM_VARIABLES | | TABLES | | TABLESPACES | | TABLE_CONSTRAINTS | @@ -391,7 +421,7 @@ Database: INFORMATION_SCHEMA Wildcard: inf_rmation_schema | Databases | | information_schema | -SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA; +SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') GROUP BY TABLE_SCHEMA; table_schema count(*) -information_schema 54 +information_schema 59 mysql 30 diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result index 81a17e7ed3b..c09e04f786a 100644 --- a/mysql-test/r/information_schema_db.result +++ b/mysql-test/r/information_schema_db.result @@ -1,3 +1,5 @@ +set local sql_mode=""; +set global sql_mode=""; drop table if exists t1,t2; drop view if exists v1,v2; drop function if exists f1; @@ -216,3 +218,4 @@ show create view testdb_1.v1; ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v1' drop user mysqltest_1@localhost; drop database testdb_1; +set global sql_mode=default; diff --git a/mysql-test/r/information_schema_inno.result b/mysql-test/r/information_schema_inno.result index 838a7ad5162..7755d112f8e 100644 --- a/mysql-test/r/information_schema_inno.result +++ b/mysql-test/r/information_schema_inno.result @@ -101,3 +101,8 @@ SELECT * FROM information_schema.partitions WHERE table_schema= 'test' AND table_name= 'v1'; DROP TABLE t1; DROP VIEW v1; +CREATE TABLE t1(i int) ENGINE=Innodb ROW_FORMAT=REDUNDANT DATA DIRECTORY='MYSQLTEST_VARDIR/tmp'; +SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES where TABLE_NAME='t1'; +CREATE_OPTIONS +row_format=REDUNDANT DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' +DROP TABLE t1; diff --git a/mysql-test/r/information_schema_linux.result b/mysql-test/r/information_schema_linux.result new file mode 100644 index 00000000000..43095b76151 --- /dev/null +++ b/mysql-test/r/information_schema_linux.result @@ -0,0 +1,7 @@ +# +# MDEV-6756: map a linux pid (child pid) to a connection id shown in +# the output of SHOW PROCESSLIST +# +SELECT max(tid) != min(tid) FROM information_schema.processlist; +max(tid) != min(tid) +1 diff --git a/mysql-test/r/information_schema_routines.result b/mysql-test/r/information_schema_routines.result index b8f4fb9b1ef..65e352e3af3 100644 --- a/mysql-test/r/information_schema_routines.result +++ b/mysql-test/r/information_schema_routines.result @@ -1,3 +1,5 @@ +set sql_mode=""; +set sql_mode=""; # ========== routines.1 ========== USE INFORMATION_SCHEMA; SHOW CREATE TABLE INFORMATION_SCHEMA.ROUTINES; diff --git a/mysql-test/r/innodb_ext_key.result b/mysql-test/r/innodb_ext_key.result index 9140f306f77..cae402a9f12 100644 --- a/mysql-test/r/innodb_ext_key.result +++ b/mysql-test/r/innodb_ext_key.result @@ -1002,7 +1002,7 @@ insert into t2 (b) values (null), (null), (null); set optimizer_switch='extended_keys=on'; explain select a from t1 where b is null order by a desc limit 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref b b 9 const 2 Using where; Using filesort +1 SIMPLE t1 index b PRIMARY 8 NULL 3 Using where select a from t1 where b is null order by a desc limit 2; a 3 diff --git a/mysql-test/r/innodb_icp.result b/mysql-test/r/innodb_icp.result index fb467494525..bc1c24276ed 100644 --- a/mysql-test/r/innodb_icp.result +++ b/mysql-test/r/innodb_icp.result @@ -416,11 +416,11 @@ DROP TABLE t1; # Bug#59259 "Incorrect rows returned for a correlated subquery # when ICP is on" # -CREATE TABLE t1 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL) ENGINE=InnoDB; +CREATE TABLE t1 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL); INSERT INTO t1 VALUES (11,0); INSERT INTO t1 VALUES (12,5); INSERT INTO t1 VALUES (15,0); -CREATE TABLE t2 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL) ENGINE=InnoDB; +CREATE TABLE t2 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL); INSERT INTO t2 VALUES (11,1); INSERT INTO t2 VALUES (12,2); INSERT INTO t2 VALUES (15,4); @@ -600,6 +600,16 @@ SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 WHERE t2.pk <> t1.d1 AND t2.pk = 4; d1 pk i1 1 4 1 +EXPLAIN +SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 +WHERE t1.d1 <> t2.pk AND t2.pk = 4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL k1 9 NULL 3 Using index +1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using where +SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 +WHERE t1.d1 <> t2.pk AND t2.pk = 4; +d1 pk i1 +1 4 1 DROP TABLE t1, t2; # # BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89 diff --git a/mysql-test/r/innodb_load_xa.result b/mysql-test/r/innodb_load_xa.result index 017bc7450bd..515c820b40c 100644 --- a/mysql-test/r/innodb_load_xa.result +++ b/mysql-test/r/innodb_load_xa.result @@ -9,14 +9,9 @@ start transaction; insert t1 values (1); insert t1 values (2); commit; -include/show_binlog_events.inc -Log_name Pos Event_type Server_id End_log_pos Info -mysqld-bin.000001 # Gtid # # GTID #-#-# -mysqld-bin.000001 # Query # # use `test`; create table t1 (a int) engine=innodb -mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-# -mysqld-bin.000001 # Query # # use `test`; insert t1 values (1) -mysqld-bin.000001 # Query # # use `test`; insert t1 values (2) -mysqld-bin.000001 # Query # # COMMIT +show status like 'Handler_prepare'; +Variable_name Value +Handler_prepare 0 drop table t1; uninstall plugin innodb; Warnings: diff --git a/mysql-test/r/innodb_mrr_cpk.result b/mysql-test/r/innodb_mrr_cpk.result index 99ed73a3e83..28d7dd51df8 100644 --- a/mysql-test/r/innodb_mrr_cpk.result +++ b/mysql-test/r/innodb_mrr_cpk.result @@ -11,7 +11,7 @@ create table t1(a char(8), b char(8), filler char(100), primary key(a)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` char(8) NOT NULL DEFAULT '', + `a` char(8) NOT NULL, `b` char(8) DEFAULT NULL, `filler` char(100) DEFAULT NULL, PRIMARY KEY (`a`) diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result index 82f3977e231..59be24dbddc 100644 --- a/mysql-test/r/insert.result +++ b/mysql-test/r/insert.result @@ -20,7 +20,7 @@ insert into t1 values (0,"mysql a"); insert into t1 values (0,"r1manic"); insert into t1 values (0,"r1man"); drop table t1; -create table t1 (a int not null auto_increment, primary key (a), t timestamp, c char(10) default "hello", i int); +create table t1 (a int not null auto_increment, primary key (a), t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c char(10) default "hello", i int); insert into t1 values (default,default,default,default), (default,default,default,default), (4,0,"a",5),(default,default,default,default); select a,t>0,c,i from t1; a t>0 c i @@ -92,14 +92,14 @@ create table t1(number int auto_increment primary key, original_value varchar(50 set @value= "aa"; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); Warnings: -Warning 1265 Data truncated for column 'f_double' at row 1 -Warning 1265 Data truncated for column 'f_float' at row 1 -Warning 1265 Data truncated for column 'f_double_7_2' at row 1 -Warning 1265 Data truncated for column 'f_float_4_3' at row 1 -Warning 1265 Data truncated for column 'f_double_u' at row 1 -Warning 1265 Data truncated for column 'f_float_u' at row 1 -Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1 -Warning 1265 Data truncated for column 'f_float_3_1_u' at row 1 +Warning 1366 Incorrect double value: 'aa' for column 'f_double' at row 1 +Warning 1366 Incorrect double value: 'aa' for column 'f_float' at row 1 +Warning 1366 Incorrect double value: 'aa' for column 'f_double_7_2' at row 1 +Warning 1366 Incorrect double value: 'aa' for column 'f_float_4_3' at row 1 +Warning 1366 Incorrect double value: 'aa' for column 'f_double_u' at row 1 +Warning 1366 Incorrect double value: 'aa' for column 'f_float_u' at row 1 +Warning 1366 Incorrect double value: 'aa' for column 'f_double_15_1_u' at row 1 +Warning 1366 Incorrect double value: 'aa' for column 'f_float_3_1_u' at row 1 select * from t1 where number =last_insert_id(); number 1 original_value aa @@ -136,14 +136,14 @@ f_float_3_1_u 1.0 set @value= "aa1"; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); Warnings: -Warning 1265 Data truncated for column 'f_double' at row 1 -Warning 1265 Data truncated for column 'f_float' at row 1 -Warning 1265 Data truncated for column 'f_double_7_2' at row 1 -Warning 1265 Data truncated for column 'f_float_4_3' at row 1 -Warning 1265 Data truncated for column 'f_double_u' at row 1 -Warning 1265 Data truncated for column 'f_float_u' at row 1 -Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1 -Warning 1265 Data truncated for column 'f_float_3_1_u' at row 1 +Warning 1366 Incorrect double value: 'aa1' for column 'f_double' at row 1 +Warning 1366 Incorrect double value: 'aa1' for column 'f_float' at row 1 +Warning 1366 Incorrect double value: 'aa1' for column 'f_double_7_2' at row 1 +Warning 1366 Incorrect double value: 'aa1' for column 'f_float_4_3' at row 1 +Warning 1366 Incorrect double value: 'aa1' for column 'f_double_u' at row 1 +Warning 1366 Incorrect double value: 'aa1' for column 'f_float_u' at row 1 +Warning 1366 Incorrect double value: 'aa1' for column 'f_double_15_1_u' at row 1 +Warning 1366 Incorrect double value: 'aa1' for column 'f_float_3_1_u' at row 1 select * from t1 where number =last_insert_id(); number 3 original_value aa1 diff --git a/mysql-test/r/insert_notembedded.result b/mysql-test/r/insert_notembedded.result index ba3e2221922..41e31508fe0 100644 --- a/mysql-test/r/insert_notembedded.result +++ b/mysql-test/r/insert_notembedded.result @@ -1,3 +1,5 @@ +set local sql_mode=""; +set global sql_mode=""; drop table if exists t1; create table t1 (n int); create view v1 as select * from t1; @@ -125,3 +127,5 @@ a b unlock tables; drop table t1; set low_priority_updates=default; +set local sql_mode=default; +set global sql_mode=default; diff --git a/mysql-test/r/join_cache.result b/mysql-test/r/join_cache.result index c1dbef08c04..90d305fb384 100644 --- a/mysql-test/r/join_cache.result +++ b/mysql-test/r/join_cache.result @@ -39,7 +39,7 @@ COUNT(*) 984 show variables like 'join_buffer_size'; Variable_name Value -join_buffer_size 131072 +join_buffer_size 262144 set join_cache_level=1; show variables like 'join_cache_level'; Variable_name Value @@ -774,7 +774,7 @@ set join_cache_level=default; set join_buffer_size=default; show variables like 'join_buffer_size'; Variable_name Value -join_buffer_size 131072 +join_buffer_size 262144 show variables like 'join_cache_level'; Variable_name Value join_cache_level 2 @@ -808,7 +808,7 @@ INDEX (Percentage) ); show variables like 'join_buffer_size'; Variable_name Value -join_buffer_size 131072 +join_buffer_size 262144 set join_cache_level=3; show variables like 'join_cache_level'; Variable_name Value @@ -1008,7 +1008,7 @@ Russian Federation NULL Vietnam NULL show variables like 'join_buffer_size'; Variable_name Value -join_buffer_size 131072 +join_buffer_size 262144 set join_cache_level=4; show variables like 'join_cache_level'; Variable_name Value @@ -1267,7 +1267,7 @@ Czech Republic 10278100 NULL NULL DROP INDEX City_Name ON City; show variables like 'join_buffer_size'; Variable_name Value -join_buffer_size 131072 +join_buffer_size 262144 set join_cache_level=5; show variables like 'join_cache_level'; Variable_name Value @@ -2688,7 +2688,7 @@ set join_cache_level=default; set join_buffer_size=default; show variables like 'join_buffer_size'; Variable_name Value -join_buffer_size 131072 +join_buffer_size 262144 show variables like 'join_cache_level'; Variable_name Value join_cache_level 2 @@ -4321,6 +4321,23 @@ h n v p +EXPLAIN +SELECT t2.v FROM t1, t2, t3 +WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 +GROUP BY t2.v ORDER BY t1.pk,t2.v; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort +1 SIMPLE t3 eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 Using where +1 SIMPLE t1 ref idx2 idx2 3 test.t3.v 5 Using where +SELECT t2.v FROM t1, t2, t3 +WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 +GROUP BY t2.v ORDER BY t1.pk,t2.v; +v +b +h +n +v +p SET SESSION join_cache_level=6; EXPLAIN SELECT t2.v FROM t1, t2, t3 @@ -4339,6 +4356,23 @@ h n v p +EXPLAIN +SELECT t2.v FROM t1, t2, t3 +WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 +GROUP BY t2.v ORDER BY t1.pk,t2.v; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort +1 SIMPLE t3 eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t1 ref idx2 idx2 3 test.t3.v 5 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +SELECT t2.v FROM t1, t2, t3 +WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 +GROUP BY t2.v ORDER BY t1.pk,t2.v; +v +b +h +n +v +p SET SESSION join_cache_level=4; EXPLAIN SELECT t2.v FROM t1, t2, t3 @@ -4357,6 +4391,23 @@ h n v p +EXPLAIN +SELECT t2.v FROM t1, t2, t3 +WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 +GROUP BY t2.v ORDER BY t1.pk,t2.v; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort +1 SIMPLE t3 hash_ALL PRIMARY,idx2 #hash#PRIMARY 4 test.t2.i 20 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t1 hash_ALL idx2 #hash#idx2 3 test.t3.v 44 Using where; Using join buffer (incremental, BNLH join) +SELECT t2.v FROM t1, t2, t3 +WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 +GROUP BY t2.v ORDER BY t1.pk,t2.v; +v +b +h +n +v +p DROP TABLE t1,t2,t3; SET SESSION join_cache_level=DEFAULT; # @@ -5867,7 +5918,7 @@ select @@join_buffer_space_limit; 8192 select @@join_buffer_size; @@join_buffer_size -131072 +262144 explain select count(*) from t1, t1 t2 where t1.a=t2.a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 11 diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index 40abc197a36..820d66b9264 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -2090,10 +2090,10 @@ SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where; Using filesort +1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where 1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Warnings: -Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (((`test`.`t1`.`pk` between 5 and 6) and isnull(`test`.`t1`.`b`)) or (`test`.`t1`.`b` = 5))) order by `test`.`t1`.`b` +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = 5)) order by `test`.`t1`.`b` SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; @@ -2245,4 +2245,32 @@ SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a WHERE b IN (1,2,3) OR b = d; a b c d DROP TABLE t1,t2,t3; +# +# MDEV-6634: Wrong estimates for ref(const) and key IS NULL predicate +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, b int, c int, key(b), key(c)); +insert into t2 select +@a:=A.a + 10*B.a+100*C.a, +IF(@a<900, NULL, @a), +IF(@a<500, NULL, @a) +from t1 A, t1 B, t1 C; +delete from t1 where a=0; +# Check that there are different #rows of NULLs for b and c, both !=10: +explain select * from t2 force index (b) where b is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref b b 5 const 780 Using index condition +explain select * from t2 force index (c) where c is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref c c 5 const 393 Using index condition +explain select * from t1 left join t2 on t2.b is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 9 +1 SIMPLE t2 ref b b 5 const 780 Using where +explain select * from t1 left join t2 on t2.c is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 9 +1 SIMPLE t2 ref c c 5 const 393 Using where +drop table t1,t2; SET optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result index 81395612269..4412f8059dd 100644 --- a/mysql-test/r/join_outer_jcl6.result +++ b/mysql-test/r/join_outer_jcl6.result @@ -2101,10 +2101,10 @@ SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where; Using filesort +1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where 1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Warnings: -Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (((`test`.`t1`.`pk` between 5 and 6) and isnull(`test`.`t1`.`b`)) or (`test`.`t1`.`b` = 5))) order by `test`.`t1`.`b` +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = 5)) order by `test`.`t1`.`b` SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; @@ -2256,6 +2256,34 @@ SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a WHERE b IN (1,2,3) OR b = d; a b c d DROP TABLE t1,t2,t3; +# +# MDEV-6634: Wrong estimates for ref(const) and key IS NULL predicate +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, b int, c int, key(b), key(c)); +insert into t2 select +@a:=A.a + 10*B.a+100*C.a, +IF(@a<900, NULL, @a), +IF(@a<500, NULL, @a) +from t1 A, t1 B, t1 C; +delete from t1 where a=0; +# Check that there are different #rows of NULLs for b and c, both !=10: +explain select * from t2 force index (b) where b is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref b b 5 const 780 Using index condition +explain select * from t2 force index (c) where c is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref c c 5 const 393 Using index condition +explain select * from t1 left join t2 on t2.b is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 9 +1 SIMPLE t2 ref b b 5 const 780 Using where +explain select * from t1 left join t2 on t2.c is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 9 +1 SIMPLE t2 ref c c 5 const 393 Using where +drop table t1,t2; SET optimizer_switch=@save_optimizer_switch; set join_cache_level=default; show variables like 'join_cache_level'; diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result index a89a79dadbb..9b3dcedf7be 100644 --- a/mysql-test/r/key.result +++ b/mysql-test/r/key.result @@ -418,7 +418,7 @@ create table t1 ( c1 int, c2 char(12), c3 varchar(123), -c4 timestamp, +c4 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, index (c1), index i1 (c1), index i2 (c2), @@ -433,8 +433,8 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, - `c2` char(12) NOT NULL DEFAULT '', - `c3` varchar(123) NOT NULL DEFAULT '', + `c2` char(12) NOT NULL, + `c3` varchar(123) NOT NULL, `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`c2`,`c3`), UNIQUE KEY `i4` (`c4`), @@ -471,9 +471,9 @@ ERROR 42000: Can't DROP 'PRIMARY'; check that column/key exists show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` int(11) NOT NULL DEFAULT '0', - `c2` char(12) NOT NULL DEFAULT '', - `c3` varchar(123) NOT NULL DEFAULT '', + `c1` int(11) NOT NULL, + `c2` char(12) NOT NULL, + `c3` varchar(123) NOT NULL, `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, KEY `i1` (`c1`), KEY `i5` (`c1`,`c2`,`c3`,`c4`), diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result index 6afce67cc1a..d40c4ee758c 100644 --- a/mysql-test/r/kill.result +++ b/mysql-test/r/kill.result @@ -1,3 +1,5 @@ +set local sql_mode=""; +set global sql_mode=""; SET DEBUG_SYNC = 'RESET'; DROP TABLE IF EXISTS t1, t2, t3; DROP FUNCTION IF EXISTS MY_KILL; @@ -24,7 +26,7 @@ SELECT 4; 4 4 KILL (SELECT COUNT(*) FROM mysql.user); -ERROR 42000: This version of MariaDB doesn't yet support 'Usage of subqueries or stored function calls as part of this statement' +ERROR 42000: KILL does not support subqueries or stored functions. SET DEBUG_SYNC= 'thread_end SIGNAL con1_end'; SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read WAIT_FOR kill'; SET DEBUG_SYNC= 'now WAIT_FOR con1_read'; @@ -308,5 +310,18 @@ SLEEP(1000) 1 KILL QUERY ID 0; ERROR HY000: Unknown query id: 0 +# +# MDEV-5096 - Wrong error message on attempt to kill somebody else's +# query ID +# +CREATE USER u1@localhost; +SELECT SLEEP(1000); +KILL QUERY ID ID; +ERROR HY000: You are not owner of query ID +KILL QUERY ID @id; +SLEEP(1000) +1 +DROP USER u1@localhost; SET DEBUG_SYNC = 'RESET'; DROP FUNCTION MY_KILL; +set global sql_mode=default; diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index 2d67d24bedd..8cd3b0a7ac8 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -43,8 +43,11 @@ drop table t1; create table t1 (a int, b char(10)); load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines; Warnings: +Note 1265 Data truncated for column 'a' at row 1 +Note 1265 Data truncated for column 'a' at row 2 Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3 Warning 1262 Row 3 was truncated; it contained more data than there were input columns +Note 1265 Data truncated for column 'a' at row 4 Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 5 Warning 1262 Row 5 was truncated; it contained more data than there were input columns select * from t1; @@ -57,6 +60,9 @@ a b truncate table t1; load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines; Warnings: +Note 1265 Data truncated for column 'a' at row 1 +Note 1265 Data truncated for column 'a' at row 2 +Note 1265 Data truncated for column 'a' at row 3 Warning 1366 Incorrect integer value: ' ' for column 'a' at row 4 Warning 1261 Row 4 doesn't contain data for all columns @@ -73,6 +79,8 @@ insert into t1 values(0); select * from t1; id 0 +Warnings: +Note 1265 Data truncated for column 'id' at row 1 select * from t1; id 0 @@ -180,6 +188,13 @@ NULL 10 10 NULL 15 15 truncate table t1; load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow"; +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +Note 1265 Data truncated for column 'b' at row 1 +Note 1265 Data truncated for column 'a' at row 2 +Note 1265 Data truncated for column 'b' at row 2 +Note 1265 Data truncated for column 'a' at row 3 +Note 1265 Data truncated for column 'b' at row 3 select * from t1; a b c 1 2 Wow @@ -187,6 +202,13 @@ a b c 5 6 Wow truncate table t1; load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c)); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +Note 1265 Data truncated for column 'b' at row 1 +Note 1265 Data truncated for column 'a' at row 2 +Note 1265 Data truncated for column 'b' at row 2 +Note 1265 Data truncated for column 'a' at row 3 +Note 1265 Data truncated for column 'b' at row 3 select * from t1; a b c 1 2 1+2+123+2+NIL @@ -234,7 +256,9 @@ f1 2 delete from t1; Warnings: +Note 1265 Data truncated for column 'f1' at row 1 Warning 1261 Row 1 doesn't contain data for all columns +Note 1265 Data truncated for column 'f1' at row 2 Warning 1261 Row 2 doesn't contain data for all columns select f1 from t1 where f2 <> '0000-00-00 00:00:00' order by f1; f1 diff --git a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result index f9e4a88fe95..12960a4f5f6 100644 --- a/mysql-test/r/lock_multi.result +++ b/mysql-test/r/lock_multi.result @@ -115,7 +115,9 @@ ERROR HY000: Can't execute the query because you have a conflicting read lock UNLOCK TABLES; DROP DATABASE mysqltest_1; ERROR HY000: Can't drop database 'mysqltest_1'; database doesn't exist +set sql_mode=""; create table t1 (f1 int(12) unsigned not null auto_increment, primary key(f1)) engine=innodb; +set sql_mode=default; lock tables t1 write; alter table t1 auto_increment=0; alter table t1 auto_increment=0; diff --git a/mysql-test/r/log_slow.result b/mysql-test/r/log_slow.result index ca8b9e7c439..6a3f48506e3 100644 --- a/mysql-test/r/log_slow.result +++ b/mysql-test/r/log_slow.result @@ -9,8 +9,10 @@ select @@log_slow_verbosity; show variables like "log_slow%"; Variable_name Value +log_slow_admin_statements OFF log_slow_filter admin,filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk log_slow_rate_limit 1 +log_slow_slave_statements OFF log_slow_verbosity set @org_slow_query_log= @@global.slow_query_log; set @@log_slow_filter= "filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk,admin"; @@ -56,6 +58,7 @@ insert_id int(11) NO NULL server_id int(10) unsigned NO NULL sql_text mediumtext NO NULL thread_id bigint(21) unsigned NO NULL +rows_affected int(11) NO NULL flush slow logs; set long_query_time=0.1; set log_slow_filter=''; diff --git a/mysql-test/r/log_state.result b/mysql-test/r/log_state.result index cc6f3709ae4..6e3ab8a991a 100644 --- a/mysql-test/r/log_state.result +++ b/mysql-test/r/log_state.result @@ -39,17 +39,24 @@ select sleep(@long_query_time + 1); sleep(@long_query_time + 1) 0 select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%'; -start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id +start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected # Switch to connection default set global slow_query_log= ON; +set local slow_query_log= ON; # Switch to connection con1 set session long_query_time = @long_query_time; select sleep(@long_query_time + 1); sleep(@long_query_time + 1) 0 select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%'; -start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id -TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 select sleep(@long_query_time + 1) THREAD_ID +start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected +set local slow_query_log= ON; +select sleep(@long_query_time + 2); +sleep(@long_query_time + 2) +0 +select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%'; +start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected +TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 select sleep(@long_query_time + 2) THREAD_ID 0 # Switch to connection default show global variables where Variable_name = 'general_log' or Variable_name = 'slow_query_log'; @@ -62,6 +69,7 @@ set global general_log= OFF; set global slow_query_log= ON; set global slow_query_log= OFF; set global slow_query_log= OFF; +set local slow_query_log= ON; set global general_log= ON; truncate table mysql.general_log; create table t1(f1 int); @@ -124,6 +132,9 @@ Variable_name Value general_log OFF show variables like 'slow_query_log'; Variable_name Value +slow_query_log ON +show global variables like 'slow_query_log'; +Variable_name Value slow_query_log OFF set global general_log=ON; set global log_output=default; diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result index 04cd2f01050..ff5055e1ae4 100644 --- a/mysql-test/r/log_tables.result +++ b/mysql-test/r/log_tables.result @@ -1,3 +1,4 @@ +SET SQL_MODE=""; SET @old_general_log_state = @@global.general_log; SET @old_log_output= @@global.log_output; SET @old_slow_query_log= @@global.slow_query_log; @@ -17,7 +18,7 @@ event_time user_host thread_id server_id command_type argument TIMESTAMP USER_HOST THREAD_ID 1 Query select * from general_log truncate table slow_log; select * from slow_log; -start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id +start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected truncate table general_log; select * from general_log where argument like '%general_log%'; event_time user_host thread_id server_id command_type argument @@ -82,7 +83,8 @@ slow_log CREATE TABLE `slow_log` ( `insert_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, `sql_text` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' show fields from mysql.slow_log; Field Type Null Key Default Extra @@ -98,6 +100,7 @@ insert_id int(11) NO NULL server_id int(10) unsigned NO NULL sql_text mediumtext NO NULL thread_id bigint(21) unsigned NO NULL +rows_affected int(11) NO NULL flush logs; flush tables; SET GLOBAL GENERAL_LOG=ON; @@ -148,8 +151,8 @@ select sleep(2); sleep(2) 0 select * from mysql.slow_log; -start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id -TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 mysql 0 0 1 select sleep(2) THREAD_ID +start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected +TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 mysql 0 0 1 select sleep(2) THREAD_ID 0 set @@session.long_query_time = @saved_long_query_time; alter table mysql.general_log engine=myisam; ERROR HY000: You cannot 'ALTER' a log table if logging is enabled @@ -187,7 +190,8 @@ slow_log CREATE TABLE `slow_log` ( `insert_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, `sql_text` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' alter table mysql.general_log engine=myisam; alter table mysql.slow_log engine=myisam; @@ -215,7 +219,8 @@ slow_log CREATE TABLE `slow_log` ( `insert_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, `sql_text` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Slow log' set global general_log='ON'; set global slow_query_log='ON'; @@ -286,7 +291,8 @@ ON UPDATE CURRENT_TIMESTAMP, `insert_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, `sql_text` mediumtext NOT NULL, -`thread_id` BIGINT(21) UNSIGNED NOT NULL +`thread_id` BIGINT(21) UNSIGNED NOT NULL, +`rows_affected` int(11) NOT NULL ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'; set global general_log='ON'; set global slow_query_log='ON'; @@ -313,7 +319,7 @@ event_time user_host thread_id server_id command_type argument TIMESTAMP USER_HOST THREAD_ID 1 Query select * from general_log truncate table slow_log; select * from slow_log; -start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id +start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected create table general_log_new like general_log; rename table general_log TO renamed_general_log, general_log_new TO general_log; create table slow_log_new like slow_log; @@ -334,9 +340,9 @@ TIMESTAMP USER_HOST THREAD_ID 1 Query select * from slow_log TIMESTAMP USER_HOST THREAD_ID 1 Query create table general_log_new like general_log TIMESTAMP USER_HOST THREAD_ID 1 Query rename table general_log TO renamed_general_log, general_log_new TO general_log select * from slow_log; -start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id +start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected select * from renamed_slow_log; -start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id +start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected set global general_log='OFF'; RENAME TABLE general_log TO general_log2; set global slow_query_log='OFF'; @@ -429,10 +435,10 @@ SELECT "My own slow query", sleep(2); My own slow query sleep(2) My own slow query 0 SELECT * FROM mysql.slow_log WHERE seq >= 2 LIMIT 3; -start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id seq -START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 2 -START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 3 -START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 4 +start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected seq +START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 0 2 +START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 0 3 +START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 0 4 SET GLOBAL slow_query_log = 0; SET SESSION long_query_time =@saved_long_query_time; FLUSH LOGS; @@ -537,7 +543,8 @@ CREATE TABLE `db_17876.slow_log_data` ( `insert_id` int(11) default NULL, `server_id` int(11) default NULL, `sql_text` mediumtext, -`thread_id` bigint(21) unsigned default NULL +`thread_id` bigint(21) unsigned default NULL, +`rows_affected` int(11) default NULL ); CREATE TABLE `db_17876.general_log_data` ( `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, @@ -551,7 +558,7 @@ CREATE procedure `db_17876.archiveSlowLog`() BEGIN DECLARE start_time, query_time, lock_time CHAR(28); DECLARE user_host MEDIUMTEXT; -DECLARE rows_set, rows_examined, last_insert_id, insert_id, server_id INT; +DECLARE rows_set, rows_examined, last_insert_id, insert_id, server_id, rows_affected INT; DECLARE thread_id BIGINT UNSIGNED; DECLARE dbname MEDIUMTEXT; DECLARE sql_text BLOB; @@ -566,14 +573,15 @@ DECLARE CONTINUE HANDLER FOR ER_SP_FETCH_NO_DATA SET done = 1; FETCH cur1 INTO start_time, user_host, query_time, lock_time, rows_set, rows_examined, dbname, last_insert_id, -insert_id, server_id, sql_text, thread_id; +insert_id, server_id, sql_text, thread_id, rows_affected; END; IF NOT done THEN BEGIN INSERT INTO `db_17876.slow_log_data` VALUES(start_time, user_host, query_time, lock_time, rows_set, rows_examined, -dbname, last_insert_id, insert_id, server_id, sql_text, thread_id); +dbname, last_insert_id, insert_id, server_id, sql_text, thread_id, +rows_affected); END; END IF; END; diff --git a/mysql-test/r/lowercase_fs_off.result b/mysql-test/r/lowercase_fs_off.result index d7e1b8c9e5b..dea4670d2c7 100644 --- a/mysql-test/r/lowercase_fs_off.result +++ b/mysql-test/r/lowercase_fs_off.result @@ -1,3 +1,5 @@ +set GLOBAL sql_mode=""; +set LOCAL sql_mode=""; create database d1; grant all on d1.* to 'sample'@'localhost' identified by 'password'; flush privileges; @@ -68,3 +70,4 @@ create trigger t1_bi before insert on t1 for each row set new.a= 1; show triggers like '%T1%'; Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation drop table t1; +set GLOBAL sql_mode=default; diff --git a/mysql-test/r/lowercase_fs_on.result b/mysql-test/r/lowercase_fs_on.result index a090f46cfbf..b844b3f77dd 100644 --- a/mysql-test/r/lowercase_fs_on.result +++ b/mysql-test/r/lowercase_fs_on.result @@ -1,3 +1,4 @@ # # Bug#20198490 : LOWER_CASE_TABLE_NAMES=0 ON WINDOWS LEADS TO PROBLEMS # +FOUND /\[ERROR\] The server option \'lower_case_table_names\' is configured to use case sensitive table names/ in my_restart.err diff --git a/mysql-test/r/lowercase_table4.result b/mysql-test/r/lowercase_table4.result index 02e2012a186..72c2e9ebf95 100644 --- a/mysql-test/r/lowercase_table4.result +++ b/mysql-test/r/lowercase_table4.result @@ -4,6 +4,9 @@ # CREATE DATABASE XY; USE XY; +set @old_table_open_cache=@@table_open_cache; +set global table_open_cache = 512; +set global table_open_cache = @old_table_open_cache; DROP DATABASE XY; USE TEST; # diff --git a/mysql-test/r/lowercase_table_grant.result b/mysql-test/r/lowercase_table_grant.result index afb54f8c472..009965c0c8e 100644 --- a/mysql-test/r/lowercase_table_grant.result +++ b/mysql-test/r/lowercase_table_grant.result @@ -1,4 +1,5 @@ use mysql; +set sql_mode=""; create database MYSQLtest; grant all on MySQLtest.* to mysqltest_1@localhost; show grants for mysqltest_1@localhost; diff --git a/mysql-test/r/lowercase_table_qcache.result b/mysql-test/r/lowercase_table_qcache.result index f8d34e0f592..9d7e1007e4c 100644 --- a/mysql-test/r/lowercase_table_qcache.result +++ b/mysql-test/r/lowercase_table_qcache.result @@ -1,4 +1,6 @@ set GLOBAL query_cache_size=1355776; +set GLOBAL query_cache_type=ON; +set LOCAL query_cache_type=ON; drop database if exists MySQLtesT; create database MySQLtesT; create table MySQLtesT.t1 (a int); @@ -21,4 +23,5 @@ select * from MySQL.db; show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 -set GLOBAL query_cache_size=0; +set GLOBAL query_cache_size=default; +set GLOBAL query_cache_type=default; diff --git a/mysql-test/r/max_statement_time.result b/mysql-test/r/max_statement_time.result new file mode 100644 index 00000000000..44ee03b813a --- /dev/null +++ b/mysql-test/r/max_statement_time.result @@ -0,0 +1,183 @@ + +# Test the MAX_STATEMENT_TIME option. + +SET @@MAX_STATEMENT_TIME=2; +select @@max_statement_time; +@@max_statement_time +2.000000 +SELECT SLEEP(1); +SLEEP(1) +0 +SELECT SLEEP(3); +SLEEP(3) +1 +SET @@MAX_STATEMENT_TIME=0; +SELECT SLEEP(1); +SLEEP(1) +0 +SHOW STATUS LIKE "max_statement_time_exceeded"; +Variable_name Value +Max_statement_time_exceeded 1 +CREATE TABLE t1 (a INT, b VARCHAR(300)) engine=myisam; +INSERT INTO t1 VALUES (1, 'string'); +SELECT 0; +0 +0 + +# Test the MAX_STATEMENT_TIME option with SF (should have no effect). + +CREATE PROCEDURE p1() +BEGIN +declare tmp int; +SET @@MAX_STATEMENT_TIME=0.0001; +SELECT COUNT(*) INTO tmp FROM t1 WHERE b LIKE '%z%'; +SET @@MAX_STATEMENT_TIME=0; +END| +CREATE PROCEDURE p2() +BEGIN +SET @@MAX_STATEMENT_TIME=5; +END| +SELECT @@MAX_STATEMENT_TIME; +@@MAX_STATEMENT_TIME +0.000000 +CALL p1(); +CALL p2(); +SELECT @@MAX_STATEMENT_TIME; +@@MAX_STATEMENT_TIME +5.000000 +SET @@MAX_STATEMENT_TIME=0; +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP TABLE t1; + +# MAX_STATEMENT_TIME account resource + +set statement sql_mode="" for +GRANT USAGE ON *.* TO user1@localhost WITH MAX_STATEMENT_TIME 1.005; +# con1 +SELECT @@max_statement_time; +@@max_statement_time +1.005000 +# restart and reconnect +set @global.userstat=1; +SELECT @@global.max_statement_time,@@session.max_statement_time; +@@global.max_statement_time @@session.max_statement_time +0.000000 1.005000 +select sleep(100); +sleep(100) +1 +SHOW STATUS LIKE "max_statement_time_exceeded"; +Variable_name Value +Max_statement_time_exceeded 1 +show grants for user1@localhost; +Grants for user1@localhost +GRANT USAGE ON *.* TO 'user1'@'localhost' WITH MAX_STATEMENT_TIME 1.005000 +set @global.userstat=0; +DROP USER user1@localhost; + +# MAX_STATEMENT_TIME status variables. + +flush status; +SET @@max_statement_time=0; +SELECT CONVERT(VARIABLE_VALUE, UNSIGNED) INTO @time_exceeded +FROM INFORMATION_SCHEMA.GLOBAL_STATUS +WHERE VARIABLE_NAME = 'max_statement_time_exceeded'; +SET @@max_statement_time=0.5; +SELECT SLEEP(2); +SLEEP(2) +1 +SHOW STATUS LIKE '%timeout%'; +Variable_name Value +Binlog_group_commit_trigger_timeout 0 +Master_gtid_wait_timeouts 0 +Ssl_default_timeout 0 +Ssl_session_cache_timeouts 0 +SET @@max_statement_time=0; +# Ensure that the counters for: +# - statements that exceeded their maximum execution time +# are incremented. +SELECT 1 AS STATUS FROM INFORMATION_SCHEMA.GLOBAL_STATUS +WHERE VARIABLE_NAME = 'max_statement_time_exceeded' + AND CONVERT(VARIABLE_VALUE, UNSIGNED) > @time_exceeded; +STATUS +1 + +# Check that the appropriate error status is set. + +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +START TRANSACTION; +SELECT * FROM t1 FOR UPDATE; +a +1 +SET @@SESSION.max_statement_time = 0.5; +UPDATE t1 SET a = 2; +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +SHOW WARNINGS; +Level Code Message +Error 1969 Query execution was interrupted (max_statement_time exceeded) +ROLLBACK; +DROP TABLE t1; + +# Test interaction with lock waits. + +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +SET @@SESSION.max_statement_time= 0.5; +LOCK TABLES t1 WRITE; +SELECT @@SESSION.max_statement_time; +@@SESSION.max_statement_time +0.500000 +LOCK TABLES t1 READ; +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +UNLOCK TABLES; +BEGIN; +SELECT * FROM t1; +a +1 +ALTER TABLE t1 ADD COLUMN b INT; +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +ROLLBACK; +SELECT GET_LOCK('lock', 1); +GET_LOCK('lock', 1) +1 +SELECT GET_LOCK('lock', 1); +GET_LOCK('lock', 1) +NULL +SELECT RELEASE_LOCK('lock'); +RELEASE_LOCK('lock') +1 +DROP TABLE t1; +# +# MDEV-7011:MAX_STATEMENT_TIME has no effect in a procedure after +# a previous successful statement +# +create table t1 (i int); +insert into t1 values (1),(2),(3),(4); +insert into t1 select a.* from t1 a, t1 b, t1 c, t1 d, t1 e, t1 f, t1 g; +create procedure pr() +begin +select 1; +select sql_no_cache * from t1 where i > 5; +select sql_no_cache * from t1 where i > 5; +select sleep(2); +end | +set max_statement_time = 0.001; +call pr(); +1 +1 +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +set max_statement_time = 0; +drop procedure pr; +create procedure pr() +begin +select sql_no_cache * from t1 where i > 5; +select sql_no_cache * from t1 where i > 5; +select sleep(2); +end | +set max_statement_time = 0.001; +call pr(); +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +set max_statement_time = 0; +drop procedure pr; +drop table t1; diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index 89aaf48219e..804313af701 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -2270,7 +2270,7 @@ CREATE TABLE t3(a int) ENGINE = MERGE UNION(t1, t2); CREATE TRIGGER tr1 AFTER INSERT ON t3 FOR EACH ROW CALL foo(); SHOW CREATE TRIGGER tr1; Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -tr1 CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER INSERT ON t3 FOR EACH ROW CALL foo() latin1 latin1_swedish_ci latin1_swedish_ci +tr1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER INSERT ON t3 FOR EACH ROW CALL foo() latin1 latin1_swedish_ci latin1_swedish_ci DROP TRIGGER tr1; DROP TABLE t1, t2, t3; # @@ -2545,11 +2545,14 @@ DROP TABLE t1; # Test merge table with too many merge children. # drop table if exists t_parent; -set @save_table_definition_cache=@@global.table_definition_cache; +set @save_table_open_cache=@@global.table_open_cache; # -# Set @@global.table_definition_cache to minimum +# Set @@global.table_open_cache to minimum # -set @@global.table_definition_cache=400; +set @@global.table_open_cache=400; +select @@table_open_cache; +@@table_open_cache +400 set @a=null; # # Create 400 merge children @@ -2573,7 +2576,7 @@ deallocate prepare stmt; # Cleanup # drop table t_parent; -set @@global.table_definition_cache=@save_table_definition_cache; +set @@global.table_open_cache=@save_table_open_cache; DROP DATABASE IF EXISTS mysql_test1; CREATE DATABASE mysql_test1; CREATE TABLE t1 ... DATA DIRECTORY=... INDEX DIRECTORY=... diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result index fcaeb3359f0..ffdab244f31 100644 --- a/mysql-test/r/metadata.result +++ b/mysql-test/r/metadata.result @@ -8,7 +8,7 @@ def hello 253 5 5 N 1 31 8 def NULL 6 0 0 Y 32896 0 63 1 1.0 -1 hello NULL 1 1.0 -1 hello NULL -create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp, l datetime, m enum('a','b'), n set('a','b'), o char(10)); +create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, l datetime, m enum('a','b'), n set('a','b'), o char(10)); select * from t1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def test t1 t1 a a 1 4 0 Y 32768 0 63 @@ -239,7 +239,7 @@ dcol_uns double unsigned, # date/time types date_col date, time_col time, -timestamp_col timestamp, +timestamp_col timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, year_col year, datetime_col datetime, # string types diff --git a/mysql-test/r/mix2_myisam.result b/mysql-test/r/mix2_myisam.result index e824db8928a..bf706b1445d 100644 --- a/mysql-test/r/mix2_myisam.result +++ b/mysql-test/r/mix2_myisam.result @@ -608,7 +608,7 @@ update t1 set sca_pic="test" where sca_pic is null; delete from t1 where sca_code='pd'; drop table t1; set @a:=now(); -CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=MyISAM; +CREATE TABLE t1 (a int not null, b timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, primary key (a)) engine=MyISAM; insert into t1 (a) values(1),(2),(3); select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a; a @@ -843,9 +843,9 @@ number bigint(20) NOT NULL default '0', cname char(15) NOT NULL default '', carrier_id smallint(6) NOT NULL default '0', privacy tinyint(4) NOT NULL default '0', -last_mod_date timestamp NOT NULL, +last_mod_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, last_mod_id smallint(6) NOT NULL default '0', -last_app_date timestamp NOT NULL, +last_app_date timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', last_app_id smallint(6) default '-1', version smallint(6) NOT NULL default '0', assigned_scps int(11) default '0', @@ -862,9 +862,9 @@ number bigint(20) NOT NULL default '0', cname char(15) NOT NULL default '', carrier_id smallint(6) NOT NULL default '0', privacy tinyint(4) NOT NULL default '0', -last_mod_date timestamp NOT NULL, +last_mod_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, last_mod_id smallint(6) NOT NULL default '0', -last_app_date timestamp NOT NULL, +last_app_date timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', last_app_id smallint(6) default '-1', version smallint(6) NOT NULL default '0', assigned_scps int(11) default '0', diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index 688184f2f83..c680339536b 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -181,8 +181,8 @@ ERROR HY000: You are using safe update mode and you tried to update a table with set sql_safe_updates=0; drop table t1,t2; set timestamp=1038401397; -create table t1 (n int(10) not null primary key, d int(10), t timestamp); -create table t2 (n int(10) not null primary key, d int(10), t timestamp); +create table t1 (n int(10) not null primary key, d int(10), t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); +create table t2 (n int(10) not null primary key, d int(10), t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values(1,1,NULL); insert into t2 values(1,10,NULL),(2,20,NULL); set timestamp=1038000000; @@ -422,6 +422,7 @@ create database mysqltest; create table mysqltest.t1 (a int, b int, primary key (a)); create table mysqltest.t2 (a int, b int, primary key (a)); create table mysqltest.t3 (a int, b int, primary key (a)); +create user mysqltest_1@localhost; grant select on mysqltest.* to mysqltest_1@localhost; grant update on mysqltest.t1 to mysqltest_1@localhost; update t1, t2 set t1.b=1 where t1.a=t2.a; diff --git a/mysql-test/r/myisam-optimize.result b/mysql-test/r/myisam-optimize.result new file mode 100644 index 00000000000..9451046fe08 --- /dev/null +++ b/mysql-test/r/myisam-optimize.result @@ -0,0 +1,69 @@ +# +# MDEV-8475 stale .TMM file causes Aria engine to stop serving the table +# +create table t1 (pk int primary key, i int) engine=MyISAM; +insert into t1 values (1,1),(2,2); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `pk` int(11) NOT NULL, + `i` int(11) DEFAULT NULL, + PRIMARY KEY (`pk`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `pk` int(11) NOT NULL, + `i` int(11) DEFAULT NULL, + PRIMARY KEY (`pk`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status Table is already up to date +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `pk` int(11) NOT NULL, + `i` int(11) DEFAULT NULL, + PRIMARY KEY (`pk`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status Table is already up to date +DROP TABLE t1; +create table t1 (pk int primary key, i int) engine=aria; +insert into t1 values (1,1),(2,2); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `pk` int(11) NOT NULL, + `i` int(11) DEFAULT NULL, + PRIMARY KEY (`pk`) +) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `pk` int(11) NOT NULL, + `i` int(11) DEFAULT NULL, + PRIMARY KEY (`pk`) +) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status Table is already up to date +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `pk` int(11) NOT NULL, + `i` int(11) DEFAULT NULL, + PRIMARY KEY (`pk`) +) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status Table is already up to date +DROP TABLE t1; diff --git a/mysql-test/r/myisam-system.result b/mysql-test/r/myisam-system.result index af5de8f2749..e489f87948a 100644 --- a/mysql-test/r/myisam-system.result +++ b/mysql-test/r/myisam-system.result @@ -2,18 +2,18 @@ drop table if exists t1,t2; create table t1 (a int) engine=myisam; drop table if exists t1; Warnings: -Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") +Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") create table t1 (a int) engine=myisam; select * from t1; ERROR HY000: Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") drop table t1; Warnings: -Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") +Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") create table t1 (a int) engine=myisam; select * from t1; ERROR HY000: File './test/t1.MYD' not found (Errcode: 2 "No such file or directory") drop table t1; Warnings: -Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") +Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") drop table t1; ERROR 42S02: Unknown table 'test.t1' diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 5506e4e419c..093de1339f3 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -656,7 +656,7 @@ test.t2 984116287 drop table t1, t2; show variables like 'myisam_stats_method'; Variable_name Value -myisam_stats_method nulls_unequal +myisam_stats_method NULLS_UNEQUAL create table t1 (a int, key(a)); insert into t1 values (0),(1),(2),(3),(4); insert into t1 select NULL from t1; @@ -677,7 +677,7 @@ t1 1 a 1 a A 10 NULL NULL YES BTREE set myisam_stats_method=nulls_equal; show variables like 'myisam_stats_method'; Variable_name Value -myisam_stats_method nulls_equal +myisam_stats_method NULLS_EQUAL insert into t1 values (11); delete from t1 where a=11; analyze table t1; @@ -697,7 +697,7 @@ t1 1 a 1 a A 5 NULL NULL YES BTREE set myisam_stats_method=DEFAULT; show variables like 'myisam_stats_method'; Variable_name Value -myisam_stats_method nulls_unequal +myisam_stats_method NULLS_UNEQUAL insert into t1 values (11); delete from t1 where a=11; analyze table t1; @@ -718,7 +718,7 @@ drop table t1; set myisam_stats_method=nulls_ignored; show variables like 'myisam_stats_method'; Variable_name Value -myisam_stats_method nulls_ignored +myisam_stats_method NULLS_IGNORED create table t1 ( a char(3), b char(4), c char(5), d char(6), key(a,b,c,d) diff --git a/mysql-test/r/myisam_explain_non_select_all.result b/mysql-test/r/myisam_explain_non_select_all.result index 3dfa56c38d6..fc0f54286a1 100644 --- a/mysql-test/r/myisam_explain_non_select_all.result +++ b/mysql-test/r/myisam_explain_non_select_all.result @@ -674,14 +674,14 @@ FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE t1.a > 0 ORDER BY t1.a; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > 0) order by `test`.`t1`.`a` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_first 1 +Handler_read_key 1 Handler_read_next 3 # Status of testing query execution: Variable_name Value @@ -2785,10 +2785,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 DROP TABLE t1,t2; #74 -CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; -Warnings: -Warning 1286 Unknown storage engine 'InnoDB' -Warning 1266 Using storage engine MyISAM for table 't1' +CREATE TABLE t1(a INT PRIMARY KEY); INSERT INTO t1 VALUES (1), (2), (3), (4), (5); # used key is modified & Using temporary # diff --git a/mysql-test/r/myisam_icp.result b/mysql-test/r/myisam_icp.result index 49cba60320d..e726a50d89b 100644 --- a/mysql-test/r/myisam_icp.result +++ b/mysql-test/r/myisam_icp.result @@ -414,17 +414,11 @@ DROP TABLE t1; # Bug#59259 "Incorrect rows returned for a correlated subquery # when ICP is on" # -CREATE TABLE t1 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL) ENGINE=InnoDB; -Warnings: -Warning 1286 Unknown storage engine 'InnoDB' -Warning 1266 Using storage engine MyISAM for table 't1' +CREATE TABLE t1 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL); INSERT INTO t1 VALUES (11,0); INSERT INTO t1 VALUES (12,5); INSERT INTO t1 VALUES (15,0); -CREATE TABLE t2 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL) ENGINE=InnoDB; -Warnings: -Warning 1286 Unknown storage engine 'InnoDB' -Warning 1266 Using storage engine MyISAM for table 't2' +CREATE TABLE t2 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL); INSERT INTO t2 VALUES (11,1); INSERT INTO t2 VALUES (12,2); INSERT INTO t2 VALUES (15,4); @@ -604,6 +598,16 @@ SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 WHERE t2.pk <> t1.d1 AND t2.pk = 4; d1 pk i1 1 4 1 +EXPLAIN +SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 +WHERE t1.d1 <> t2.pk AND t2.pk = 4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL k1 9 NULL 3 Using index +1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using where +SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 +WHERE t1.d1 <> t2.pk AND t2.pk = 4; +d1 pk i1 +1 4 1 DROP TABLE t1, t2; # # BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89 diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index cb705d285fe..ca19d2eb98b 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -1,3 +1,5 @@ +set GLOBAL sql_mode=""; +set LOCAL sql_mode=""; drop table if exists t1,t2,t3; create table t1(a int); insert into t1 values(1); @@ -519,5 +521,18 @@ a | a | | aaaaaaaaaaaaaaaaa | +-------------------+ +# +# Start of 10.1 tests +# +# +# MDEV-6572 "USE dbname" with a bad sequence erroneously connects to a wrong database +# +# +# End of 10.1 tests +# +ERROR 1300 (HY000): Invalid utf8 character string: 'test\xF0\x9F\x98\x81 ' +ERROR 1300 (HY000): Invalid binary character string: 'test\xF0\x9F\x98\x81 ' +ERROR 1300 (HY000) at line 2: Invalid utf8 character string: 'test\xF0\x9F\x98\x81' +set GLOBAL sql_mode=default; End of tests diff --git a/mysql-test/r/mysql_comments.result b/mysql-test/r/mysql_comments.result index 7f1c0b50c5e..4865c7a7af0 100644 --- a/mysql-test/r/mysql_comments.result +++ b/mysql-test/r/mysql_comments.result @@ -1,3 +1,4 @@ +set global sql_mode=""; drop table if exists t1; drop function if exists foofct; drop procedure if exists empty; @@ -59,4 +60,5 @@ Trigger sql_mode SQL Original Statement character_set_client collation_connectio t1_bi CREATE DEFINER=`root`@`localhost` trigger t1_bi before insert on t1\nfor each row\nbegin\n# comment 1a\n-- comment 1b\n/*\n comment 1c\n*/\n -- declare some variables here\n declare b int;\n declare c float;\n\n -- do more stuff here\n -- commented nicely and so on\n\n -- famous last words ...\n set NEW.data := 12;\nend latin1 latin1_swedish_ci latin1_swedish_ci id data trig 12 +set global sql_mode=default; End of 5.0 tests diff --git a/mysql-test/r/mysql_tzinfo_to_sql_symlink.result b/mysql-test/r/mysql_tzinfo_to_sql_symlink.result index f127e756987..03543244105 100644 --- a/mysql-test/r/mysql_tzinfo_to_sql_symlink.result +++ b/mysql-test/r/mysql_tzinfo_to_sql_symlink.result @@ -2,6 +2,9 @@ # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above # # Verbose run +set @prep=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET GLOBAL wsrep_replicate_myisam=?', 'do ?'); +prepare set_wsrep_myisam from @prep; +set @toggle=1; execute set_wsrep_myisam using @toggle; TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_transition; @@ -25,7 +28,11 @@ Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zo Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion. ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; +set @toggle=0; execute set_wsrep_myisam using @toggle; # Silent run +set @prep=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET GLOBAL wsrep_replicate_myisam=?', 'do ?'); +prepare set_wsrep_myisam from @prep; +set @toggle=1; execute set_wsrep_myisam using @toggle; TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_transition; @@ -46,26 +53,39 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; +set @toggle=0; execute set_wsrep_myisam using @toggle; # # Testing with explicit timezonefile # +set @prep=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET GLOBAL wsrep_replicate_myisam=?', 'do ?'); +prepare set_wsrep_myisam from @prep; +set @toggle=1; execute set_wsrep_myisam using @toggle; INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); SET @time_zone_id= LAST_INSERT_ID(); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id); INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES (@time_zone_id, 0, 0, 0, 'GMT') ; +set @toggle=0; execute set_wsrep_myisam using @toggle; # # Testing --leap # +set @prep=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET GLOBAL wsrep_replicate_myisam=?', 'do ?'); +prepare set_wsrep_myisam from @prep; +set @toggle=1; execute set_wsrep_myisam using @toggle; TRUNCATE TABLE time_zone_leap_second; ALTER TABLE time_zone_leap_second ORDER BY Transition_time; +set @toggle=0; execute set_wsrep_myisam using @toggle; # # MDEV-6236 - [PATCH] mysql_tzinfo_to_sql may produce invalid SQL # +set @prep=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET GLOBAL wsrep_replicate_myisam=?', 'do ?'); +prepare set_wsrep_myisam from @prep; +set @toggle=1; execute set_wsrep_myisam using @toggle; TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition_type; ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; +set @toggle=0; execute set_wsrep_myisam using @toggle; diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result index 9ba5344fad0..d10e042729f 100644 --- a/mysql-test/r/mysql_upgrade.result +++ b/mysql-test/r/mysql_upgrade.result @@ -1,3 +1,4 @@ +set sql_mode=""; Run mysql_upgrade once Phase 1/6: Checking and upgrading mysql database Processing databases @@ -464,4 +465,65 @@ even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@loca even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@localhost DROP USER very_long_user_name_number_1, very_long_user_name_number_2, even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@localhost; DROP PROCEDURE test.pr; +set sql_mode=default; +# Droping the previously created mysql_upgrade_info file.. +create table test.t1(a int) engine=MyISAM; +# Trying to enforce InnoDB for all tables +SET GLOBAL enforce_storage_engine=InnoDB; +Phase 1/6: Checking and upgrading mysql database +Processing databases +mysql +mysql.column_stats OK +mysql.columns_priv OK +mysql.db OK +mysql.event OK +mysql.func OK +mysql.gtid_slave_pos OK +mysql.help_category OK +mysql.help_keyword OK +mysql.help_relation OK +mysql.help_topic OK +mysql.host OK +mysql.index_stats OK +mysql.innodb_index_stats OK +mysql.innodb_table_stats OK +mysql.plugin OK +mysql.proc OK +mysql.procs_priv OK +mysql.proxies_priv OK +mysql.roles_mapping OK +mysql.servers OK +mysql.table_stats OK +mysql.tables_priv OK +mysql.time_zone OK +mysql.time_zone_leap_second OK +mysql.time_zone_name OK +mysql.time_zone_transition OK +mysql.time_zone_transition_type OK +mysql.user OK +Phase 2/6: Fixing views +Phase 3/6: Running 'mysql_fix_privilege_tables' +Phase 4/6: Fixing table and database names +Phase 5/6: Checking and upgrading tables +Processing databases +information_schema +mtr +mtr.global_suppressions OK +mtr.test_suppressions OK +performance_schema +test +test.t1 OK +Phase 6/6: Running 'FLUSH PRIVILEGES' +OK +# Should return 2 +SELECT count(*) FROM information_schema.tables where ENGINE="InnoDB"; +count(*) +2 +SHOW CREATE TABLE test.t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE test.t1; +SET GLOBAL enforce_storage_engine=NULL; End of tests diff --git a/mysql-test/r/mysql_upgrade_view.result b/mysql-test/r/mysql_upgrade_view.result index 7966941cb1f..f43f42f97fd 100644 --- a/mysql-test/r/mysql_upgrade_view.result +++ b/mysql-test/r/mysql_upgrade_view.result @@ -268,6 +268,7 @@ test.kv OK test.t1 OK Phase 6/6: Running 'FLUSH PRIVILEGES' OK +flush tables; show create view v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` utf8 utf8_general_ci diff --git a/mysql-test/r/mysqlbinlog-innodb.result b/mysql-test/r/mysqlbinlog-innodb.result index f0358928c0e..2704be9e3ed 100644 --- a/mysql-test/r/mysqlbinlog-innodb.result +++ b/mysql-test/r/mysqlbinlog-innodb.result @@ -30,7 +30,7 @@ use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/; -SET @@session.sql_mode=0/*!*/; +SET @@session.sql_mode=1342177280/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; @@ -61,7 +61,7 @@ use `foo`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/; -SET @@session.sql_mode=0/*!*/; +SET @@session.sql_mode=1342177280/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index b29fe0b9ec7..94aaee0c574 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -23,7 +23,7 @@ use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/; -SET @@session.sql_mode=0/*!*/; +SET @@session.sql_mode=1342177280/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; @@ -103,7 +103,7 @@ use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/; -SET @@session.sql_mode=0/*!*/; +SET @@session.sql_mode=1342177280/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; @@ -139,7 +139,7 @@ BEGIN SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/; -SET @@session.sql_mode=0/*!*/; +SET @@session.sql_mode=1342177280/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; @@ -190,7 +190,7 @@ use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/; -SET @@session.sql_mode=0/*!*/; +SET @@session.sql_mode=1342177280/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; @@ -217,7 +217,7 @@ use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/; -SET @@session.sql_mode=0/*!*/; +SET @@session.sql_mode=1342177280/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; @@ -297,7 +297,7 @@ use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/; -SET @@session.sql_mode=0/*!*/; +SET @@session.sql_mode=1342177280/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; @@ -333,7 +333,7 @@ BEGIN SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/; -SET @@session.sql_mode=0/*!*/; +SET @@session.sql_mode=1342177280/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; @@ -384,7 +384,7 @@ use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/; -SET @@session.sql_mode=0/*!*/; +SET @@session.sql_mode=1342177280/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; @@ -493,7 +493,7 @@ use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/; -SET @@session.sql_mode=0/*!*/; +SET @@session.sql_mode=1342177280/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; @@ -545,7 +545,7 @@ use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/; -SET @@session.sql_mode=0/*!*/; +SET @@session.sql_mode=1342177280/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; diff --git a/mysql-test/r/mysqlbinlog_raw_mode.result b/mysql-test/r/mysqlbinlog_raw_mode.result new file mode 100644 index 00000000000..b64a2148a82 --- /dev/null +++ b/mysql-test/r/mysqlbinlog_raw_mode.result @@ -0,0 +1,274 @@ +reset master; +set timestamp=1000000000; +drop table if exists t1; +CREATE TABLE t1 (c01 BIT); +INSERT INTO t1 VALUES (0); +INSERT INTO t1 VALUES (1); +DROP TABLE t1; +CREATE TABLE t1 (c01 BIT(7)); +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (8); +INSERT INTO t1 VALUES (16); +INSERT INTO t1 VALUES (32); +INSERT INTO t1 VALUES (64); +INSERT INTO t1 VALUES (127); +DELETE FROM t1 WHERE c01=127; +UPDATE t1 SET c01=15 WHERE c01=16; +DROP TABLE t1; +CREATE TABLE t1 (a BIT(20), b CHAR(2)); +INSERT INTO t1 VALUES (b'00010010010010001001', 'ab'); +DROP TABLE t1; +CREATE TABLE t1 (c02 BIT(64)); +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (128); +INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111111111111'); +DROP TABLE t1; +CREATE TABLE t1 (c03 TINYINT); +INSERT INTO t1 VALUES (1),(2),(3); +INSERT INTO t1 VALUES (-128); +UPDATE t1 SET c03=2 WHERE c03=1; +DELETE FROM t1 WHERE c03=-128; +DROP TABLE t1; +CREATE TABLE t1 (c04 TINYINT UNSIGNED); +INSERT INTO t1 VALUES (128), (255); +UPDATE t1 SET c04=2 WHERE c04=1; +DELETE FROM t1 WHERE c04=255; +DROP TABLE t1; +CREATE TABLE t1 (c06 BOOL); +INSERT INTO t1 VALUES (TRUE); +DELETE FROM t1 WHERE c06=TRUE; +DROP TABLE t1; +CREATE TABLE t1 (c07 SMALLINT); +INSERT INTO t1 VALUES (1234); +DELETE FROM t1 WHERE c07=1234; +DROP TABLE t1; +CREATE TABLE t1 (c08 SMALLINT UNSIGNED); +INSERT INTO t1 VALUES (32768), (65535); +UPDATE t1 SET c08=2 WHERE c08=32768; +DELETE FROM t1 WHERE c08=65535; +DROP TABLE t1; +CREATE TABLE t1 (c10 MEDIUMINT); +INSERT INTO t1 VALUES (12345); +DELETE FROM t1 WHERE c10=12345; +DROP TABLE t1; +CREATE TABLE t1 (c11 MEDIUMINT UNSIGNED); +INSERT INTO t1 VALUES (8388608), (16777215); +UPDATE t1 SET c11=2 WHERE c11=8388608; +DELETE FROM t1 WHERE c11=16777215; +DROP TABLE t1; +CREATE TABLE t1 (c13 INT); +INSERT INTO t1 VALUES (123456); +DELETE FROM t1 WHERE c13=123456; +DROP TABLE t1; +CREATE TABLE t1 (c14 INT UNSIGNED); +INSERT INTO t1 VALUES (2147483648), (4294967295); +UPDATE t1 SET c14=2 WHERE c14=2147483648; +DELETE FROM t1 WHERE c14=4294967295; +DROP TABLE t1; +CREATE TABLE t1 (c16 BIGINT); +INSERT INTO t1 VALUES (1234567890); +DELETE FROM t1 WHERE c16=1234567890; +DROP TABLE t1; +CREATE TABLE t1 (c17 BIGINT UNSIGNED); +INSERT INTO t1 VALUES (9223372036854775808), (18446744073709551615); +UPDATE t1 SET c17=2 WHERE c17=9223372036854775808; +DELETE FROM t1 WHERE c17=18446744073709551615; +DROP TABLE t1; +CREATE TABLE t1 (c19 FLOAT); +INSERT INTO t1 VALUES (123.2234); +DELETE FROM t1 WHERE c19>123; +DROP TABLE t1; +CREATE TABLE t1 (c22 DOUBLE); +INSERT INTO t1 VALUES (123434.22344545); +DELETE FROM t1 WHERE c22>123434; +DROP TABLE t1; +CREATE TABLE t1 (c25 DECIMAL(10,5)); +INSERT INTO t1 VALUES (124.45); +INSERT INTO t1 VALUES (-543.21); +DELETE FROM t1 WHERE c25=124.45; +DROP TABLE t1; +CREATE TABLE t1 (c28 DATE); +INSERT INTO t1 VALUES ('2001-02-03'); +DELETE FROM t1 WHERE c28='2001-02-03'; +DROP TABLE t1; +CREATE TABLE t1 (c29 DATETIME); +INSERT INTO t1 VALUES ('2001-02-03 10:20:30'); +DELETE FROM t1 WHERE c29='2001-02-03 10:20:30'; +DROP TABLE t1; +CREATE TABLE t1 (c30 TIMESTAMP); +INSERT INTO t1 VALUES ('2001-02-03 10:20:30'); +DELETE FROM t1 WHERE c30='2001-02-03 10:20:30'; +DROP TABLE t1; +CREATE TABLE t1 (c31 TIME); +INSERT INTO t1 VALUES ('11:22:33'); +DELETE FROM t1 WHERE c31='11:22:33'; +DROP TABLE t1; +CREATE TABLE t1 (c32 YEAR); +INSERT INTO t1 VALUES ('2001'); +DELETE FROM t1 WHERE c32=2001; +DROP TABLE t1; +CREATE TABLE t1 (c33 CHAR); +INSERT INTO t1 VALUES ('a'); +DELETE FROM t1 WHERE c33='a'; +DROP TABLE t1; +CREATE TABLE t1 (c34 CHAR(0)); +INSERT INTO t1 VALUES (''); +DELETE FROM t1 WHERE c34=''; +DROP TABLE t1; +CREATE TABLE t1 (c35 CHAR(1)); +INSERT INTO t1 VALUES ('b'); +DELETE FROM t1 WHERE c35='b'; +DROP TABLE t1; +CREATE TABLE t1 (c36 CHAR(255)); +INSERT INTO t1 VALUES (repeat('c',255)); +DELETE FROM t1 WHERE c36>'c'; +DROP TABLE t1; +CREATE TABLE t1 (c37 NATIONAL CHAR); +INSERT INTO t1 VALUES ('a'); +DELETE FROM t1 WHERE c37='a'; +DROP TABLE t1; +CREATE TABLE t1 (c38 NATIONAL CHAR(0)); +INSERT INTO t1 VALUES (''); +DELETE FROM t1 WHERE c38=''; +DROP TABLE t1; +CREATE TABLE t1 (c39 NATIONAL CHAR(1)); +INSERT INTO t1 VALUES ('a'); +DELETE FROM t1 WHERE c39='a'; +DROP TABLE t1; +CREATE TABLE t1 (c40 NATIONAL CHAR(255)); +INSERT INTO t1 VALUES (repeat('a', 255)); +INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255)); +DELETE FROM t1 WHERE c40>'a'; +DROP TABLE t1; +CREATE TABLE t1 (c45 VARCHAR(0)); +INSERT INTO t1 VALUES (''); +DELETE FROM t1 WHERE c45=''; +DROP TABLE t1; +CREATE TABLE t1 (c46 VARCHAR(1)); +INSERT INTO t1 VALUES ('a'); +DELETE FROM t1 WHERE c46='a'; +DROP TABLE t1; +CREATE TABLE t1 (c47 VARCHAR(255)); +INSERT INTO t1 VALUES (repeat('a',255)); +DELETE FROM t1 WHERE c47>'a'; +DROP TABLE t1; +CREATE TABLE t1 (c48 VARCHAR(261)); +INSERT INTO t1 VALUES (repeat('a',261)); +DELETE FROM t1 WHERE c48>'a'; +DROP TABLE t1; +CREATE TABLE t1 (c49 NATIONAL VARCHAR(0)); +INSERT INTO t1 VALUES (''); +DELETE FROM t1 WHERE c49=''; +DROP TABLE t1; +CREATE TABLE t1 (c50 NATIONAL VARCHAR(1)); +INSERT INTO t1 VALUES ('a'); +DELETE FROM t1 WHERE c50='a'; +DROP TABLE t1; +CREATE TABLE t1 (c51 NATIONAL VARCHAR(255)); +INSERT INTO t1 VALUES (repeat('a',255)); +INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255)); +DELETE FROM t1 WHERE c51>'a'; +DROP TABLE t1; +CREATE TABLE t1 (c52 NATIONAL VARCHAR(261)); +INSERT INTO t1 VALUES (repeat('a',261)); +INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 261)); +DELETE FROM t1 WHERE c52>'a'; +DROP TABLE t1; +CREATE TABLE t1 (c57 BINARY); +INSERT INTO t1 VALUES (0x00); +INSERT INTO t1 VALUES (0x02); +INSERT INTO t1 VALUES ('a'); +DELETE FROM t1 WHERE c57='a'; +DROP TABLE t1; +CREATE TABLE t1 (c58 BINARY(0)); +INSERT INTO t1 VALUES (''); +DELETE FROM t1 WHERE c58=''; +DROP TABLE t1; +CREATE TABLE t1 (c59 BINARY(1)); +INSERT INTO t1 VALUES (0x00); +INSERT INTO t1 VALUES (0x02); +INSERT INTO t1 VALUES ('a'); +DELETE FROM t1 WHERE c59='a'; +DROP TABLE t1; +CREATE TABLE t1 (c60 BINARY(255)); +INSERT INTO t1 VALUES (0x00); +INSERT INTO t1 VALUES (0x02); +INSERT INTO t1 VALUES (repeat('a\0',120)); +DELETE FROM t1 WHERE c60<0x02; +DROP TABLE t1; +CREATE TABLE t1 (c61 VARBINARY(0)); +INSERT INTO t1 VALUES (''); +DELETE FROM t1 WHERE c61=''; +DROP TABLE t1; +CREATE TABLE t1 (c62 VARBINARY(1)); +INSERT INTO t1 VALUES (0x00); +INSERT INTO t1 VALUES (0x02); +INSERT INTO t1 VALUES ('a'); +DELETE FROM t1 WHERE c62=0x02; +DROP TABLE t1; +CREATE TABLE t1 (c63 VARBINARY(255)); +INSERT INTO t1 VALUES (0x00); +INSERT INTO t1 VALUES (0x02); +INSERT INTO t1 VALUES (repeat('a\0',120)); +DELETE FROM t1 WHERE c63=0x02; +DROP TABLE t1; +flush logs; +CREATE TABLE t1 (c65 TINYBLOB); +INSERT INTO t1 VALUES ('tinyblob1'); +DELETE FROM t1 WHERE c65='tinyblob1'; +DROP TABLE t1; +CREATE TABLE t1 (c68 BLOB); +INSERT INTO t1 VALUES ('blob1'); +DELETE FROM t1 WHERE c68='blob1'; +DROP TABLE t1; +CREATE TABLE t1 (c71 MEDIUMBLOB); +INSERT INTO t1 VALUES ('mediumblob1'); +DELETE FROM t1 WHERE c71='mediumblob1'; +DROP TABLE t1; +CREATE TABLE t1 (c74 LONGBLOB); +INSERT INTO t1 VALUES ('longblob1'); +DELETE FROM t1 WHERE c74='longblob1'; +DROP TABLE t1; +CREATE TABLE t1 (c66 TINYTEXT); +INSERT INTO t1 VALUES ('tinytext1'); +DELETE FROM t1 WHERE c66='tinytext1'; +DROP TABLE t1; +CREATE TABLE t1 (c69 TEXT); +INSERT INTO t1 VALUES ('text1'); +DELETE FROM t1 WHERE c69='text1'; +DROP TABLE t1; +CREATE TABLE t1 (c72 MEDIUMTEXT); +INSERT INTO t1 VALUES ('mediumtext1'); +DELETE FROM t1 WHERE c72='mediumtext1'; +DROP TABLE t1; +CREATE TABLE t1 (c75 LONGTEXT); +INSERT INTO t1 VALUES ('longtext1'); +DELETE FROM t1 WHERE c75='longtext1'; +DROP TABLE t1; +CREATE TABLE t1 (c77 ENUM('a','b','c')); +INSERT INTO t1 VALUES ('b'); +DELETE FROM t1 WHERE c77='b'; +DROP TABLE t1; +CREATE TABLE t1 (c78 SET('a','b','c','d','e','f')); +INSERT INTO t1 VALUES ('a,b'); +INSERT INTO t1 VALUES ('a,c'); +INSERT INTO t1 VALUES ('b,c'); +INSERT INTO t1 VALUES ('a,b,c'); +INSERT INTO t1 VALUES ('a,b,c,d'); +INSERT INTO t1 VALUES ('a,b,c,d,e'); +INSERT INTO t1 VALUES ('a,b,c,d,e,f'); +DELETE FROM t1 WHERE c78='a,b'; +DROP TABLE t1; +CREATE TABLE t1 (a int NOT NULL DEFAULT 0, b int NOT NULL DEFAULT 0); +CREATE TABLE t2 (a int NOT NULL DEFAULT 0, b int NOT NULL DEFAULT 0); +INSERT INTO t1 SET a=1; +INSERT INTO t1 SET b=1; +INSERT INTO t2 SET a=1; +INSERT INTO t2 SET b=1; +UPDATE t1, t2 SET t1.a=10, t2.a=20; +DROP TABLE t1,t2; +flush logs; +End of tests diff --git a/mysql-test/r/mysqlbinlog_row_big.result b/mysql-test/r/mysqlbinlog_row_big.result index 0bdbfdcee3a..70e39266d1d 100644 --- a/mysql-test/r/mysqlbinlog_row_big.result +++ b/mysql-test/r/mysqlbinlog_row_big.result @@ -97,6 +97,6 @@ FLUSH LOGS; # Cleanup. # # reset variable value to pass testcase checks -SET @@global.max_allowed_packet = 1048576; +SET @@global.max_allowed_packet = 4194304; DROP TABLE t1; remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_big_1.out diff --git a/mysql-test/r/mysqlbinlog_row_minimal.result b/mysql-test/r/mysqlbinlog_row_minimal.result new file mode 100644 index 00000000000..6ffaeeafc53 --- /dev/null +++ b/mysql-test/r/mysqlbinlog_row_minimal.result @@ -0,0 +1,300 @@ +CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)); +CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1)); +INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, ""); +INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL); +INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A"); +INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A"); +INSERT INTO t2 SELECT * FROM t1; +UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL; +DELETE FROM t1; +DELETE FROM t2; +FLUSH BINARY LOGS; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +# at 4 +#<date> server id 1 end_log_pos 249 Start: xxx +ROLLBACK/*!*/; +# at 249 +#<date> server id 1 end_log_pos 274 Gtid list [] +# at 274 +#<date> server id 1 end_log_pos 314 Binlog checkpoint master-bin.000001 +# at 314 +#<date> server id 1 end_log_pos 352 GTID 0-1-1 ddl +/*!100101 SET @@session.skip_parallel_replication=0*//*!*/; +/*!100001 SET @@session.gtid_domain_id=0*//*!*/; +/*!100001 SET @@session.server_id=1*//*!*/; +/*!100001 SET @@session.gtid_seq_no=1*//*!*/; +# at 352 +#<date> server id 1 end_log_pos 532 Query thread_id=4 exec_time=x error_code=0 +use `test`/*!*/; +SET TIMESTAMP=X/*!*/; +SET @@session.pseudo_thread_id=4/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/; +SET @@session.sql_mode=1342177280/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)) +/*!*/; +# at 532 +#<date> server id 1 end_log_pos 570 GTID 0-1-2 ddl +/*!100001 SET @@session.gtid_seq_no=2*//*!*/; +# at 570 +#<date> server id 1 end_log_pos 743 Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1)) +/*!*/; +# at 743 +#<date> server id 1 end_log_pos 781 GTID 0-1-3 +/*!100001 SET @@session.gtid_seq_no=3*//*!*/; +BEGIN +/*!*/; +# at 781 +#<date> server id 1 end_log_pos 833 Table_map: `test`.`t1` mapped to number 30 +# at 833 +#<date> server id 1 end_log_pos 898 Write_rows: table id 30 flags: STMT_END_F +### INSERT INTO `test`.`t1` +### SET +### @1=10 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */ +### @5=4 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# at 898 +#<date> server id 1 end_log_pos 967 Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 967 +#<date> server id 1 end_log_pos 1005 GTID 0-1-4 +/*!100001 SET @@session.gtid_seq_no=4*//*!*/; +BEGIN +/*!*/; +# at 1005 +#<date> server id 1 end_log_pos 1057 Table_map: `test`.`t1` mapped to number 30 +# at 1057 +#<date> server id 1 end_log_pos 1121 Write_rows: table id 30 flags: STMT_END_F +### INSERT INTO `test`.`t1` +### SET +### @1=11 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */ +### @5=4 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */ +# at 1121 +#<date> server id 1 end_log_pos 1190 Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 1190 +#<date> server id 1 end_log_pos 1228 GTID 0-1-5 +/*!100001 SET @@session.gtid_seq_no=5*//*!*/; +BEGIN +/*!*/; +# at 1228 +#<date> server id 1 end_log_pos 1280 Table_map: `test`.`t1` mapped to number 30 +# at 1280 +#<date> server id 1 end_log_pos 1343 Write_rows: table id 30 flags: STMT_END_F +### INSERT INTO `test`.`t1` +### SET +### @1=12 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */ +### @5=NULL /* MEDIUMINT meta=0 nullable=1 is_null=1 */ +### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# at 1343 +#<date> server id 1 end_log_pos 1412 Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 1412 +#<date> server id 1 end_log_pos 1450 GTID 0-1-6 +/*!100001 SET @@session.gtid_seq_no=6*//*!*/; +BEGIN +/*!*/; +# at 1450 +#<date> server id 1 end_log_pos 1502 Table_map: `test`.`t1` mapped to number 30 +# at 1502 +#<date> server id 1 end_log_pos 1568 Write_rows: table id 30 flags: STMT_END_F +### INSERT INTO `test`.`t1` +### SET +### @1=13 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* TINYINT meta=0 nullable=1 is_null=0 */ +### @5=0 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @6=5 /* LONGINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# at 1568 +#<date> server id 1 end_log_pos 1637 Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 1637 +#<date> server id 1 end_log_pos 1675 GTID 0-1-7 +/*!100001 SET @@session.gtid_seq_no=7*//*!*/; +BEGIN +/*!*/; +# at 1675 +#<date> server id 1 end_log_pos 1727 Table_map: `test`.`t2` mapped to number 31 +# at 1727 +#<date> server id 1 end_log_pos 1890 Write_rows: table id 31 flags: STMT_END_F +### INSERT INTO `test`.`t2` +### SET +### @1=10 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* INT meta=0 nullable=1 is_null=0 */ +### @5=4 /* INT meta=0 nullable=1 is_null=0 */ +### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +### INSERT INTO `test`.`t2` +### SET +### @1=11 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* INT meta=0 nullable=1 is_null=0 */ +### @5=4 /* INT meta=0 nullable=1 is_null=0 */ +### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */ +### INSERT INTO `test`.`t2` +### SET +### @1=12 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* INT meta=0 nullable=1 is_null=0 */ +### @5=NULL /* INT meta=0 nullable=1 is_null=1 */ +### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +### INSERT INTO `test`.`t2` +### SET +### @1=13 /* INT meta=0 nullable=0 is_null=0 */ +### @2=1 /* INT meta=0 nullable=1 is_null=0 */ +### @3=2 /* INT meta=0 nullable=1 is_null=0 */ +### @4=3 /* INT meta=0 nullable=1 is_null=0 */ +### @5=0 /* INT meta=0 nullable=1 is_null=0 */ +### @6=5 /* MEDIUMINT meta=0 nullable=1 is_null=0 */ +### @7=6 /* INT meta=0 nullable=1 is_null=0 */ +### @8=7 /* INT meta=0 nullable=1 is_null=0 */ +### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ +# at 1890 +#<date> server id 1 end_log_pos 1959 Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 1959 +#<date> server id 1 end_log_pos 1997 GTID 0-1-8 +/*!100001 SET @@session.gtid_seq_no=8*//*!*/; +BEGIN +/*!*/; +# at 1997 +#<date> server id 1 end_log_pos 2049 Table_map: `test`.`t2` mapped to number 31 +# at 2049 +#<date> server id 1 end_log_pos 2119 Update_rows: table id 31 flags: STMT_END_F +### UPDATE `test`.`t2` +### WHERE +### @1=10 /* INT meta=0 nullable=0 is_null=0 */ +### @5=4 /* INT meta=0 nullable=1 is_null=0 */ +### SET +### @5=5 /* INT meta=0 nullable=1 is_null=0 */ +### UPDATE `test`.`t2` +### WHERE +### @1=11 /* INT meta=0 nullable=0 is_null=0 */ +### @5=4 /* INT meta=0 nullable=1 is_null=0 */ +### SET +### @5=5 /* INT meta=0 nullable=1 is_null=0 */ +### UPDATE `test`.`t2` +### WHERE +### @1=12 /* INT meta=0 nullable=0 is_null=0 */ +### @5=NULL /* INT meta=0 nullable=1 is_null=1 */ +### SET +### @5=5 /* INT meta=0 nullable=1 is_null=0 */ +# at 2119 +#<date> server id 1 end_log_pos 2188 Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 2188 +#<date> server id 1 end_log_pos 2226 GTID 0-1-9 +/*!100001 SET @@session.gtid_seq_no=9*//*!*/; +BEGIN +/*!*/; +# at 2226 +#<date> server id 1 end_log_pos 2278 Table_map: `test`.`t1` mapped to number 30 +# at 2278 +#<date> server id 1 end_log_pos 2328 Delete_rows: table id 30 flags: STMT_END_F +### DELETE FROM `test`.`t1` +### WHERE +### @1=10 /* INT meta=0 nullable=0 is_null=0 */ +### DELETE FROM `test`.`t1` +### WHERE +### @1=11 /* INT meta=0 nullable=0 is_null=0 */ +### DELETE FROM `test`.`t1` +### WHERE +### @1=12 /* INT meta=0 nullable=0 is_null=0 */ +### DELETE FROM `test`.`t1` +### WHERE +### @1=13 /* INT meta=0 nullable=0 is_null=0 */ +# at 2328 +#<date> server id 1 end_log_pos 2397 Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 2397 +#<date> server id 1 end_log_pos 2435 GTID 0-1-10 +/*!100001 SET @@session.gtid_seq_no=10*//*!*/; +BEGIN +/*!*/; +# at 2435 +#<date> server id 1 end_log_pos 2487 Table_map: `test`.`t2` mapped to number 31 +# at 2487 +#<date> server id 1 end_log_pos 2537 Delete_rows: table id 31 flags: STMT_END_F +### DELETE FROM `test`.`t2` +### WHERE +### @1=10 /* INT meta=0 nullable=0 is_null=0 */ +### DELETE FROM `test`.`t2` +### WHERE +### @1=11 /* INT meta=0 nullable=0 is_null=0 */ +### DELETE FROM `test`.`t2` +### WHERE +### @1=12 /* INT meta=0 nullable=0 is_null=0 */ +### DELETE FROM `test`.`t2` +### WHERE +### @1=13 /* INT meta=0 nullable=0 is_null=0 */ +# at 2537 +#<date> server id 1 end_log_pos 2606 Query thread_id=4 exec_time=x error_code=0 +SET TIMESTAMP=X/*!*/; +COMMIT +/*!*/; +# at 2606 +#<date> server id 1 end_log_pos 2650 Rotate to master-bin.000002 pos: 4 +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +DROP TABLE t1,t2; diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index 66e23c18355..033b4086985 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -329,7 +329,7 @@ DROP TABLE bug47205; # Should indicate that REPAIR TABLE is needed CHECK TABLE bug47205 FOR UPGRADE; Table Op Msg_type Msg_text -test.bug47205 check error Table upgrade required. Please do "REPAIR TABLE `bug47205`" or dump/reload to fix it! +test.bug47205 check error Upgrade required. Please do "REPAIR TABLE `bug47205`" or dump/reload to fix it! # Running mysqlcheck to check and upgrade test.bug47205 Needs upgrade diff --git a/mysql-test/r/mysqld--help,win.rdiff b/mysql-test/r/mysqld--help,win.rdiff index 24719fce917..a09b5603869 100644 --- a/mysql-test/r/mysqld--help,win.rdiff +++ b/mysql-test/r/mysqld--help,win.rdiff @@ -1,6 +1,6 @@ ---- mysql-test/r/mysqld--help.result 2012-09-08 22:22:06 +0000 -+++ mysql-test/r/mysqld--help.result 2012-10-01 14:03:59 +0000 -@@ -248,7 +248,6 @@ +--- mysqld--help.result ++++ mysqld--help,win.reject +@@ -321,7 +321,6 @@ The following options may be given as the first argument: The number of segments in a key cache -L, --language=name Client error messages in given language. May be given as a full path. Deprecated. Use --lc-messages-dir instead. @@ -8,15 +8,15 @@ --lc-messages=name Set the language used for the error messages. -L, --lc-messages-dir=name Directory where error messages are -@@ -443,6 +442,7 @@ - NULLS_UNEQUAL (default behavior for 4.1 and later), - NULLS_EQUAL (emulate 4.0 behavior), and NULLS_IGNORED - --myisam-use-mmap Use memory mapping for reading and writing MyISAM tables +@@ -517,6 +516,7 @@ The following options may be given as the first argument: + Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME, + DATETIME, TIMESTAMP columns. + (Defaults to on; use --skip-mysql56-temporal-format to disable.) + --named-pipe Enable the named pipe (NT) --net-buffer-length=# Buffer length for TCP/IP and socket communication --net-read-timeout=# -@@ -710,6 +710,9 @@ +@@ -906,6 +906,9 @@ The following options may be given as the first argument: files within specified directory --server-id=# Uniquely identifies the server instance in the community of replication partners @@ -26,7 +26,7 @@ --show-slave-auth-info Show user and password in SHOW SLAVE HOSTS on this master. -@@ -777,6 +780,10 @@ +@@ -1016,6 +1019,10 @@ The following options may be given as the first argument: Log slow queries to given log file. Defaults logging to 'hostname'-slow.log. Must be enabled to activate other slow log options @@ -37,16 +37,16 @@ --socket=name Socket file to use for connection --sort-buffer-size=# Each thread that needs to do a sort allocates a buffer of -@@ -785,6 +792,7 @@ - for the complete list of valid sql modes +@@ -1034,6 +1041,7 @@ The following options may be given as the first argument: + NO_ENGINE_SUBSTITUTION, PAD_CHAR_TO_FULL_LENGTH --stack-trace Print a symbolic stack trace on failure (Defaults to on; use --skip-stack-trace to disable.) + --standalone Dummy option to start as a standalone program (NT). --stored-program-cache=# The soft upper limit for number of cached stored routines for one connection. -@@ -817,25 +825,11 @@ - values are COMMIT or ROLLBACK. +@@ -1070,25 +1078,11 @@ The following options may be given as the first argument: + COMMIT, ROLLBACK --thread-cache-size=# How many threads we should keep in a cache for reuse - --thread-pool-idle-timeout=# @@ -72,8 +72,8 @@ + Minimum number of threads in the thread pool. --thread-stack=# The stack size for each thread --time-format=name The TIME format (ignored) - --timed-mutexes Specify whether to time mutexes (only InnoDB mutexes are -@@ -844,8 +838,8 @@ + --timed-mutexes Specify whether to time mutexes. Deprecated, has no +@@ -1097,8 +1091,8 @@ The following options may be given as the first argument: size, MySQL will automatically convert it to an on-disk MyISAM or Aria table -t, --tmpdir=name Path for temporary files. Several paths may be specified, @@ -84,48 +84,55 @@ --transaction-alloc-block-size=# Allocation block size for transactions to be stored in binary log -@@ -949,7 +943,6 @@ - key-cache-block-size 1024 +@@ -1224,7 +1218,6 @@ key-cache-block-size 1024 key-cache-division-limit 100 + key-cache-file-hash-size 512 key-cache-segments 0 -large-pages FALSE lc-messages en_US lc-messages-dir MYSQL_SHAREDIR/ lc-time-names en_US -@@ -1012,6 +1005,7 @@ - myisam-sort-buffer-size 8388608 - myisam-stats-method nulls_unequal +@@ -1290,6 +1283,7 @@ myisam-sort-buffer-size 134216704 + myisam-stats-method NULLS_UNEQUAL myisam-use-mmap FALSE + mysql56-temporal-format TRUE +named-pipe FALSE net-buffer-length 16384 net-read-timeout 30 net-retry-count 10 -@@ -1077,6 +1071,8 @@ - secure-auth FALSE +@@ -1386,6 +1380,8 @@ safe-user-create FALSE + secure-auth TRUE secure-file-priv (No default value) server-id 0 +shared-memory FALSE +shared-memory-base-name MYSQL show-slave-auth-info FALSE + silent-startup FALSE skip-grant-tables TRUE - skip-name-resolve FALSE -@@ -1093,6 +1089,7 @@ +@@ -1409,6 +1405,7 @@ slave-transaction-retries 10 slave-type-conversions slow-launch-time 2 slow-query-log FALSE +slow-start-timeout 15000 sort-buffer-size 2097152 - sql-mode + sql-mode NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION stack-trace TRUE -@@ -1109,10 +1106,8 @@ - table-open-cache 400 +@@ -1421,15 +1418,13 @@ sync-master-info 10000 + sync-relay-log 10000 + sync-relay-log-info 10000 + sysdate-is-now FALSE +-table-cache 431 ++table-cache 2000 + table-definition-cache 400 +-table-open-cache 431 ++table-open-cache 2000 tc-heuristic-recover COMMIT thread-cache-size 0 -thread-pool-idle-timeout 60 - thread-pool-max-threads 500 + thread-pool-max-threads 1000 -thread-pool-oversubscribe 3 -thread-pool-stall-limit 500 +thread-pool-min-threads 1 - thread-stack 294912 + thread-stack 295936 time-format %H:%i:%s timed-mutexes FALSE diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index 014547b63a9..f6e7c54745f 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -21,9 +21,10 @@ The following options may be given as the first argument: --automatic-sp-privileges Creating and dropping stored procedures alters ACLs (Defaults to on; use --skip-automatic-sp-privileges to disable.) - --back-log=# The number of outstanding connection requests MySQL can + --back-log=# The number of outstanding connection requests MariaDB can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time + (Automatically configured unless set explicitly) -b, --basedir=name Path to installation directory. All paths are usually resolved relative to this --big-tables Allow big result sets by saving all temporary sets on @@ -39,8 +40,7 @@ The following options may be given as the first argument: increase this to get more performance --binlog-checksum=name Type of BINLOG_CHECKSUM_ALG. Include checksum for log - events in the binary log. Possible values are NONE and - CRC32; default is NONE. + events in the binary log. One of: NONE, CRC32 --binlog-commit-wait-count=# If non-zero, binlog write will wait at most binlog_commit_wait_usec microseconds for at least this @@ -71,10 +71,7 @@ The following options may be given as the first argument: statements where only row-based is correct: those which involve user-defined functions (i.e. UDFs) or the UUID() function; for those, row-based binary logging is - automatically used. If NDBCLUSTER is enabled and - binlog-format is MIXED, the format switches to row-based - and back implicitly per each query accessing an - NDBCLUSTER table + automatically used. --binlog-ignore-db=name Tells the master that updates to the given database should not be logged to the binary log. @@ -91,6 +88,17 @@ The following options may be given as the first argument: The maximum size of a row-based binary log event in bytes. Rows will be grouped into events smaller than this size if possible. The value has to be a multiple of 256. + --binlog-row-image=name + Controls whether rows should be logged in 'FULL', + 'NOBLOB' or 'MINIMAL' formats. 'FULL', means that all + columns in the before and after image are logged. + 'NOBLOB', means that mysqld avoids logging blob columns + whenever possible (eg, blob column was not changed or is + not part of primary key). 'MINIMAL', means that a PK + equivalent (PK columns or full row if there is no PK in + the table) is logged in the before image, and only + changed columns are logged in the after image. (Default: + FULL). --binlog-stmt-cache-size=# The size of the statement cache for updates to non-transactional engines for the binary log. If you @@ -100,6 +108,9 @@ The following options may be given as the first argument: --bulk-insert-buffer-size=# Size of tree cache used in bulk insert optimisation. Note that this is a limit per thread! + --changed-page-bitmaps[=name] + Enable or disable CHANGED_PAGE_BITMAPS plugin. One of: + ON, OFF, FORCE (don't start if the plugin fails to load). --character-set-client-handshake Don't ignore client side character set value sent during handshake. @@ -114,11 +125,11 @@ The following options may be given as the first argument: --collation-server=name Set the default collation. --completion-type=name - The transaction completion type, one of NO_CHAIN, CHAIN, + The transaction completion type. One of: NO_CHAIN, CHAIN, RELEASE --concurrent-insert[=name] - Use concurrent insert with MyISAM. Possible values are - NEVER, AUTO, ALWAYS + Use concurrent insert with MyISAM. One of: NEVER, AUTO, + ALWAYS --console Write error output on screen; don't remove the console window on windows. --core-file Write core on errors. @@ -137,17 +148,19 @@ The following options may be given as the first argument: Short timeout for the two-step deadlock detection (in microseconds) --default-regex-flags=name - Default flags for the regex library. Syntax: - default-regex-flags='[flag[,flag[,flag...]]]'. See the - manual for the complete list of valid flags + Default flags for the regex library. Any combination of: + DOTALL, DUPNAMES, EXTENDED, EXTRA, MULTILINE, UNGREEDY --default-storage-engine=name The default storage engine for new tables --default-time-zone=name Set the default time zone. + --default-tmp-storage-engine=name + The default storage engine for user-created temporary + tables --default-week-format=# The default week format used by WEEK() functions --delay-key-write[=name] - Type of DELAY_KEY_WRITE + Type of DELAY_KEY_WRITE. One of: OFF, ON, ALL --delayed-insert-limit=# After inserting delayed_insert_limit rows, the INSERT DELAYED handler will check if there are any SELECT @@ -164,6 +177,14 @@ The following options may be given as the first argument: --div-precision-increment=# Precision of the result of '/' operator will be increased on that value + --encrypt-binlog Encrypt binary logs (including relay logs) + --encrypt-tmp-disk-tables + Encrypt temporary on-disk tables (created as part of + query execution) + --encrypt-tmp-files Encrypt temporary files (created for filesort, binary log + cache, etc) + --enforce-storage-engine=name + Force the use of a storage engine for new tables --event-scheduler[=name] Enable the event scheduler. Possible values are ON, OFF, and DISABLED (keep the event scheduler completely @@ -176,6 +197,11 @@ The following options may be given as the first argument: If non-zero, binary logs will be purged after expire_logs_days days; possible purges happen at startup and at binary log rotation + --explicit-defaults-for-timestamp + This option causes CREATE TABLE to create all TIMESTAMP + columns as NULL with DEFAULT NULL attribute, Without this + option, TIMESTAMP columns are NOT NULL and have implicit + DEFAULT clauses. The old behavior is deprecated. --external-locking Use system (external) locking (disabled by default). With this option enabled you can run myisamchk to test (not repair) tables while the MySQL server is running. @@ -207,6 +233,10 @@ The following options may be given as the first argument: mysql.general_logif --log-output=TABLE is used --general-log-file=name Log connections and queries to given file + --getopt-prefix-matching + Recognize command-line options by their unambiguos + prefixes. + (Defaults to on; use --skip-getopt-prefix-matching to disable.) --group-concat-max-len=# The maximum length of the result of function GROUP_CONCAT() @@ -239,6 +269,7 @@ The following options may be given as the first argument: height-balanced, DOUBLE_PREC_HB - double precision height-balanced. --host-cache-size=# How many host names should be cached to avoid resolving. + (Automatically configured unless set explicitly) --ignore-builtin-innodb Disable initialization of builtin InnoDB plugin --ignore-db-dirs=name @@ -249,7 +280,7 @@ The following options may be given as the first argument: (unless the user has SUPER privilege) --init-file=name Read SQL commands from this file at startup --init-rpl-role=name - Set the replication role. + Set the replication role. One of: MASTER, SLAVE --init-slave=name Command(s) that are executed by a slave server each time the SQL thread starts --interactive-timeout=# @@ -331,8 +362,8 @@ The following options may be given as the first argument: not specified then 'datadir'/'log-basename'.err or the 'pid-file' path with extension .err is used --log-isam[=name] Log all MyISAM changes to file. - --log-output=name Syntax: log-output=value[,value...], where "value" could - be TABLE, FILE or NONE + --log-output=name How logs should be written. Any combination of: NONE, + FILE, TABLE --log-queries-not-using-indexes Log queries that are executed without benefit of any index to the slow log if it is open @@ -345,10 +376,9 @@ The following options may be given as the first argument: Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to the slow log if it is open. --log-slow-filter=name - Log only certain types of queries. Multiple flags can be - specified, separated by commas. Valid values are admin, - slave, filesort, filesort_on_disk, full_join, full_scan, - query_cache, query_cache_miss, tmp_table, + Log only certain types of queries. Any combination of: + admin, filesort, filesort_on_disk, full_join, full_scan, + query_cache, query_cache_miss, tmp_table, tmp_table_on_disk --log-slow-rate-limit=# Write to slow log every #th slow query. Set to 1 to log @@ -358,8 +388,8 @@ The following options may be given as the first argument: Log slow statements executed by slave thread to the slow log if it is open. --log-slow-verbosity=name - log-slow-verbosity=[value[,value ...]] where value is one - of 'innodb', 'query_plan', 'explain' + Verbosity level for the slow log. Any combination of: + innodb, query_plan, explain --log-tc=name Path to transaction coordinator log (used for transactions that affect more than one storage engine, when binary log is disabled). @@ -422,7 +452,7 @@ The following options may be given as the first argument: Maximum number of prepared statements in the server --max-relay-log-size=# relay log will be rotated automatically when the size - exceeds this value. If 0 are startup, it's set to + exceeds this value. If 0 at startup, it's set to max_binlog_size --max-seeks-for-key=# Limit assumed max number of seeks when looking up rows @@ -432,8 +462,12 @@ The following options may be given as the first argument: value are used; the rest are ignored) --max-sp-recursion-depth[=#] Maximum stored procedure recursion depth - --max-tmp-tables=# Maximum number of temporary tables a client can keep open - at a time + --max-statement-time=# + A SELECT query that have taken more than + max_statement_time seconds will be aborted. The argument + will be treated as a decimal value with microsecond + precision. A value of 0 (default) means no timeout + --max-tmp-tables=# Unused, will be removed. --max-user-connections=# The maximum number of active connections for a single user (0 = no limit) @@ -442,9 +476,9 @@ The following options may be given as the first argument: in between --memlock Lock mysqld in memory. --metadata-locks-cache-size=# - Size of unused metadata locks cache + Unused --metadata-locks-hash-instances=# - Number of metadata locks hash instances + Unused --min-examined-row-limit=# Don't write queries to slow log that examine fewer rows than that @@ -462,9 +496,9 @@ The following options may be given as the first argument: Restricts the total memory used for memory mapping of MySQL tables --myisam-recover-options[=name] - Syntax: myisam-recover-options[=option[,option...]], - where option can be DEFAULT, BACKUP, BACKUP_ALL, FORCE, - QUICK, or OFF + Specifies how corrupted tables should be automatically + repaired. Any combination of: DEFAULT, BACKUP, FORCE, + QUICK, BACKUP_ALL, OFF --myisam-repair-threads=# If larger than 1, when repairing a MyISAM table all indexes will be created in parallel, with one thread per @@ -479,6 +513,10 @@ The following options may be given as the first argument: NULLS_UNEQUAL (default behavior for 4.1 and later), NULLS_EQUAL (emulate 4.0 behavior), and NULLS_IGNORED --myisam-use-mmap Use memory mapping for reading and writing MyISAM tables + --mysql56-temporal-format + Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME, + DATETIME, TIMESTAMP columns. + (Defaults to on; use --skip-mysql56-temporal-format to disable.) --net-buffer-length=# Buffer length for TCP/IP and socket communication --net-read-timeout=# @@ -493,8 +531,9 @@ The following options may be given as the first argument: See also --old-mode --old-alter-table Use old, non-optimized alter table --old-mode=name Used to emulate old behavior from earlier MariaDB or - MySQL versions. Syntax: old_mode=mode[,mode[,mode...]]. - See the manual for the complete list of valid old modes + MySQL versions. Any combination of: + NO_DUP_KEY_WARNINGS_WITH_IGNORE, NO_PROGRESS_INFO, + ZERO_DATE_TIME_CAST --old-passwords Use old password encryption method (needed for 4.0 and older clients) --old-style-user-limits @@ -528,19 +567,20 @@ The following options may be given as the first argument: Controls number of record samples to check condition selectivity --optimizer-switch=name - optimizer_switch=option=val[,option=val...], where option - is one of {derived_merge, derived_with_keys, firstmatch, - in_to_exists, engine_condition_pushdown, - index_condition_pushdown, index_merge, - index_merge_intersection, index_merge_sort_intersection, - index_merge_sort_union, index_merge_union, - join_cache_bka, join_cache_hashed, - join_cache_incremental, loosescan, materialization, mrr, - mrr_cost_based, mrr_sort_keys, optimize_join_buffer_size, - outer_join_with_cache, partial_match_rowid_merge, - partial_match_table_scan, semijoin, semijoin_with_cache, - subquery_cache, table_elimination, extended_keys, - exists_to_in } and val is one of {on, off, default} + Fine-tune the optimizer behavior. Takes a comma-separated + list of option=value pairs, where value is on, off, or + default, and options are: index_merge, index_merge_union, + index_merge_sort_union, index_merge_intersection, + index_merge_sort_intersection, engine_condition_pushdown, + index_condition_pushdown, derived_merge, + derived_with_keys, firstmatch, loosescan, materialization, + in_to_exists, semijoin, partial_match_rowid_merge, + partial_match_table_scan, subquery_cache, mrr, + mrr_cost_based, mrr_sort_keys, outer_join_with_cache, + semijoin_with_cache, join_cache_incremental, + join_cache_hashed, join_cache_bka, + optimize_join_buffer_size, table_elimination, + extended_keys, exists_to_in --optimizer-use-condition-selectivity=# Controls selectivity of which conditions the optimizer takes into account to calculate cardinality of a partial @@ -696,9 +736,9 @@ The following options may be given as the first argument: in an incremental way. It can be specified many times, adding more plugins every time. --plugin-maturity=name - The lowest desirable plugin maturity (unknown, - experimental, alpha, beta, gamma, or stable). Plugins - less mature than that will not be installed or loaded. + The lowest desirable plugin maturity. Plugins less mature + than that will not be installed or loaded. One of: + unknown, experimental, alpha, beta, gamma, stable -P, --port=# Port number to use for connection or 0 to default to, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306), whatever comes first @@ -855,13 +895,12 @@ The following options may be given as the first argument: --rowid-merge-buff-size=# The size of the buffers used [NOT] IN evaluation via partial matching - --rpl-recovery-rank=# - Unused, will be removed --safe-mode Skip some optimize stages (for testing). Deprecated. --safe-user-create Don't allow new user creation by the user who has no write privileges to the mysql.user table. --secure-auth Disallow authentication for accounts that have old (pre-4.1) passwords + (Defaults to on; use --skip-secure-auth to disable.) --secure-file-priv=name Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files within specified directory @@ -870,7 +909,8 @@ The following options may be given as the first argument: --show-slave-auth-info Show user and password in SHOW SLAVE HOSTS on this master. - --skip-bdb Deprecated option; Exist only for compatiblity with old + --silent-startup Don't print [Note] to the error log during startup. + --skip-bdb Deprecated option; Exist only for compatibility with old my.cnf files --skip-grant-tables Start without grant tables. This gives all users FULL ACCESS to all tables. @@ -920,6 +960,16 @@ The following options may be given as the first argument: parallel replication thread when reading ahead in the relay log looking for opportunities for parallel replication. Only used when --slave-parallel-threads > 0. + --slave-parallel-mode=name + Controls what transactions are applied in parallel when + using --slave-parallel-threads. Possible values: + "optimistic" tries to apply most transactional DML in + parallel, and handles any conflicts with rollback and + retry. "conservative" limits parallelism in an effort to + avoid any conflicts. "aggressive" tries to maximise the + parallelism, possibly at the cost of increased conflict + rate. "minimal" only parallelizes the commit steps of + transactions. "none" disables parallel apply completely. --slave-parallel-threads=# If non-zero, number of threads to spawn to apply in parallel events on the slave that were group-committed on @@ -927,6 +977,15 @@ The following options may be given as the first argument: replication domains. Note that these threads are in addition to the IO and SQL threads, which are always created by a replication slave + --slave-run-triggers-for-rbr=name + Modes for how triggers in row-base replication on slave + side will be executed. Legal values are NO (default), YES + and LOGGING. NO means that trigger for RBR will not be + running on slave. YES and LOGGING means that triggers + will be running on slave, if there was not triggers + running on the master for the statement. LOGGING also + means results of that the executed triggers work will be + written to the binlog. --slave-skip-errors=name Tells the slave thread to continue replication when a query event returns an error from the provided list @@ -941,11 +1000,10 @@ The following options may be given as the first argument: transaction in case it failed with a deadlock or elapsed lock wait timeout, before giving up and stopping --slave-type-conversions=name - Set of slave type conversions that are enabled. Legal - values are: ALL_LOSSY to enable lossy conversions and - ALL_NON_LOSSY to enable non-lossy conversions. If the - variable is assigned the empty set, no conversions are - allowed and it is expected that the types match exactly. + Set of slave type conversions that are enabled. If the + variable is empty, no conversions are allowed and it is + expected that the types match exactly. Any combination + of: ALL_LOSSY, ALL_NON_LOSSY --slow-launch-time=# If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be @@ -962,13 +1020,28 @@ The following options may be given as the first argument: --sort-buffer-size=# Each thread that needs to do a sort allocates a buffer of this size - --sql-mode=name Syntax: sql-mode=mode[,mode[,mode...]]. See the manual - for the complete list of valid sql modes + --sql-mode=name Sets the sql mode. Any combination of: REAL_AS_FLOAT, + PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, + IGNORE_BAD_TABLE_OPTIONS, ONLY_FULL_GROUP_BY, + NO_UNSIGNED_SUBTRACTION, NO_DIR_IN_CREATE, POSTGRESQL, + ORACLE, MSSQL, DB2, MAXDB, NO_KEY_OPTIONS, + NO_TABLE_OPTIONS, NO_FIELD_OPTIONS, MYSQL323, MYSQL40, + ANSI, NO_AUTO_VALUE_ON_ZERO, NO_BACKSLASH_ESCAPES, + STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE, + NO_ZERO_DATE, ALLOW_INVALID_DATES, + ERROR_FOR_DIVISION_BY_ZERO, TRADITIONAL, + NO_AUTO_CREATE_USER, HIGH_NOT_PRECEDENCE, + NO_ENGINE_SUBSTITUTION, PAD_CHAR_TO_FULL_LENGTH --stack-trace Print a symbolic stack trace on failure (Defaults to on; use --skip-stack-trace to disable.) --stored-program-cache=# The soft upper limit for number of cached stored routines for one connection. + --strict-password-validation + When password validation plugins are enabled, reject + passwords that cannot be validated (passwords specified + as a hash) + (Defaults to on; use --skip-strict-password-validation to disable.) -s, --symbolic-links Enable symbolic link support. --sync-binlog=# Synchronously flush binary log to disk after every #th @@ -977,13 +1050,12 @@ The following options may be given as the first argument: (Defaults to on; use --skip-sync-frm to disable.) --sync-master-info=# Synchronously flush master info to disk after every #th - event. Use 0 (default) to disable synchronous flushing + event. Use 0 to disable synchronous flushing --sync-relay-log=# Synchronously flush relay log to disk after every #th - event. Use 0 (default) to disable synchronous flushing + event. Use 0 to disable synchronous flushing --sync-relay-log-info=# Synchronously flush relay log info to disk after every - #th transaction. Use 0 (default) to disable synchronous - flushing + #th transaction. Use 0 to disable synchronous flushing --sysdate-is-now Non-default option to alias SYSDATE() to NOW() to make it safe-replicable. Since 5.0, SYSDATE() returns a `dynamic' value different for different invocations, even within @@ -994,8 +1066,8 @@ The following options may be given as the first argument: --table-open-cache=# The number of cached open tables --tc-heuristic-recover=name - Decision to use in heuristic recover process. Possible - values are COMMIT or ROLLBACK. + Decision to use in heuristic recover process. One of: OFF, + COMMIT, ROLLBACK --thread-cache-size=# How many threads we should keep in a cache for reuse --thread-pool-idle-timeout=# @@ -1031,7 +1103,9 @@ The following options may be given as the first argument: Allocation block size for transactions to be stored in binary log --transaction-isolation=name - Default transaction isolation level. + Default transaction isolation level. One of: + READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, + SERIALIZABLE --transaction-prealloc-size=# Persistent buffer for transactions to be stored in binary log @@ -1046,8 +1120,8 @@ The following options may be given as the first argument: of the underlying table and the query uses a LIMIT clause (usually get from GUI tools) --use-stat-tables=name - Specifies how to use system statistics tables. Possible - values are NEVER, COMPLEMENTARY, PREFERABLY + Specifies how to use system statistics tables. One of: + NEVER, COMPLEMENTARY, PREFERABLY -u, --user=name Run mysqld daemon as user. --userstat Enables statistics gathering for USER_STATISTICS, CLIENT_STATISTICS, INDEX_STATISTICS and TABLE_STATISTICS @@ -1063,7 +1137,7 @@ auto-increment-increment 1 auto-increment-offset 1 autocommit TRUE automatic-sp-privileges TRUE -back-log 150 +back-log 80 big-tables FALSE bind-address (No default value) binlog-annotate-row-events FALSE @@ -1075,8 +1149,10 @@ binlog-direct-non-transactional-updates FALSE binlog-format STATEMENT binlog-optimize-thread-scheduling TRUE binlog-row-event-max-size 1024 +binlog-row-image FULL binlog-stmt-cache-size 32768 bulk-insert-buffer-size 8388608 +changed-page-bitmaps ON character-set-client-handshake TRUE character-set-filesystem binary character-sets-dir MYSQL_CHARSETSDIR/ @@ -1093,15 +1169,21 @@ deadlock-timeout-short 10000 default-regex-flags default-storage-engine myisam default-time-zone (No default value) +default-tmp-storage-engine (No default value) default-week-format 0 delay-key-write ON delayed-insert-limit 100 delayed-insert-timeout 300 delayed-queue-size 1000 div-precision-increment 4 +encrypt-binlog FALSE +encrypt-tmp-disk-tables FALSE +encrypt-tmp-files FALSE +enforce-storage-engine (No default value) event-scheduler OFF expensive-subquery-limit 100 expire-logs-days 0 +explicit-defaults-for-timestamp FALSE external-locking FALSE extra-max-connections 1 extra-port 0 @@ -1114,6 +1196,7 @@ ft-query-expansion-limit 20 ft-stopword-file (No default value) gdb FALSE general-log FALSE +getopt-prefix-matching TRUE group-concat-max-len 1024 gtid-domain-id 0 gtid-ignore-duplicates FALSE @@ -1121,7 +1204,7 @@ gtid-strict-mode FALSE help TRUE histogram-size 0 histogram-type SINGLE_PREC_HB -host-cache-size 128 +host-cache-size 279 ignore-builtin-innodb FALSE ignore-db-dirs init-connect @@ -1129,7 +1212,7 @@ init-file (No default value) init-rpl-role MASTER init-slave interactive-timeout 28800 -join-buffer-size 131072 +join-buffer-size 262144 join-buffer-space-limit 2097152 join-cache-level 2 keep-files-on-create FALSE @@ -1160,7 +1243,6 @@ log-slow-rate-limit 1 log-slow-slave-statements FALSE log-slow-verbosity log-tc tc.log -log-tc-size 24576 log-warnings 1 long-query-time 10 low-priority-updates FALSE @@ -1168,7 +1250,7 @@ lower-case-table-names 1 master-info-file master.info master-retry-count 86400 master-verify-checksum FALSE -max-allowed-packet 1048576 +max-allowed-packet 4194304 max-binlog-cache-size 18446744073709547520 max-binlog-size 1073741824 max-binlog-stmt-cache-size 18446744073709547520 @@ -1180,12 +1262,13 @@ max-error-count 64 max-heap-table-size 16777216 max-join-size 18446744073709551615 max-length-for-sort-data 1024 -max-long-data-size 1048576 +max-long-data-size 4194304 max-prepared-stmt-count 16382 max-relay-log-size 1073741824 max-seeks-for-key 18446744073709551615 max-sort-length 1024 max-sp-recursion-depth 0 +max-statement-time 0 max-tmp-tables 32 max-user-connections 0 max-write-lock-count 18446744073709551615 @@ -1202,8 +1285,9 @@ myisam-mmap-size 18446744073709551615 myisam-recover-options DEFAULT myisam-repair-threads 1 myisam-sort-buffer-size 134216704 -myisam-stats-method nulls_unequal +myisam-stats-method NULLS_UNEQUAL myisam-use-mmap FALSE +mysql56-temporal-format TRUE net-buffer-length 16384 net-read-timeout 30 net-retry-count 10 @@ -1254,7 +1338,7 @@ performance-schema-max-rwlock-instances -1 performance-schema-max-socket-classes 10 performance-schema-max-socket-instances -1 performance-schema-max-stage-classes 150 -performance-schema-max-statement-classes 180 +performance-schema-max-statement-classes 178 performance-schema-max-table-handles -1 performance-schema-max-table-instances -1 performance-schema-max-thread-classes 50 @@ -1270,14 +1354,14 @@ preload-buffer-size 32768 profiling-history-size 15 progress-report-time 5 protocol-version 10 -query-alloc-block-size 8192 +query-alloc-block-size 16384 query-cache-limit 1048576 query-cache-min-res-unit 4096 -query-cache-size 0 +query-cache-size 1048576 query-cache-strip-comments FALSE -query-cache-type ON +query-cache-type OFF query-cache-wlock-invalidate FALSE -query-prealloc-size 8192 +query-prealloc-size 24576 range-alloc-block-size 4096 read-buffer-size 131072 read-only FALSE @@ -1289,19 +1373,19 @@ relay-log-purge TRUE relay-log-recovery FALSE relay-log-space-limit 0 replicate-annotate-row-events FALSE -replicate-events-marked-for-skip replicate +replicate-events-marked-for-skip REPLICATE replicate-same-server-id FALSE report-host (No default value) report-password (No default value) report-port 0 report-user (No default value) rowid-merge-buff-size 8388608 -rpl-recovery-rank 0 safe-user-create FALSE -secure-auth FALSE +secure-auth TRUE secure-file-priv (No default value) server-id 0 show-slave-auth-info FALSE +silent-startup FALSE skip-grant-tables TRUE skip-name-resolve FALSE skip-networking FALSE @@ -1314,7 +1398,9 @@ slave-exec-mode STRICT slave-max-allowed-packet 1073741824 slave-net-timeout 3600 slave-parallel-max-queued 131072 +slave-parallel-mode conservative slave-parallel-threads 0 +slave-run-triggers-for-rbr NO slave-skip-errors (No default value) slave-sql-verify-checksum TRUE slave-transaction-retries 10 @@ -1322,26 +1408,27 @@ slave-type-conversions slow-launch-time 2 slow-query-log FALSE sort-buffer-size 2097152 -sql-mode +sql-mode NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION stack-trace TRUE stored-program-cache 256 +strict-password-validation TRUE symbolic-links FALSE sync-binlog 0 sync-frm FALSE -sync-master-info 0 -sync-relay-log 0 -sync-relay-log-info 0 +sync-master-info 10000 +sync-relay-log 10000 +sync-relay-log-info 10000 sysdate-is-now FALSE -table-cache 400 +table-cache 431 table-definition-cache 400 -table-open-cache 400 +table-open-cache 431 tc-heuristic-recover OFF thread-cache-size 0 thread-pool-idle-timeout 60 -thread-pool-max-threads 500 +thread-pool-max-threads 1000 thread-pool-oversubscribe 3 thread-pool-stall-limit 500 -thread-stack 294912 +thread-stack 295936 time-format %H:%i:%s timed-mutexes FALSE tmp-table-size 16777216 diff --git a/mysql-test/r/mysqld_help_crash-9183.result b/mysql-test/r/mysqld_help_crash-9183.result new file mode 100644 index 00000000000..c0e5323d6d7 --- /dev/null +++ b/mysql-test/r/mysqld_help_crash-9183.result @@ -0,0 +1,3 @@ +rename table mysql.plugin to test.plugin; +flush tables; +rename table test.plugin to mysql.plugin; diff --git a/mysql-test/r/mysqldump-max.result b/mysql-test/r/mysqldump-max.result index 8d5ab551bee..5eff7a41abd 100644 --- a/mysql-test/r/mysqldump-max.result +++ b/mysql-test/r/mysqldump-max.result @@ -332,12 +332,12 @@ a b 2 1 DROP TABLE t1; DROP TABLE t2; -SHOW BINLOG EVENTS LIMIT 7,3; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 593 Xid 1 620 COMMIT /* XID */ -master-bin.000001 620 Gtid 1 658 GTID 0-1-3 -master-bin.000001 658 Query 1 777 use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB --- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=939; +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (1,0), (2,0) +master-bin.000001 # Xid # # COMMIT /* XID */ +-- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=<pos>; SELECT * FROM t1 ORDER BY a; a 1 diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index b6de51c8b03..559f8885b0d 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -418,7 +418,7 @@ UNLOCK TABLES; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -set global sql_mode=''; +set global sql_mode=default; drop table t1; # # Bug#2705 mysqldump --tab extra output @@ -1970,9 +1970,9 @@ DROP TABLE IF EXISTS "t1"; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE "t1" ( - "a b" int(11) NOT NULL DEFAULT '0', - "c""d" int(11) NOT NULL DEFAULT '0', - "e`f" int(11) NOT NULL DEFAULT '0', + "a b" int(11) NOT NULL, + "c""d" int(11) NOT NULL, + "e`f" int(11) NOT NULL, PRIMARY KEY ("a b","c""d","e`f") ); /*!40101 SET character_set_client = @saved_cs_client */; @@ -2004,9 +2004,9 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( - `a b` int(11) NOT NULL DEFAULT '0', - `c"d` int(11) NOT NULL DEFAULT '0', - `e``f` int(11) NOT NULL DEFAULT '0', + `a b` int(11) NOT NULL, + `c"d` int(11) NOT NULL, + `e``f` int(11) NOT NULL, PRIMARY KEY (`a b`,`c"d`,`e``f`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -2468,10 +2468,10 @@ if new.a > 10 then set new.a := 10; set new.a := 11; end if; -end BEFORE 0000-00-00 00:00:00 root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +end BEFORE 0000-00-00 00:00:00 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci trg2 UPDATE t1 begin if old.a % 2 = 0 then set new.b := 12; end if; -end BEFORE 0000-00-00 00:00:00 root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +end BEFORE 0000-00-00 00:00:00 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci trg3 UPDATE t1 begin if new.a = -1 then set @fired:= "Yes"; @@ -2515,7 +2515,7 @@ UNLOCK TABLES; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 trigger trg1 before insert on t1 for each row begin @@ -2536,7 +2536,7 @@ DELIMITER ; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 trigger trg2 before update on t1 for each row begin if old.a % 2 = 0 then set new.b := 12; end if; @@ -2671,10 +2671,10 @@ if new.a > 10 then set new.a := 10; set new.a := 11; end if; -end BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +end BEFORE # NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci trg2 UPDATE t1 begin if old.a % 2 = 0 then set new.b := 12; end if; -end BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +end BEFORE # NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci trg3 UPDATE t1 begin if new.a = -1 then set @fired:= "Yes"; @@ -2717,7 +2717,7 @@ a2 SHOW TRIGGERS; Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation testref INSERT test1 BEGIN -INSERT INTO test2 SET a2 = NEW.a1; END BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +INSERT INTO test2 SET a2 = NEW.a1; END BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci SELECT * FROM `test1`; a1 1 @@ -2789,7 +2789,7 @@ UNLOCK TABLES; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11) RETURN a+b ;; @@ -2806,7 +2806,7 @@ DELIMITER ; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `bug9056_func2`(f1 char binary) RETURNS char(1) CHARSET latin1 begin @@ -2843,7 +2843,7 @@ DELIMITER ; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT) BEGIN SELECT a+b INTO c; end ;; @@ -2860,7 +2860,7 @@ DELIMITER ; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `bug9056_proc2`(OUT a INT) BEGIN @@ -2891,7 +2891,7 @@ drop table t1; # Bug#13052 mysqldump timestamp reloads broken # drop table if exists t1; -create table t1 (`d` timestamp, unique (`d`)); +create table t1 (`d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, unique (`d`)); set time_zone='+00:00'; insert into t1 values ('2003-10-25 22:00:00'),('2003-10-25 23:00:00'); select * from t1; @@ -3715,7 +3715,7 @@ CREATE TEMPORARY TABLE `TABLES` ( `CHECK_TIME` datetime DEFAULT NULL, `TABLE_COLLATION` varchar(32) DEFAULT NULL, `CHECKSUM` bigint(21) unsigned DEFAULT NULL, - `CREATE_OPTIONS` varchar(255) DEFAULT NULL, + `CREATE_OPTIONS` varchar(2048) DEFAULT NULL, `TABLE_COMMENT` varchar(2048) NOT NULL DEFAULT '' ) ENGINE=MEMORY DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -3849,7 +3849,7 @@ create procedure mysqldump_test_db.sp1() select 'hello'; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = '' */ ; +/*!50003 SET sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`user1`@`%` PROCEDURE `sp1`() select 'hello' ;; @@ -5263,7 +5263,8 @@ slow_log CREATE TABLE `slow_log` ( `insert_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, `sql_text` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' SET @@global.log_output= @old_log_output_state; SET @@global.slow_query_log= @old_slow_query_log_state; @@ -5313,6 +5314,7 @@ a DROP TABLE t1; DROP TABLE t2; DROP DATABASE db_20772273; +USE test; Usage: mysqldump [OPTIONS] database [tables] OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...] OR mysqldump [OPTIONS] --all-databases [OPTIONS] @@ -5343,3 +5345,176 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; ALTER DATABASE `a\"'``b` CHARACTER SET utf8 COLLATE utf8_general_ci ; DROP DATABASE `a\"'``b`; +use test; +# +# Test mysqldump with --disable-query-logs +# +create table t1 (a int); +insert into t1 values (1); +drop table t1; +select * from t1; +a +1 +drop table t1; +# +# MDEV-9124 mysqldump does not dump data if table name is same as view earlier on +# +CREATE DATABASE db1 CHARSET=utf8; +CREATE DATABASE db2 CHARSET=utf8; +USE db2; +CREATE TABLE nonunique_table_name (i1 serial) ENGINE=MEMORY; +INSERT INTO nonunique_table_name VALUES (1),(2); +CREATE TABLE nonunique_table_view_name (i2 int) ENGINE=InnoDB; +INSERT INTO nonunique_table_view_name VALUES (3),(4); +use db1; +CREATE TABLE basetable (id smallint) ENGINE=MyISAM; +CREATE TABLE nonunique_table_name (i3 smallint) ENGINE=MERGE UNION (basetable) INSERT_METHOD=LAST; +INSERT INTO nonunique_table_name VALUES (5),(6); +CREATE VIEW nonunique_table_view_name AS SELECT 1; + +################################################## +# --compact --databases db1 db2 + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db1` /*!40100 DEFAULT CHARACTER SET utf8 */; + +USE `db1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `basetable` ( + `id` smallint(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `basetable` VALUES (5),(6); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nonunique_table_name` ( + `i3` smallint(6) DEFAULT NULL +) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(`basetable`); +/*!40101 SET character_set_client = @saved_cs_client */; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `nonunique_table_view_name` ( + `1` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db2` /*!40100 DEFAULT CHARACTER SET utf8 */; + +USE `db2`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nonunique_table_name` ( + `i1` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + UNIQUE KEY `i1` (`i1`) +) ENGINE=MEMORY AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `nonunique_table_name` VALUES (1),(2); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nonunique_table_view_name` ( + `i2` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `nonunique_table_view_name` VALUES (3),(4); + +USE `db1`; +/*!50001 DROP TABLE IF EXISTS `nonunique_table_view_name`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `nonunique_table_view_name` AS select 1 AS `1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +USE `db2`; + +################################################## +# --compact db2 + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nonunique_table_name` ( + `i1` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + UNIQUE KEY `i1` (`i1`) +) ENGINE=MEMORY AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `nonunique_table_name` VALUES (1),(2); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nonunique_table_view_name` ( + `i2` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `nonunique_table_view_name` VALUES (3),(4); + +################################################## +# --compact --delayed-insert --no-data-med=0 --databases db2 db1 + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db2` /*!40100 DEFAULT CHARACTER SET utf8 */; + +USE `db2`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nonunique_table_name` ( + `i1` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + UNIQUE KEY `i1` (`i1`) +) ENGINE=MEMORY AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT DELAYED INTO `nonunique_table_name` VALUES (1),(2); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nonunique_table_view_name` ( + `i2` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `nonunique_table_view_name` VALUES (3),(4); + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db1` /*!40100 DEFAULT CHARACTER SET utf8 */; + +USE `db1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `basetable` ( + `id` smallint(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT DELAYED INTO `basetable` VALUES (5),(6); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nonunique_table_name` ( + `i3` smallint(6) DEFAULT NULL +) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(`basetable`); +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `nonunique_table_name` VALUES (5),(6); +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `nonunique_table_view_name` ( + `1` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +USE `db2`; + +USE `db1`; +/*!50001 DROP TABLE IF EXISTS `nonunique_table_view_name`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `nonunique_table_view_name` AS select 1 AS `1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +DROP DATABASE db1; +DROP DATABASE db2; diff --git a/mysql-test/r/ndb_default_cluster.require b/mysql-test/r/ndb_default_cluster.require deleted file mode 100644 index 3616ae0f343..00000000000 --- a/mysql-test/r/ndb_default_cluster.require +++ /dev/null @@ -1,2 +0,0 @@ -Variable_name Value -Ndb_config_from_host localhost diff --git a/mysql-test/r/not_embedded_server.result b/mysql-test/r/not_embedded_server.result index 2295276099a..1cd54b131c3 100644 --- a/mysql-test/r/not_embedded_server.result +++ b/mysql-test/r/not_embedded_server.result @@ -1,4 +1,4 @@ -call mtr.add_suppression("Can't open and lock privilege tables: Table 'host' was not locked with LOCK TABLES"); +call mtr.add_suppression("Can't open and lock privilege tables: Table 'user' was not locked with LOCK TABLES"); SHOW VARIABLES like 'slave_skip_errors'; Variable_name Value slave_skip_errors OFF @@ -16,7 +16,7 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (c1 INT); LOCK TABLES t1 READ; FLUSH PRIVILEGES; -ERROR HY000: Table 'host' was not locked with LOCK TABLES +ERROR HY000: Table 'user' was not locked with LOCK TABLES UNLOCK TABLES; DROP TABLE t1; # diff --git a/mysql-test/r/not_ndb.require b/mysql-test/r/not_ndb.require deleted file mode 100644 index 36fcf7958d4..00000000000 --- a/mysql-test/r/not_ndb.require +++ /dev/null @@ -1,2 +0,0 @@ -Variable_name Value -have_ndbcluster NO diff --git a/mysql-test/r/not_ndb_default.require b/mysql-test/r/not_ndb_default.require deleted file mode 100644 index 09aae1ed1d0..00000000000 --- a/mysql-test/r/not_ndb_default.require +++ /dev/null @@ -1,2 +0,0 @@ -TRUE -1 diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index b5219333ef1..0d012e283b5 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -230,7 +230,7 @@ t1 CREATE TABLE `t1` ( `c00` binary(0) DEFAULT NULL, `c01` varchar(6) CHARACTER SET latin2 DEFAULT NULL, `c02` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `c03` varchar(6) CHARACTER SET latin2 NOT NULL DEFAULT '', + `c03` varchar(6) CHARACTER SET latin2 NOT NULL, `c04` varchar(6) CHARACTER SET latin2 DEFAULT NULL, `c05` varchar(6) CHARACTER SET latin2 DEFAULT NULL, `c06` varchar(6) CHARACTER SET latin2 DEFAULT NULL, @@ -241,7 +241,7 @@ t1 CREATE TABLE `t1` ( `c11` varchar(6) CHARACTER SET latin2 DEFAULT NULL, `c12` varchar(6) CHARACTER SET latin2 DEFAULT NULL, `c13` varchar(6) CHARACTER SET latin2 DEFAULT NULL, - `c14` char(0) CHARACTER SET latin2 DEFAULT NULL, + `c14` binary(0) DEFAULT NULL, `c15` char(0) CHARACTER SET latin2 DEFAULT NULL, `c16` varchar(6) CHARACTER SET latin2 DEFAULT NULL, `c17` varchar(6) CHARACTER SET latin2 DEFAULT NULL, @@ -394,3 +394,1183 @@ NOT NOT NULLIF(2,3) # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-7146 NULLIF returns unexpected result with a YEAR field +# +CREATE TABLE t1 (a YEAR(2)); +Warnings: +Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +INSERT INTO t1 VALUES (0); +SELECT a,NULLIF(a,2000),NULLIF(2000,a) FROM t1; +a NULLIF(a,2000) NULLIF(2000,a) +00 NULL NULL +SELECT a,NULLIF(a,2001),NULLIF(2001,a) FROM t1; +a NULLIF(a,2001) NULLIF(2001,a) +00 0 2001 +DROP TABLE t1; +# +# MDEV-7005 NULLIF does not work as documented +# +CREATE TABLE t1 (a TIME); +CREATE TABLE t2 AS SELECT a,NULLIF(a,a), CASE WHEN a=a THEN NULL ELSE a END FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` time DEFAULT NULL, + `NULLIF(a,a)` time DEFAULT NULL, + `CASE WHEN a=a THEN NULL ELSE a END` time DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1,t2; +SELECT NULLIF(_latin1'a' COLLATE latin1_general_ci, _latin1'a' COLLATE latin1_bin); +ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'nullif' +CREATE TABLE t1 AS SELECT +NULLIF(1,1), +NULLIF(1,1.0), +NULLIF(1,1e0), +NULLIF(1,'2001-01-01'), +NULLIF(1,TIME'00:00:00'); +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '2001-01-01' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `NULLIF(1,1)` int(1) DEFAULT NULL, + `NULLIF(1,1.0)` int(1) DEFAULT NULL, + `NULLIF(1,1e0)` int(1) DEFAULT NULL, + `NULLIF(1,'2001-01-01')` int(1) DEFAULT NULL, + `NULLIF(1,TIME'00:00:00')` int(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT +NULLIF(1.0,1), +NULLIF(1.0,1.0), +NULLIF(1.0,1e0), +NULLIF(1.0,'2001-01-01'), +NULLIF(1.0,TIME'00:00:00'); +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '2001-01-01' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `NULLIF(1.0,1)` decimal(2,1) DEFAULT NULL, + `NULLIF(1.0,1.0)` decimal(2,1) DEFAULT NULL, + `NULLIF(1.0,1e0)` decimal(2,1) DEFAULT NULL, + `NULLIF(1.0,'2001-01-01')` decimal(2,1) DEFAULT NULL, + `NULLIF(1.0,TIME'00:00:00')` decimal(2,1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT +NULLIF(1e0,1), +NULLIF(1e0,1.0), +NULLIF(1e0,1e0), +NULLIF(1e0,'2001-01-01'), +NULLIF(1e0,TIME'00:00:00'); +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '2001-01-01' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `NULLIF(1e0,1)` double DEFAULT NULL, + `NULLIF(1e0,1.0)` double DEFAULT NULL, + `NULLIF(1e0,1e0)` double DEFAULT NULL, + `NULLIF(1e0,'2001-01-01')` double DEFAULT NULL, + `NULLIF(1e0,TIME'00:00:00')` double DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT +NULLIF('1',1), +NULLIF('1',1.0), +NULLIF('1',1e0), +NULLIF('1','2001-01-01'), +NULLIF('1',TIME'00:00:00'); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `NULLIF('1',1)` varchar(1) DEFAULT NULL, + `NULLIF('1',1.0)` varchar(1) DEFAULT NULL, + `NULLIF('1',1e0)` varchar(1) DEFAULT NULL, + `NULLIF('1','2001-01-01')` varchar(1) DEFAULT NULL, + `NULLIF('1',TIME'00:00:00')` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT +NULLIF(TIMESTAMP'2001-01-01 00:00:00',1), +NULLIF(TIMESTAMP'2001-01-01 00:00:00',1.0), +NULLIF(TIMESTAMP'2001-01-01 00:00:00',1e0), +NULLIF(TIMESTAMP'2001-01-01 00:00:00','2001-01-01'), +NULLIF(TIMESTAMP'2001-01-01 00:00:00',TIME'00:00:00'); +Warnings: +Warning 1292 Incorrect datetime value: '1' +Warning 1292 Incorrect datetime value: '1.0' +Warning 1292 Incorrect datetime value: '1' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `NULLIF(TIMESTAMP'2001-01-01 00:00:00',1)` datetime DEFAULT NULL, + `NULLIF(TIMESTAMP'2001-01-01 00:00:00',1.0)` datetime DEFAULT NULL, + `NULLIF(TIMESTAMP'2001-01-01 00:00:00',1e0)` datetime DEFAULT NULL, + `NULLIF(TIMESTAMP'2001-01-01 00:00:00','2001-01-01')` datetime DEFAULT NULL, + `NULLIF(TIMESTAMP'2001-01-01 00:00:00',TIME'00:00:00')` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT +NULLIF(DATE'2001-01-01',1), +NULLIF(DATE'2001-01-01',1.0), +NULLIF(DATE'2001-01-01',1e0), +NULLIF(DATE'2001-01-01','2001-01-01'), +NULLIF(DATE'2001-01-01',TIME'00:00:00'); +Warnings: +Warning 1292 Incorrect datetime value: '1' +Warning 1292 Incorrect datetime value: '1.0' +Warning 1292 Incorrect datetime value: '1' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `NULLIF(DATE'2001-01-01',1)` date DEFAULT NULL, + `NULLIF(DATE'2001-01-01',1.0)` date DEFAULT NULL, + `NULLIF(DATE'2001-01-01',1e0)` date DEFAULT NULL, + `NULLIF(DATE'2001-01-01','2001-01-01')` date DEFAULT NULL, + `NULLIF(DATE'2001-01-01',TIME'00:00:00')` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT +NULLIF(TIME'00:00:01',1), +NULLIF(TIME'00:00:01',1.0), +NULLIF(TIME'00:00:01',1e0), +NULLIF(TIME'00:00:01','00:00:00'), +NULLIF(TIME'00:00:01',DATE'2001-01-01'); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `NULLIF(TIME'00:00:01',1)` time DEFAULT NULL, + `NULLIF(TIME'00:00:01',1.0)` time DEFAULT NULL, + `NULLIF(TIME'00:00:01',1e0)` time DEFAULT NULL, + `NULLIF(TIME'00:00:01','00:00:00')` time DEFAULT NULL, + `NULLIF(TIME'00:00:01',DATE'2001-01-01')` time DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 +( +c_tinyint TINYINT, +c_smallint SMALLINT, +c_int INT, +c_bigint BIGINT, +c_float FLOAT, +c_double DOUBLE, +c_decimal103 DECIMAL(10,3), +c_varchar10 VARCHAR(10), +c_text TEXT, +c_blob BLOB, +c_enum ENUM('one','two','tree'), +c_datetime3 DATETIME(3), +c_timestamp3 TIMESTAMP(3), +c_date DATE, +c_time TIME +); +# +# Checking that the return type depends only on args[0], even when compared to a super type +# +CREATE TABLE t2 AS SELECT +NULLIF(c_tinyint, 1), +NULLIF(c_tinyint, c_smallint), +NULLIF(c_tinyint, c_tinyint), +NULLIF(c_tinyint, c_int), +NULLIF(c_tinyint, c_bigint), +NULLIF(c_tinyint, c_float), +NULLIF(c_tinyint, c_double), +NULLIF(c_tinyint, c_decimal103), +NULLIF(c_tinyint, c_varchar10), +NULLIF(c_tinyint, c_text), +NULLIF(c_tinyint, c_blob), +NULLIF(c_tinyint, c_enum), +NULLIF(c_tinyint, c_datetime3), +NULLIF(c_tinyint, c_timestamp3), +NULLIF(c_tinyint, c_date), +NULLIF(c_tinyint, c_time) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `NULLIF(c_tinyint, 1)` int(4) DEFAULT NULL, + `NULLIF(c_tinyint, c_smallint)` int(4) DEFAULT NULL, + `NULLIF(c_tinyint, c_tinyint)` int(4) DEFAULT NULL, + `NULLIF(c_tinyint, c_int)` int(4) DEFAULT NULL, + `NULLIF(c_tinyint, c_bigint)` int(4) DEFAULT NULL, + `NULLIF(c_tinyint, c_float)` int(4) DEFAULT NULL, + `NULLIF(c_tinyint, c_double)` int(4) DEFAULT NULL, + `NULLIF(c_tinyint, c_decimal103)` int(4) DEFAULT NULL, + `NULLIF(c_tinyint, c_varchar10)` int(4) DEFAULT NULL, + `NULLIF(c_tinyint, c_text)` int(4) DEFAULT NULL, + `NULLIF(c_tinyint, c_blob)` int(4) DEFAULT NULL, + `NULLIF(c_tinyint, c_enum)` int(4) DEFAULT NULL, + `NULLIF(c_tinyint, c_datetime3)` int(4) DEFAULT NULL, + `NULLIF(c_tinyint, c_timestamp3)` int(4) DEFAULT NULL, + `NULLIF(c_tinyint, c_date)` int(4) DEFAULT NULL, + `NULLIF(c_tinyint, c_time)` int(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +NULLIF(c_smallint, 1), +NULLIF(c_smallint, c_smallint), +NULLIF(c_smallint, c_tinyint), +NULLIF(c_smallint, c_int), +NULLIF(c_smallint, c_bigint), +NULLIF(c_smallint, c_float), +NULLIF(c_smallint, c_double), +NULLIF(c_smallint, c_decimal103), +NULLIF(c_smallint, c_varchar10), +NULLIF(c_smallint, c_text), +NULLIF(c_smallint, c_blob), +NULLIF(c_smallint, c_enum), +NULLIF(c_smallint, c_datetime3), +NULLIF(c_smallint, c_timestamp3), +NULLIF(c_smallint, c_date), +NULLIF(c_smallint, c_time) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `NULLIF(c_smallint, 1)` int(6) DEFAULT NULL, + `NULLIF(c_smallint, c_smallint)` int(6) DEFAULT NULL, + `NULLIF(c_smallint, c_tinyint)` int(6) DEFAULT NULL, + `NULLIF(c_smallint, c_int)` int(6) DEFAULT NULL, + `NULLIF(c_smallint, c_bigint)` int(6) DEFAULT NULL, + `NULLIF(c_smallint, c_float)` int(6) DEFAULT NULL, + `NULLIF(c_smallint, c_double)` int(6) DEFAULT NULL, + `NULLIF(c_smallint, c_decimal103)` int(6) DEFAULT NULL, + `NULLIF(c_smallint, c_varchar10)` int(6) DEFAULT NULL, + `NULLIF(c_smallint, c_text)` int(6) DEFAULT NULL, + `NULLIF(c_smallint, c_blob)` int(6) DEFAULT NULL, + `NULLIF(c_smallint, c_enum)` int(6) DEFAULT NULL, + `NULLIF(c_smallint, c_datetime3)` int(6) DEFAULT NULL, + `NULLIF(c_smallint, c_timestamp3)` int(6) DEFAULT NULL, + `NULLIF(c_smallint, c_date)` int(6) DEFAULT NULL, + `NULLIF(c_smallint, c_time)` int(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +NULLIF(c_int, 1), +NULLIF(c_int, c_smallint), +NULLIF(c_int, c_tinyint), +NULLIF(c_int, c_int), +NULLIF(c_int, c_bigint), +NULLIF(c_int, c_float), +NULLIF(c_int, c_double), +NULLIF(c_int, c_decimal103), +NULLIF(c_int, c_varchar10), +NULLIF(c_int, c_text), +NULLIF(c_int, c_blob), +NULLIF(c_int, c_enum), +NULLIF(c_int, c_datetime3), +NULLIF(c_int, c_timestamp3), +NULLIF(c_int, c_date), +NULLIF(c_int, c_time) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `NULLIF(c_int, 1)` int(11) DEFAULT NULL, + `NULLIF(c_int, c_smallint)` int(11) DEFAULT NULL, + `NULLIF(c_int, c_tinyint)` int(11) DEFAULT NULL, + `NULLIF(c_int, c_int)` int(11) DEFAULT NULL, + `NULLIF(c_int, c_bigint)` int(11) DEFAULT NULL, + `NULLIF(c_int, c_float)` int(11) DEFAULT NULL, + `NULLIF(c_int, c_double)` int(11) DEFAULT NULL, + `NULLIF(c_int, c_decimal103)` int(11) DEFAULT NULL, + `NULLIF(c_int, c_varchar10)` int(11) DEFAULT NULL, + `NULLIF(c_int, c_text)` int(11) DEFAULT NULL, + `NULLIF(c_int, c_blob)` int(11) DEFAULT NULL, + `NULLIF(c_int, c_enum)` int(11) DEFAULT NULL, + `NULLIF(c_int, c_datetime3)` int(11) DEFAULT NULL, + `NULLIF(c_int, c_timestamp3)` int(11) DEFAULT NULL, + `NULLIF(c_int, c_date)` int(11) DEFAULT NULL, + `NULLIF(c_int, c_time)` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +NULLIF(c_bigint, 1), +NULLIF(c_bigint, c_smallint), +NULLIF(c_bigint, c_tinyint), +NULLIF(c_bigint, c_int), +NULLIF(c_bigint, c_bigint), +NULLIF(c_bigint, c_float), +NULLIF(c_bigint, c_double), +NULLIF(c_bigint, c_decimal103), +NULLIF(c_bigint, c_varchar10), +NULLIF(c_bigint, c_text), +NULLIF(c_bigint, c_blob), +NULLIF(c_bigint, c_enum), +NULLIF(c_bigint, c_datetime3), +NULLIF(c_bigint, c_timestamp3), +NULLIF(c_bigint, c_date), +NULLIF(c_bigint, c_time) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `NULLIF(c_bigint, 1)` bigint(20) DEFAULT NULL, + `NULLIF(c_bigint, c_smallint)` bigint(20) DEFAULT NULL, + `NULLIF(c_bigint, c_tinyint)` bigint(20) DEFAULT NULL, + `NULLIF(c_bigint, c_int)` bigint(20) DEFAULT NULL, + `NULLIF(c_bigint, c_bigint)` bigint(20) DEFAULT NULL, + `NULLIF(c_bigint, c_float)` bigint(20) DEFAULT NULL, + `NULLIF(c_bigint, c_double)` bigint(20) DEFAULT NULL, + `NULLIF(c_bigint, c_decimal103)` bigint(20) DEFAULT NULL, + `NULLIF(c_bigint, c_varchar10)` bigint(20) DEFAULT NULL, + `NULLIF(c_bigint, c_text)` bigint(20) DEFAULT NULL, + `NULLIF(c_bigint, c_blob)` bigint(20) DEFAULT NULL, + `NULLIF(c_bigint, c_enum)` bigint(20) DEFAULT NULL, + `NULLIF(c_bigint, c_datetime3)` bigint(20) DEFAULT NULL, + `NULLIF(c_bigint, c_timestamp3)` bigint(20) DEFAULT NULL, + `NULLIF(c_bigint, c_date)` bigint(20) DEFAULT NULL, + `NULLIF(c_bigint, c_time)` bigint(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +NULLIF(c_float, 1), +NULLIF(c_float, c_smallint), +NULLIF(c_float, c_tinyint), +NULLIF(c_float, c_int), +NULLIF(c_float, c_bigint), +NULLIF(c_float, c_float), +NULLIF(c_float, c_double), +NULLIF(c_float, c_decimal103), +NULLIF(c_float, c_varchar10), +NULLIF(c_float, c_text), +NULLIF(c_float, c_blob), +NULLIF(c_float, c_enum), +NULLIF(c_float, c_datetime3), +NULLIF(c_float, c_timestamp3), +NULLIF(c_float, c_date), +NULLIF(c_float, c_time) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `NULLIF(c_float, 1)` double DEFAULT NULL, + `NULLIF(c_float, c_smallint)` double DEFAULT NULL, + `NULLIF(c_float, c_tinyint)` double DEFAULT NULL, + `NULLIF(c_float, c_int)` double DEFAULT NULL, + `NULLIF(c_float, c_bigint)` double DEFAULT NULL, + `NULLIF(c_float, c_float)` double DEFAULT NULL, + `NULLIF(c_float, c_double)` double DEFAULT NULL, + `NULLIF(c_float, c_decimal103)` double DEFAULT NULL, + `NULLIF(c_float, c_varchar10)` double DEFAULT NULL, + `NULLIF(c_float, c_text)` double DEFAULT NULL, + `NULLIF(c_float, c_blob)` double DEFAULT NULL, + `NULLIF(c_float, c_enum)` double DEFAULT NULL, + `NULLIF(c_float, c_datetime3)` double DEFAULT NULL, + `NULLIF(c_float, c_timestamp3)` double DEFAULT NULL, + `NULLIF(c_float, c_date)` double DEFAULT NULL, + `NULLIF(c_float, c_time)` double DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +NULLIF(c_double, 1), +NULLIF(c_double, c_smallint), +NULLIF(c_double, c_tinyint), +NULLIF(c_double, c_int), +NULLIF(c_double, c_bigint), +NULLIF(c_double, c_float), +NULLIF(c_double, c_double), +NULLIF(c_double, c_decimal103), +NULLIF(c_double, c_varchar10), +NULLIF(c_double, c_text), +NULLIF(c_double, c_blob), +NULLIF(c_double, c_enum), +NULLIF(c_double, c_datetime3), +NULLIF(c_double, c_timestamp3), +NULLIF(c_double, c_date), +NULLIF(c_double, c_time) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `NULLIF(c_double, 1)` double DEFAULT NULL, + `NULLIF(c_double, c_smallint)` double DEFAULT NULL, + `NULLIF(c_double, c_tinyint)` double DEFAULT NULL, + `NULLIF(c_double, c_int)` double DEFAULT NULL, + `NULLIF(c_double, c_bigint)` double DEFAULT NULL, + `NULLIF(c_double, c_float)` double DEFAULT NULL, + `NULLIF(c_double, c_double)` double DEFAULT NULL, + `NULLIF(c_double, c_decimal103)` double DEFAULT NULL, + `NULLIF(c_double, c_varchar10)` double DEFAULT NULL, + `NULLIF(c_double, c_text)` double DEFAULT NULL, + `NULLIF(c_double, c_blob)` double DEFAULT NULL, + `NULLIF(c_double, c_enum)` double DEFAULT NULL, + `NULLIF(c_double, c_datetime3)` double DEFAULT NULL, + `NULLIF(c_double, c_timestamp3)` double DEFAULT NULL, + `NULLIF(c_double, c_date)` double DEFAULT NULL, + `NULLIF(c_double, c_time)` double DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +NULLIF(c_decimal103, 1), +NULLIF(c_decimal103, c_smallint), +NULLIF(c_decimal103, c_tinyint), +NULLIF(c_decimal103, c_int), +NULLIF(c_decimal103, c_bigint), +NULLIF(c_decimal103, c_float), +NULLIF(c_decimal103, c_double), +NULLIF(c_decimal103, c_decimal103), +NULLIF(c_decimal103, c_varchar10), +NULLIF(c_decimal103, c_text), +NULLIF(c_decimal103, c_blob), +NULLIF(c_decimal103, c_enum), +NULLIF(c_decimal103, c_datetime3), +NULLIF(c_decimal103, c_timestamp3), +NULLIF(c_decimal103, c_date), +NULLIF(c_decimal103, c_time) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `NULLIF(c_decimal103, 1)` decimal(10,3) DEFAULT NULL, + `NULLIF(c_decimal103, c_smallint)` decimal(10,3) DEFAULT NULL, + `NULLIF(c_decimal103, c_tinyint)` decimal(10,3) DEFAULT NULL, + `NULLIF(c_decimal103, c_int)` decimal(10,3) DEFAULT NULL, + `NULLIF(c_decimal103, c_bigint)` decimal(10,3) DEFAULT NULL, + `NULLIF(c_decimal103, c_float)` decimal(10,3) DEFAULT NULL, + `NULLIF(c_decimal103, c_double)` decimal(10,3) DEFAULT NULL, + `NULLIF(c_decimal103, c_decimal103)` decimal(10,3) DEFAULT NULL, + `NULLIF(c_decimal103, c_varchar10)` decimal(10,3) DEFAULT NULL, + `NULLIF(c_decimal103, c_text)` decimal(10,3) DEFAULT NULL, + `NULLIF(c_decimal103, c_blob)` decimal(10,3) DEFAULT NULL, + `NULLIF(c_decimal103, c_enum)` decimal(10,3) DEFAULT NULL, + `NULLIF(c_decimal103, c_datetime3)` decimal(10,3) DEFAULT NULL, + `NULLIF(c_decimal103, c_timestamp3)` decimal(10,3) DEFAULT NULL, + `NULLIF(c_decimal103, c_date)` decimal(10,3) DEFAULT NULL, + `NULLIF(c_decimal103, c_time)` decimal(10,3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +NULLIF(c_varchar10, 1), +NULLIF(c_varchar10, c_smallint), +NULLIF(c_varchar10, c_tinyint), +NULLIF(c_varchar10, c_int), +NULLIF(c_varchar10, c_bigint), +NULLIF(c_varchar10, c_float), +NULLIF(c_varchar10, c_double), +NULLIF(c_varchar10, c_decimal103), +NULLIF(c_varchar10, c_varchar10), +NULLIF(c_varchar10, c_text), +NULLIF(c_varchar10, c_blob), +NULLIF(c_varchar10, c_enum), +NULLIF(c_varchar10, c_datetime3), +NULLIF(c_varchar10, c_timestamp3), +NULLIF(c_varchar10, c_date), +NULLIF(c_varchar10, c_time) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `NULLIF(c_varchar10, 1)` varchar(10) DEFAULT NULL, + `NULLIF(c_varchar10, c_smallint)` varchar(10) DEFAULT NULL, + `NULLIF(c_varchar10, c_tinyint)` varchar(10) DEFAULT NULL, + `NULLIF(c_varchar10, c_int)` varchar(10) DEFAULT NULL, + `NULLIF(c_varchar10, c_bigint)` varchar(10) DEFAULT NULL, + `NULLIF(c_varchar10, c_float)` varchar(10) DEFAULT NULL, + `NULLIF(c_varchar10, c_double)` varchar(10) DEFAULT NULL, + `NULLIF(c_varchar10, c_decimal103)` varchar(10) DEFAULT NULL, + `NULLIF(c_varchar10, c_varchar10)` varchar(10) DEFAULT NULL, + `NULLIF(c_varchar10, c_text)` varchar(10) DEFAULT NULL, + `NULLIF(c_varchar10, c_blob)` varchar(10) DEFAULT NULL, + `NULLIF(c_varchar10, c_enum)` varchar(10) DEFAULT NULL, + `NULLIF(c_varchar10, c_datetime3)` varchar(10) DEFAULT NULL, + `NULLIF(c_varchar10, c_timestamp3)` varchar(10) DEFAULT NULL, + `NULLIF(c_varchar10, c_date)` varchar(10) DEFAULT NULL, + `NULLIF(c_varchar10, c_time)` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +NULLIF(c_text, 1), +NULLIF(c_text, c_smallint), +NULLIF(c_text, c_tinyint), +NULLIF(c_text, c_int), +NULLIF(c_text, c_bigint), +NULLIF(c_text, c_float), +NULLIF(c_text, c_double), +NULLIF(c_text, c_decimal103), +NULLIF(c_text, c_varchar10), +NULLIF(c_text, c_text), +NULLIF(c_text, c_blob), +NULLIF(c_text, c_enum), +NULLIF(c_text, c_datetime3), +NULLIF(c_text, c_timestamp3), +NULLIF(c_text, c_date), +NULLIF(c_text, c_time) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `NULLIF(c_text, 1)` longtext, + `NULLIF(c_text, c_smallint)` longtext, + `NULLIF(c_text, c_tinyint)` longtext, + `NULLIF(c_text, c_int)` longtext, + `NULLIF(c_text, c_bigint)` longtext, + `NULLIF(c_text, c_float)` longtext, + `NULLIF(c_text, c_double)` longtext, + `NULLIF(c_text, c_decimal103)` longtext, + `NULLIF(c_text, c_varchar10)` longtext, + `NULLIF(c_text, c_text)` longtext, + `NULLIF(c_text, c_blob)` longtext, + `NULLIF(c_text, c_enum)` longtext, + `NULLIF(c_text, c_datetime3)` longtext, + `NULLIF(c_text, c_timestamp3)` longtext, + `NULLIF(c_text, c_date)` longtext, + `NULLIF(c_text, c_time)` longtext +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +NULLIF(c_blob, 1), +NULLIF(c_blob, c_smallint), +NULLIF(c_blob, c_tinyint), +NULLIF(c_blob, c_int), +NULLIF(c_blob, c_bigint), +NULLIF(c_blob, c_float), +NULLIF(c_blob, c_double), +NULLIF(c_blob, c_decimal103), +NULLIF(c_blob, c_varchar10), +NULLIF(c_blob, c_text), +NULLIF(c_blob, c_blob), +NULLIF(c_blob, c_enum), +NULLIF(c_blob, c_datetime3), +NULLIF(c_blob, c_timestamp3), +NULLIF(c_blob, c_date), +NULLIF(c_blob, c_time) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `NULLIF(c_blob, 1)` longblob, + `NULLIF(c_blob, c_smallint)` longblob, + `NULLIF(c_blob, c_tinyint)` longblob, + `NULLIF(c_blob, c_int)` longblob, + `NULLIF(c_blob, c_bigint)` longblob, + `NULLIF(c_blob, c_float)` longblob, + `NULLIF(c_blob, c_double)` longblob, + `NULLIF(c_blob, c_decimal103)` longblob, + `NULLIF(c_blob, c_varchar10)` longblob, + `NULLIF(c_blob, c_text)` longblob, + `NULLIF(c_blob, c_blob)` longblob, + `NULLIF(c_blob, c_enum)` longblob, + `NULLIF(c_blob, c_datetime3)` longblob, + `NULLIF(c_blob, c_timestamp3)` longblob, + `NULLIF(c_blob, c_date)` longblob, + `NULLIF(c_blob, c_time)` longblob +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +NULLIF(c_enum, 1), +NULLIF(c_enum, c_smallint), +NULLIF(c_enum, c_tinyint), +NULLIF(c_enum, c_int), +NULLIF(c_enum, c_bigint), +NULLIF(c_enum, c_float), +NULLIF(c_enum, c_double), +NULLIF(c_enum, c_decimal103), +NULLIF(c_enum, c_varchar10), +NULLIF(c_enum, c_text), +NULLIF(c_enum, c_blob), +NULLIF(c_enum, c_enum), +NULLIF(c_enum, c_datetime3), +NULLIF(c_enum, c_timestamp3), +NULLIF(c_enum, c_date), +NULLIF(c_enum, c_time) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `NULLIF(c_enum, 1)` varchar(4) DEFAULT NULL, + `NULLIF(c_enum, c_smallint)` varchar(4) DEFAULT NULL, + `NULLIF(c_enum, c_tinyint)` varchar(4) DEFAULT NULL, + `NULLIF(c_enum, c_int)` varchar(4) DEFAULT NULL, + `NULLIF(c_enum, c_bigint)` varchar(4) DEFAULT NULL, + `NULLIF(c_enum, c_float)` varchar(4) DEFAULT NULL, + `NULLIF(c_enum, c_double)` varchar(4) DEFAULT NULL, + `NULLIF(c_enum, c_decimal103)` varchar(4) DEFAULT NULL, + `NULLIF(c_enum, c_varchar10)` varchar(4) DEFAULT NULL, + `NULLIF(c_enum, c_text)` varchar(4) DEFAULT NULL, + `NULLIF(c_enum, c_blob)` varchar(4) DEFAULT NULL, + `NULLIF(c_enum, c_enum)` varchar(4) DEFAULT NULL, + `NULLIF(c_enum, c_datetime3)` varchar(4) DEFAULT NULL, + `NULLIF(c_enum, c_timestamp3)` varchar(4) DEFAULT NULL, + `NULLIF(c_enum, c_date)` varchar(4) DEFAULT NULL, + `NULLIF(c_enum, c_time)` varchar(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +NULLIF(c_datetime3, 1), +NULLIF(c_datetime3, c_smallint), +NULLIF(c_datetime3, c_tinyint), +NULLIF(c_datetime3, c_int), +NULLIF(c_datetime3, c_bigint), +NULLIF(c_datetime3, c_float), +NULLIF(c_datetime3, c_double), +NULLIF(c_datetime3, c_decimal103), +NULLIF(c_datetime3, c_varchar10), +NULLIF(c_datetime3, c_text), +NULLIF(c_datetime3, c_blob), +NULLIF(c_datetime3, c_enum), +NULLIF(c_datetime3, c_datetime3), +NULLIF(c_datetime3, c_timestamp3), +NULLIF(c_datetime3, c_date), +NULLIF(c_datetime3, c_time) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `NULLIF(c_datetime3, 1)` datetime(3) DEFAULT NULL, + `NULLIF(c_datetime3, c_smallint)` datetime(3) DEFAULT NULL, + `NULLIF(c_datetime3, c_tinyint)` datetime(3) DEFAULT NULL, + `NULLIF(c_datetime3, c_int)` datetime(3) DEFAULT NULL, + `NULLIF(c_datetime3, c_bigint)` datetime(3) DEFAULT NULL, + `NULLIF(c_datetime3, c_float)` datetime(3) DEFAULT NULL, + `NULLIF(c_datetime3, c_double)` datetime(3) DEFAULT NULL, + `NULLIF(c_datetime3, c_decimal103)` datetime(3) DEFAULT NULL, + `NULLIF(c_datetime3, c_varchar10)` datetime(3) DEFAULT NULL, + `NULLIF(c_datetime3, c_text)` datetime(3) DEFAULT NULL, + `NULLIF(c_datetime3, c_blob)` datetime(3) DEFAULT NULL, + `NULLIF(c_datetime3, c_enum)` datetime(3) DEFAULT NULL, + `NULLIF(c_datetime3, c_datetime3)` datetime(3) DEFAULT NULL, + `NULLIF(c_datetime3, c_timestamp3)` datetime(3) DEFAULT NULL, + `NULLIF(c_datetime3, c_date)` datetime(3) DEFAULT NULL, + `NULLIF(c_datetime3, c_time)` datetime(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +NULLIF(c_timestamp3, 1), +NULLIF(c_timestamp3, c_smallint), +NULLIF(c_timestamp3, c_tinyint), +NULLIF(c_timestamp3, c_int), +NULLIF(c_timestamp3, c_bigint), +NULLIF(c_timestamp3, c_float), +NULLIF(c_timestamp3, c_double), +NULLIF(c_timestamp3, c_decimal103), +NULLIF(c_timestamp3, c_varchar10), +NULLIF(c_timestamp3, c_text), +NULLIF(c_timestamp3, c_blob), +NULLIF(c_timestamp3, c_enum), +NULLIF(c_timestamp3, c_datetime3), +NULLIF(c_timestamp3, c_timestamp3), +NULLIF(c_timestamp3, c_date), +NULLIF(c_timestamp3, c_time) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `NULLIF(c_timestamp3, 1)` timestamp(3) NULL DEFAULT NULL, + `NULLIF(c_timestamp3, c_smallint)` timestamp(3) NULL DEFAULT NULL, + `NULLIF(c_timestamp3, c_tinyint)` timestamp(3) NULL DEFAULT NULL, + `NULLIF(c_timestamp3, c_int)` timestamp(3) NULL DEFAULT NULL, + `NULLIF(c_timestamp3, c_bigint)` timestamp(3) NULL DEFAULT NULL, + `NULLIF(c_timestamp3, c_float)` timestamp(3) NULL DEFAULT NULL, + `NULLIF(c_timestamp3, c_double)` timestamp(3) NULL DEFAULT NULL, + `NULLIF(c_timestamp3, c_decimal103)` timestamp(3) NULL DEFAULT NULL, + `NULLIF(c_timestamp3, c_varchar10)` timestamp(3) NULL DEFAULT NULL, + `NULLIF(c_timestamp3, c_text)` timestamp(3) NULL DEFAULT NULL, + `NULLIF(c_timestamp3, c_blob)` timestamp(3) NULL DEFAULT NULL, + `NULLIF(c_timestamp3, c_enum)` timestamp(3) NULL DEFAULT NULL, + `NULLIF(c_timestamp3, c_datetime3)` timestamp(3) NULL DEFAULT NULL, + `NULLIF(c_timestamp3, c_timestamp3)` timestamp(3) NULL DEFAULT NULL, + `NULLIF(c_timestamp3, c_date)` timestamp(3) NULL DEFAULT NULL, + `NULLIF(c_timestamp3, c_time)` timestamp(3) NULL DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +NULLIF(c_date, 1), +NULLIF(c_date, c_smallint), +NULLIF(c_date, c_tinyint), +NULLIF(c_date, c_int), +NULLIF(c_date, c_bigint), +NULLIF(c_date, c_float), +NULLIF(c_date, c_double), +NULLIF(c_date, c_decimal103), +NULLIF(c_date, c_varchar10), +NULLIF(c_date, c_text), +NULLIF(c_date, c_blob), +NULLIF(c_date, c_enum), +NULLIF(c_date, c_datetime3), +NULLIF(c_date, c_timestamp3), +NULLIF(c_date, c_date), +NULLIF(c_date, c_time) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `NULLIF(c_date, 1)` date DEFAULT NULL, + `NULLIF(c_date, c_smallint)` date DEFAULT NULL, + `NULLIF(c_date, c_tinyint)` date DEFAULT NULL, + `NULLIF(c_date, c_int)` date DEFAULT NULL, + `NULLIF(c_date, c_bigint)` date DEFAULT NULL, + `NULLIF(c_date, c_float)` date DEFAULT NULL, + `NULLIF(c_date, c_double)` date DEFAULT NULL, + `NULLIF(c_date, c_decimal103)` date DEFAULT NULL, + `NULLIF(c_date, c_varchar10)` date DEFAULT NULL, + `NULLIF(c_date, c_text)` date DEFAULT NULL, + `NULLIF(c_date, c_blob)` date DEFAULT NULL, + `NULLIF(c_date, c_enum)` date DEFAULT NULL, + `NULLIF(c_date, c_datetime3)` date DEFAULT NULL, + `NULLIF(c_date, c_timestamp3)` date DEFAULT NULL, + `NULLIF(c_date, c_date)` date DEFAULT NULL, + `NULLIF(c_date, c_time)` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +NULLIF(c_time, 1), +NULLIF(c_time, c_smallint), +NULLIF(c_time, c_tinyint), +NULLIF(c_time, c_int), +NULLIF(c_time, c_bigint), +NULLIF(c_time, c_float), +NULLIF(c_time, c_double), +NULLIF(c_time, c_decimal103), +NULLIF(c_time, c_varchar10), +NULLIF(c_time, c_text), +NULLIF(c_time, c_blob), +NULLIF(c_time, c_enum), +NULLIF(c_time, c_datetime3), +NULLIF(c_time, c_timestamp3), +NULLIF(c_time, c_date), +NULLIF(c_time, c_time) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `NULLIF(c_time, 1)` time DEFAULT NULL, + `NULLIF(c_time, c_smallint)` time DEFAULT NULL, + `NULLIF(c_time, c_tinyint)` time DEFAULT NULL, + `NULLIF(c_time, c_int)` time DEFAULT NULL, + `NULLIF(c_time, c_bigint)` time DEFAULT NULL, + `NULLIF(c_time, c_float)` time DEFAULT NULL, + `NULLIF(c_time, c_double)` time DEFAULT NULL, + `NULLIF(c_time, c_decimal103)` time DEFAULT NULL, + `NULLIF(c_time, c_varchar10)` time DEFAULT NULL, + `NULLIF(c_time, c_text)` time DEFAULT NULL, + `NULLIF(c_time, c_blob)` time DEFAULT NULL, + `NULLIF(c_time, c_enum)` time DEFAULT NULL, + `NULLIF(c_time, c_datetime3)` time DEFAULT NULL, + `NULLIF(c_time, c_timestamp3)` time DEFAULT NULL, + `NULLIF(c_time, c_date)` time DEFAULT NULL, + `NULLIF(c_time, c_time)` time DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +# +# Checking that the return type depends only on args[0], even if compared to a field +# +CREATE TABLE t2 AS SELECT +NULLIF(1, 1), +NULLIF(1, c_smallint), +NULLIF(1, c_tinyint), +NULLIF(1, c_int), +NULLIF(1, c_bigint), +NULLIF(1, c_float), +NULLIF(1, c_double), +NULLIF(1, c_decimal103), +NULLIF(1, c_varchar10), +NULLIF(1, c_text), +NULLIF(1, c_blob), +NULLIF(1, c_enum), +NULLIF(1, c_datetime3), +NULLIF(1, c_timestamp3), +NULLIF(1, c_date), +NULLIF(1, c_time) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `NULLIF(1, 1)` int(1) DEFAULT NULL, + `NULLIF(1, c_smallint)` int(1) DEFAULT NULL, + `NULLIF(1, c_tinyint)` int(1) DEFAULT NULL, + `NULLIF(1, c_int)` int(1) DEFAULT NULL, + `NULLIF(1, c_bigint)` int(1) DEFAULT NULL, + `NULLIF(1, c_float)` int(1) DEFAULT NULL, + `NULLIF(1, c_double)` int(1) DEFAULT NULL, + `NULLIF(1, c_decimal103)` int(1) DEFAULT NULL, + `NULLIF(1, c_varchar10)` int(1) DEFAULT NULL, + `NULLIF(1, c_text)` int(1) DEFAULT NULL, + `NULLIF(1, c_blob)` int(1) DEFAULT NULL, + `NULLIF(1, c_enum)` int(1) DEFAULT NULL, + `NULLIF(1, c_datetime3)` int(1) DEFAULT NULL, + `NULLIF(1, c_timestamp3)` int(1) DEFAULT NULL, + `NULLIF(1, c_date)` int(1) DEFAULT NULL, + `NULLIF(1, c_time)` int(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +NULLIF(1.0, 1), +NULLIF(1.0, c_smallint), +NULLIF(1.0, c_tinyint), +NULLIF(1.0, c_int), +NULLIF(1.0, c_bigint), +NULLIF(1.0, c_float), +NULLIF(1.0, c_double), +NULLIF(1.0, c_decimal103), +NULLIF(1.0, c_varchar10), +NULLIF(1.0, c_text), +NULLIF(1.0, c_blob), +NULLIF(1.0, c_enum), +NULLIF(1.0, c_datetime3), +NULLIF(1.0, c_timestamp3), +NULLIF(1.0, c_date), +NULLIF(1.0, c_time) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `NULLIF(1.0, 1)` decimal(2,1) DEFAULT NULL, + `NULLIF(1.0, c_smallint)` decimal(2,1) DEFAULT NULL, + `NULLIF(1.0, c_tinyint)` decimal(2,1) DEFAULT NULL, + `NULLIF(1.0, c_int)` decimal(2,1) DEFAULT NULL, + `NULLIF(1.0, c_bigint)` decimal(2,1) DEFAULT NULL, + `NULLIF(1.0, c_float)` decimal(2,1) DEFAULT NULL, + `NULLIF(1.0, c_double)` decimal(2,1) DEFAULT NULL, + `NULLIF(1.0, c_decimal103)` decimal(2,1) DEFAULT NULL, + `NULLIF(1.0, c_varchar10)` decimal(2,1) DEFAULT NULL, + `NULLIF(1.0, c_text)` decimal(2,1) DEFAULT NULL, + `NULLIF(1.0, c_blob)` decimal(2,1) DEFAULT NULL, + `NULLIF(1.0, c_enum)` decimal(2,1) DEFAULT NULL, + `NULLIF(1.0, c_datetime3)` decimal(2,1) DEFAULT NULL, + `NULLIF(1.0, c_timestamp3)` decimal(2,1) DEFAULT NULL, + `NULLIF(1.0, c_date)` decimal(2,1) DEFAULT NULL, + `NULLIF(1.0, c_time)` decimal(2,1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +NULLIF(1e0, 1), +NULLIF(1e0, c_smallint), +NULLIF(1e0, c_tinyint), +NULLIF(1e0, c_int), +NULLIF(1e0, c_bigint), +NULLIF(1e0, c_float), +NULLIF(1e0, c_double), +NULLIF(1e0, c_decimal103), +NULLIF(1e0, c_varchar10), +NULLIF(1e0, c_text), +NULLIF(1e0, c_blob), +NULLIF(1e0, c_enum), +NULLIF(1e0, c_datetime3), +NULLIF(1e0, c_timestamp3), +NULLIF(1e0, c_date), +NULLIF(1e0, c_time) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `NULLIF(1e0, 1)` double DEFAULT NULL, + `NULLIF(1e0, c_smallint)` double DEFAULT NULL, + `NULLIF(1e0, c_tinyint)` double DEFAULT NULL, + `NULLIF(1e0, c_int)` double DEFAULT NULL, + `NULLIF(1e0, c_bigint)` double DEFAULT NULL, + `NULLIF(1e0, c_float)` double DEFAULT NULL, + `NULLIF(1e0, c_double)` double DEFAULT NULL, + `NULLIF(1e0, c_decimal103)` double DEFAULT NULL, + `NULLIF(1e0, c_varchar10)` double DEFAULT NULL, + `NULLIF(1e0, c_text)` double DEFAULT NULL, + `NULLIF(1e0, c_blob)` double DEFAULT NULL, + `NULLIF(1e0, c_enum)` double DEFAULT NULL, + `NULLIF(1e0, c_datetime3)` double DEFAULT NULL, + `NULLIF(1e0, c_timestamp3)` double DEFAULT NULL, + `NULLIF(1e0, c_date)` double DEFAULT NULL, + `NULLIF(1e0, c_time)` double DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +NULLIF('1', 1), +NULLIF('1', c_smallint), +NULLIF('1', c_tinyint), +NULLIF('1', c_int), +NULLIF('1', c_bigint), +NULLIF('1', c_float), +NULLIF('1', c_double), +NULLIF('1', c_decimal103), +NULLIF('1', c_varchar10), +NULLIF('1', c_text), +NULLIF('1', c_blob), +NULLIF('1', c_enum), +NULLIF('1', c_datetime3), +NULLIF('1', c_timestamp3), +NULLIF('1', c_date), +NULLIF('1', c_time) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `NULLIF('1', 1)` varchar(1) DEFAULT NULL, + `NULLIF('1', c_smallint)` varchar(1) DEFAULT NULL, + `NULLIF('1', c_tinyint)` varchar(1) DEFAULT NULL, + `NULLIF('1', c_int)` varchar(1) DEFAULT NULL, + `NULLIF('1', c_bigint)` varchar(1) DEFAULT NULL, + `NULLIF('1', c_float)` varchar(1) DEFAULT NULL, + `NULLIF('1', c_double)` varchar(1) DEFAULT NULL, + `NULLIF('1', c_decimal103)` varchar(1) DEFAULT NULL, + `NULLIF('1', c_varchar10)` varchar(1) DEFAULT NULL, + `NULLIF('1', c_text)` varchar(1) DEFAULT NULL, + `NULLIF('1', c_blob)` varchar(1) DEFAULT NULL, + `NULLIF('1', c_enum)` varchar(1) DEFAULT NULL, + `NULLIF('1', c_datetime3)` varchar(1) DEFAULT NULL, + `NULLIF('1', c_timestamp3)` varchar(1) DEFAULT NULL, + `NULLIF('1', c_date)` varchar(1) DEFAULT NULL, + `NULLIF('1', c_time)` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +NULLIF(TIME'10:10:10', 1), +NULLIF(TIME'10:10:10', c_smallint), +NULLIF(TIME'10:10:10', c_tinyint), +NULLIF(TIME'10:10:10', c_int), +NULLIF(TIME'10:10:10', c_bigint), +NULLIF(TIME'10:10:10', c_float), +NULLIF(TIME'10:10:10', c_double), +NULLIF(TIME'10:10:10', c_decimal103), +NULLIF(TIME'10:10:10', c_varchar10), +NULLIF(TIME'10:10:10', c_text), +NULLIF(TIME'10:10:10', c_blob), +NULLIF(TIME'10:10:10', c_enum), +NULLIF(TIME'10:10:10', c_datetime3), +NULLIF(TIME'10:10:10', c_timestamp3), +NULLIF(TIME'10:10:10', c_date), +NULLIF(TIME'10:10:10', c_time) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `NULLIF(TIME'10:10:10', 1)` time DEFAULT NULL, + `NULLIF(TIME'10:10:10', c_smallint)` time DEFAULT NULL, + `NULLIF(TIME'10:10:10', c_tinyint)` time DEFAULT NULL, + `NULLIF(TIME'10:10:10', c_int)` time DEFAULT NULL, + `NULLIF(TIME'10:10:10', c_bigint)` time DEFAULT NULL, + `NULLIF(TIME'10:10:10', c_float)` time DEFAULT NULL, + `NULLIF(TIME'10:10:10', c_double)` time DEFAULT NULL, + `NULLIF(TIME'10:10:10', c_decimal103)` time DEFAULT NULL, + `NULLIF(TIME'10:10:10', c_varchar10)` time DEFAULT NULL, + `NULLIF(TIME'10:10:10', c_text)` time DEFAULT NULL, + `NULLIF(TIME'10:10:10', c_blob)` time DEFAULT NULL, + `NULLIF(TIME'10:10:10', c_enum)` time DEFAULT NULL, + `NULLIF(TIME'10:10:10', c_datetime3)` time DEFAULT NULL, + `NULLIF(TIME'10:10:10', c_timestamp3)` time DEFAULT NULL, + `NULLIF(TIME'10:10:10', c_date)` time DEFAULT NULL, + `NULLIF(TIME'10:10:10', c_time)` time DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +# MDEV-7759 NULLIF(x,y) is not equal to CASE WHEN x=y THEN NULL ELSE x END +# +CREATE TABLE t1 (a YEAR); +INSERT INTO t1 VALUES (2010),(2020); +SELECT * FROM t1 WHERE a=2010 AND NULLIF(10.1,a) IS NULL; +a +2010 +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND NULLIF(10.1,a) IS NULL; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010) +SELECT * FROM t1 WHERE a=2010 AND CASE WHEN 10.1=a THEN NULL ELSE 10.1 END IS NULL; +a +2010 +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND CASE WHEN 10.1=a THEN NULL ELSE 10.1 END IS NULL; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010) +DROP TABLE t1; +# Two warnings expected +CREATE TABLE t1 AS SELECT +NULLIF(TIMESTAMP'2001-01-01 00:00:00',1) AS a, +CASE WHEN TIMESTAMP'2001-01-01 00:00:00'=1 THEN NULL +ELSE TIMESTAMP'2001-01-01 00:00:00' + END AS b; +Warnings: +Warning 1292 Incorrect datetime value: '1' +Warning 1292 Incorrect datetime value: '1' +DROP TABLE t1; +# +# MDEV-8785 Wrong results for EXPLAIN EXTENDED...WHERE NULLIF(latin1_col, _utf8'a' COLLATE utf8_bin) IS NOT NULL +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1); +INSERT INTO t1 VALUES ('a'),('A'); +SELECT a, NULLIF(a,_utf8'a' COLLATE utf8_bin) IS NULL FROM t1; +a NULLIF(a,_utf8'a' COLLATE utf8_bin) IS NULL +a 1 +A 0 +SELECT CHARSET(NULLIF(a,_utf8'a' COLLATE utf8_bin)) FROM t1; +CHARSET(NULLIF(a,_utf8'a' COLLATE utf8_bin)) +latin1 +latin1 +EXPLAIN EXTENDED SELECT NULLIF(a,_utf8'a' COLLATE utf8_bin) IS NULL AS expr FROM t1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 +Warnings: +Note 1003 select isnull((case when convert(`test`.`t1`.`a` using utf8) = (_utf8'a' collate utf8_bin) then NULL else `test`.`t1`.`a` end)) AS `expr` from `test`.`t1` +DROP TABLE t1; +# +# MDEV-8740 Wrong result for SELECT..WHERE year_field=10 AND NULLIF(year_field,2011.1)='2011' +# +CREATE TABLE t1 (a YEAR); +INSERT INTO t1 VALUES (2010),(2011); +SELECT a=10 AND NULLIF(a,2011.1)='2011' AS cond FROM t1; +cond +0 +0 +SELECT * FROM t1 WHERE a=10; +a +2010 +SELECT * FROM t1 WHERE NULLIF(a,2011.1)='2011'; +a +SELECT * FROM t1 WHERE a=10 AND NULLIF(a,2011.1)='2011'; +a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a=10 AND NULLIF(a,2011.1)='2011'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 2010) and ((case when 2010 = 2011 then NULL else `test`.`t1`.`a` end) = '2011')) +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a=10 AND NULLIF(a,2011.1)=CONCAT('2011',RAND()); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 2010) and ((case when 2010 = 2011 then NULL else `test`.`t1`.`a` end) = concat('2011',rand()))) +DROP TABLE t1; +# +# MDEV-8754 Wrong result for SELECT..WHERE year_field=2020 AND NULLIF(year_field,2010)='2020' +# +CREATE TABLE t1 (a YEAR); +INSERT INTO t1 VALUES (2010),(2020); +SELECT * FROM t1 WHERE a=2020; +a +2020 +SELECT * FROM t1 WHERE NULLIF(a,2010)='2020'; +a +2020 +SELECT * FROM t1 WHERE a=2020 AND NULLIF(a,2010)='2020'; +a +2020 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a=2020 AND NULLIF(a,2010)='2020'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 2020) and ((case when 2020 = 2010 then NULL else `test`.`t1`.`a` end) = '2020')) +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a=2020 AND NULLIF(a,2010)=CONCAT('2020',RAND()); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 2020) and ((case when 2020 = 2010 then NULL else `test`.`t1`.`a` end) = concat('2020',rand()))) +DROP TABLE t1; +# +# MDEV-9181 (NULLIF(count(table.col)), 0) gives wrong result on 10.1.x +# +CREATE TABLE t1 (c1 varchar(50) DEFAULT NULL); +INSERT INTO t1 (c1) VALUES ('hello'), ('hello\r\n'), ('hello'),('hello'); +SELECT NULLIF(COUNT(c1),0) FROM t1; +NULLIF(COUNT(c1),0) +4 +SELECT CASE WHEN COUNT(c1)=0 THEN NULL ELSE COUNT(c1) END FROM t1; +CASE WHEN COUNT(c1)=0 THEN NULL ELSE COUNT(c1) END +4 +SELECT NULLIF(COUNT(c1)+0,0) AS c1,NULLIF(CAST(COUNT(c1) AS SIGNED),0) AS c2,NULLIF(CONCAT(COUNT(c1)),0) AS c3 FROM t1; +c1 c2 c3 +4 4 4 +SELECT NULLIF(COUNT(DISTINCT c1),0) FROM t1; +NULLIF(COUNT(DISTINCT c1),0) +2 +SELECT CASE WHEN COUNT(DISTINCT c1)=0 THEN NULL ELSE COUNT(DISTINCT c1) END FROM t1; +CASE WHEN COUNT(DISTINCT c1)=0 THEN NULL ELSE COUNT(DISTINCT c1) END +2 +DROP TABLE t1; +CREATE TABLE t1 ( +id INT NOT NULL, +c1 INT DEFAULT NULL +); +INSERT INTO t1 VALUES (1,1),(1,2),(2,3),(2,4); +SELECT NULLIF(COUNT(c1),0) AS c1,NULLIF(COUNT(c1)+0,0) AS c1_wrapped,CASE WHEN COUNT(c1) IS NULL THEN 0 ELSE COUNT(c1) END AS c1_case FROM t1 GROUP BY id; +c1 c1_wrapped c1_case +2 2 2 +2 2 2 +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +SET @a=0; +SELECT NULLIF(LAST_VALUE(@a:=@a+1,a),0) FROM t1; +NULLIF(LAST_VALUE(@a:=@a+1,a),0) +1 +2 +3 +SELECT @a; +@a +6 +SET @a=0; +SELECT NULLIF(AVG(a),0), NULLIF(AVG(LAST_VALUE(@a:=@a+1,a)),0) FROM t1; +NULLIF(AVG(a),0) NULLIF(AVG(LAST_VALUE(@a:=@a+1,a)),0) +2.0000 2.0000 +SELECT @a; +@a +3 +EXPLAIN EXTENDED SELECT NULLIF(a,0) FROM t1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 select nullif(`test`.`t1`.`a`,0) AS `NULLIF(a,0)` from `test`.`t1` +EXPLAIN EXTENDED SELECT NULLIF(AVG(a),0) FROM t1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 select nullif(<cache>(avg(`test`.`t1`.`a`)),0) AS `NULLIF(AVG(a),0)` from `test`.`t1` +DROP TABLE t1; +create table t1 (col1 varchar(50)); +create view v1 AS select nullif(count(distinct col1),0) from t1; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select nullif(count(distinct `t1`.`col1`),0) AS `nullif(count(distinct col1),0)` from `t1` latin1 latin1_swedish_ci +drop view v1; +drop table t1; +create table t1 (col1 varchar(50) default null); +insert into t1 (col1) values ('hello'), ('hello'), ('hello'); +create view v1 as select nullif(count(col1),0) from t1; +select * from v1; +nullif(count(col1),0) +3 +select nullif(count(col1),0) from t1; +nullif(count(col1),0) +3 +drop view v1; +drop table t1; +select nullif((select 1), (select 2)); +nullif((select 1), (select 2)) +1 +create table t1 (f int); +insert into t1 values (1),(2); +select nullif( not f, 1 ) from t1; +nullif( not f, 1 ) +0 +0 +drop table t1; +set names utf8; +create table t1 (f1 varchar(10)); +insert into t1 values ('2015-12-31'); +select power( timestamp( nullif( '2002-09-08', f1 ) ), 24 ) from t1; +ERROR 22003: DOUBLE value is out of range in 'pow(cast((case when '2002-09-08' = `test`.`t1`.`f1` then NULL else '2002-09-08' end) as datetime(6)),24)' +drop table t1; +CREATE TABLE t1 (f1 INT); +INSERT INTO t1 VALUES (1),(2); +PREPARE stmt FROM "SELECT * FROM t1 WHERE NULLIF( ( 1, 2 ) IN ( SELECT 3, 4 ), 1 )"; +EXECUTE stmt; +f1 +EXECUTE stmt; +f1 +DROP TABLE t1; +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM t1 WHERE NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(i = ROUND(0), 14), 13), 12), 11), 10), 9), 8), 7), 6), 5), 4), 3), 2), 1); +i +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/old-mode.result b/mysql-test/r/old-mode.result index 4f650c3c781..c2ee3324ede 100644 --- a/mysql-test/r/old-mode.result +++ b/mysql-test/r/old-mode.result @@ -104,6 +104,7 @@ DROP TABLE t1; # # MDEV-6649 Different warnings for TIME and TIME(N) when @@old_mode=zero_date_time_cast # +SET @@global.mysql56_temporal_format=true; SET @@old_mode=zero_date_time_cast; CREATE TABLE t1 (a TIME,b TIME(1)); INSERT INTO t1 VALUES (TIME'830:20:30',TIME'830:20:30'); @@ -114,3 +115,15 @@ Warnings: Warning 1264 Out of range value for column 'a' at row 1 Warning 1264 Out of range value for column 'b' at row 1 DROP TABLE t1; +SET @@global.mysql56_temporal_format=false; +SET @@old_mode=zero_date_time_cast; +CREATE TABLE t1 (a TIME,b TIME(1)); +INSERT INTO t1 VALUES (TIME'830:20:30',TIME'830:20:30'); +SELECT TO_DAYS(a), TO_DAYS(b) FROM t1; +TO_DAYS(a) TO_DAYS(b) +NULL NULL +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'b' at row 1 +DROP TABLE t1; +SET @@global.mysql56_temporal_format=DEFAULT; diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result index dd78b1967c4..852fdee51ee 100644 --- a/mysql-test/r/openssl_1.result +++ b/mysql-test/r/openssl_1.result @@ -1,3 +1,5 @@ +set local sql_mode=""; +set global sql_mode=""; drop table if exists t1; create table t1(f1 int); insert into t1 values (5); @@ -206,6 +208,7 @@ SHOW STATUS LIKE 'Ssl_cipher'; Variable_name Value Ssl_cipher DHE-RSA-AES256-SHA DROP USER bug42158@localhost; +set global sql_mode=default; End of 5.1 tests /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; diff --git a/mysql-test/r/openssl_6975,tlsv10.result b/mysql-test/r/openssl_6975,tlsv10.result index 52d5978749e..6285faa0143 100644 --- a/mysql-test/r/openssl_6975,tlsv10.result +++ b/mysql-test/r/openssl_6975,tlsv10.result @@ -1,4 +1,6 @@ +create user ssl_sslv3@localhost; grant select on test.* to ssl_sslv3@localhost require cipher "RC4-SHA"; +create user ssl_tls12@localhost; grant select on test.* to ssl_tls12@localhost require cipher "AES128-SHA256"; TLS1.2 ciphers: user is ok with any cipher ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure diff --git a/mysql-test/r/openssl_6975,tlsv12.result b/mysql-test/r/openssl_6975,tlsv12.result index 033220427be..31d2658c829 100644 --- a/mysql-test/r/openssl_6975,tlsv12.result +++ b/mysql-test/r/openssl_6975,tlsv12.result @@ -1,4 +1,6 @@ +create user ssl_sslv3@localhost; grant select on test.* to ssl_sslv3@localhost require cipher "RC4-SHA"; +create user ssl_tls12@localhost; grant select on test.* to ssl_tls12@localhost require cipher "AES128-SHA256"; TLS1.2 ciphers: user is ok with any cipher Variable_name Value diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 294142737d9..a015819e480 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -287,6 +287,8 @@ PRIMARY KEY (member_id) Warnings: Warning 1101 BLOB/TEXT column 'info' can't have a default value insert into t1 (member_id) values (1),(2),(3); +Warnings: +Warning 1364 Field 'info' doesn't have a default value select member_id, nickname, voornaam FROM t1 ORDER by lastchange_datum DESC LIMIT 2; member_id nickname voornaam @@ -297,7 +299,7 @@ create table t1 (a int not null, b int, c varchar(10), key (a, b, c)); insert into t1 values (1, NULL, NULL), (1, NULL, 'b'), (1, 1, NULL), (1, 1, 'b'), (1, 1, 'b'), (2, 1, 'a'), (2, 1, 'b'), (2, 2, 'a'), (2, 2, 'b'), (2, 3, 'c'),(1,3,'b'); explain select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index a a 22 NULL 11 Using where; Using index +1 SIMPLE t1 range a a 22 NULL 2 Using where; Using index select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc; a b c 1 NULL b @@ -2569,7 +2571,7 @@ SELECT * FROM t1 r JOIN t1 s ON r.a = s.a WHERE s.a IN (2,9) OR s.a < 100 AND s.a != 0 ORDER BY 1 LIMIT 10; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE r index PRIMARY PRIMARY 4 NULL 10 100.00 Using where; Using index +1 SIMPLE r range PRIMARY PRIMARY 4 NULL 12 100.00 Using where; Using index 1 SIMPLE s eq_ref PRIMARY PRIMARY 4 test.r.a 1 100.00 Using index Warnings: Note 1003 select `test`.`r`.`a` AS `a`,`test`.`s`.`a` AS `a` from `test`.`t1` `r` join `test`.`t1` `s` where ((`test`.`s`.`a` = `test`.`r`.`a`) and ((`test`.`r`.`a` in (2,9)) or ((`test`.`r`.`a` < 100) and (`test`.`r`.`a` <> 0)))) order by 1 limit 10 @@ -2600,7 +2602,7 @@ CREATE TABLE t1 (a INT,KEY (a)); INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); EXPLAIN SELECT DISTINCT a,1 FROM t1 WHERE a <> 1 ORDER BY a DESC; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index a a 5 NULL 10 Using where; Using index; Using filesort +1 SIMPLE t1 range a a 5 NULL 10 Using where; Using index SELECT DISTINCT a,1 FROM t1 WHERE a <> 1 ORDER BY a DESC; a 1 10 1 @@ -2949,3 +2951,39 @@ explain update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 li id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range key1 key1 5 NULL 2 Using where; Using buffer drop table t1,t2; +# +# MDEV-465: Optimizer : wrong index choice, leading to strong performances issues +# +CREATE TABLE t1 ( +id1 int(10) unsigned NOT NULL auto_increment, +id2 tinyint(3) unsigned NOT NULL default '0', +id3 tinyint(3) unsigned NOT NULL default '0', +id4 int(10) unsigned NOT NULL default '0', +date timestamp NOT NULL default CURRENT_TIMESTAMP, +PRIMARY KEY (id1), +KEY id_234_date (id2,id3,id4,date), +KEY id_23_date (id2,id3,date) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +# t1 has "bad" index declaration order.. +CREATE TABLE t2 ( +id1 int(10) unsigned NOT NULL auto_increment, +id2 tinyint(3) unsigned NOT NULL default '0', +id3 tinyint(3) unsigned NOT NULL default '0', +id4 int(10) unsigned NOT NULL default '0', +date timestamp NOT NULL default CURRENT_TIMESTAMP, +PRIMARY KEY (id1), +KEY id_23_date (id2,id3,date), +KEY id_234_date (id2,id3,id4,date) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +# t2 has a "good" index declaration order +INSERT INTO t1 (id2,id3,id4) VALUES (1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,0,1),(1,2,1),(1,3,1); +INSERT INTO t2 (id2,id3,id4) VALUES (1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,0,1),(1,2,1),(1,3,1); +# The following two must both use id_23_date and no "using filesort": +EXPLAIN SELECT id1 FROM t1 WHERE id2=1 AND id3=1 ORDER BY date DESC LIMIT 0,4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range id_234_date,id_23_date id_23_date 2 NULL 3 Using where +# See above query +EXPLAIN SELECT id1 FROM t2 WHERE id2=1 AND id3=1 ORDER BY date DESC LIMIT 0,4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref id_23_date,id_234_date id_23_date 2 const,const 3 Using where +drop table t1,t2; diff --git a/mysql-test/r/order_by_innodb.result b/mysql-test/r/order_by_innodb.result index 3c6c4053741..4f59a2f8c20 100644 --- a/mysql-test/r/order_by_innodb.result +++ b/mysql-test/r/order_by_innodb.result @@ -11,3 +11,40 @@ a b c d 8 NULL 9 NULL 8 NULL 10 NULL DROP TABLE t1; +# +# MDEV-9457: Poor query plan chosen for ORDER BY query by a recent 10.1 +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 ( +pk int primary key, +key1 int, +key2 int, +col1 char(255), +key(key1), +key(key2) +) engine=innodb; +set @a=-1; +insert into t1 +select +@a:=@a+1, +@a, +@a, +repeat('abcd', 63) +from t0 A, t0 B, t0 C, t0 D; +# The following must NOT use 'index' on PK. +# It should use index_merge(key1,key2) + filesort +explain +select * +from t1 +where key1<3 or key2<3 +order by pk; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL # Using sort_union(key1,key2); Using where; Using filesort +explain +select * +from t1 +where key1<3 or key2<3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL # Using sort_union(key1,key2); Using where +drop table t0, t1; diff --git a/mysql-test/r/order_by_optimizer_innodb.result b/mysql-test/r/order_by_optimizer_innodb.result new file mode 100644 index 00000000000..f3167db4b9a --- /dev/null +++ b/mysql-test/r/order_by_optimizer_innodb.result @@ -0,0 +1,98 @@ +drop table if exists t0,t1,t2,t3; +# +# MDEV-6402: Optimizer doesn't choose best execution plan when composite key is used +# +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; +CREATE TABLE t2 ( +pk1 int(11) NOT NULL, +pk2 int(11) NOT NULL, +fd5 bigint(20) DEFAULT NULL, +filler1 char(200), +filler2 char(200), +PRIMARY KEY (pk1,pk2), +UNIQUE KEY ux_pk1_fd5 (pk1,fd5) +) ENGINE=InnoDB; +insert into t2 +select +round(log(2,t1.a+1)), +t1.a, +t1.a, +REPEAT('filler-data-', 10), +REPEAT('filler-data-', 10) +from +t1; +select pk1, count(*) from t2 group by pk1; +pk1 count(*) +0 1 +1 1 +2 3 +3 6 +4 11 +5 23 +6 45 +7 91 +8 181 +9 362 +10 276 +# The following should use range(ux_pk1_fd5), two key parts (key_len=5+8=13) +EXPLAIN SELECT * FROM t2 USE INDEX(ux_pk1_fd5) WHERE pk1=9 AND fd5 < 500 ORDER BY fd5 DESC LIMIT 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range ux_pk1_fd5 ux_pk1_fd5 13 NULL 137 Using where +# This also must use range, not ref. key_len must be 13 +EXPLAIN SELECT * FROM t2 WHERE pk1=9 AND fd5 < 500 ORDER BY fd5 DESC LIMIT 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range PRIMARY,ux_pk1_fd5 ux_pk1_fd5 13 NULL 137 Using where +drop table t0,t1, t2; +# +# MDEV-6814: Server crashes in calculate_key_len on query with ORDER BY +# +CREATE TABLE t1 (f1 INT, f2 INT, f3 INT, KEY(f2),KEY(f2,f1)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1,5,0),(2,6,0); +SELECT * FROM t1 WHERE f1 < 3 AND f2 IS NULL ORDER BY f1; +f1 f2 f3 +DROP TABLE t1; +# +# MDEV-6796: Unable to skip filesort when using implicit extended key +# +CREATE TABLE t1 ( +pk1 int(11) NOT NULL, +pk2 varchar(64) NOT NULL, +col1 varchar(16) DEFAULT NULL, +PRIMARY KEY (pk1,pk2), +KEY key1 (pk1,col1) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE t2 ( +pk1 int(11) NOT NULL, +pk2 varchar(64) NOT NULL, +col1 varchar(16) DEFAULT NULL, +PRIMARY KEY (pk1,pk2), +KEY key1 (pk1,col1,pk2) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO `t1` VALUES +(12321321,'a8f5f167f44f4964e6c998dee827110c','video'), +(12321321,'d77a17a3659ffa60c54e0ea17b6c6d16','video'), +(12321321,'wwafdsafdsafads','video'), +(12321321,'696aa249f0738e8181957dd57c2d7d0b','video-2014-09-23'), +(12321321,'802f9f29584b486f356693e3aa4ef0af','video=sdsd'), +(12321321,'2f94543ff74aab82e9a058b4e8316d75','video=sdsdsds'), +(12321321,'c1316b9df0d203fd1b9035308de52a0a','video=sdsdsdsdsd'); +insert into t2 select * from t1; +# this must not use filesort: +explain SELECT pk2 +FROM t1 USE INDEX(key1) +WHERE pk1 = 123 +AND col1 = 'video' +ORDER BY pk2 DESC LIMIT 21; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref key1 key1 55 const,const 1 Using where; Using index +# this must not use filesort, either: +explain SELECT pk2 +FROM t2 USE INDEX(key1) +WHERE pk1 = 123 AND col1 = 'video' +ORDER BY pk2 DESC LIMIT 21; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref key1 key1 55 const,const 1 Using where; Using index +drop table t1, t2; diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result index 5b0fbbcbe87..01cc9d79aaf 100644 --- a/mysql-test/r/parser.result +++ b/mysql-test/r/parser.result @@ -643,3 +643,237 @@ CREATE TRIGGER trigger1 BEFORE INSERT ON t1 FOR EACH ROW SET default_storage_engine = NEW.INNODB; ERROR 42S22: Unknown column 'INNODB' in 'NEW' DROP TABLE t1; +# +# MDEV-7792 - SQL Parsing Error - UNION AND ORDER BY WITH JOIN +# +CREATE TABLE t1(a INT); +SELECT * FROM t1 JOIN ((SELECT 1 AS b) UNION ALL (SELECT 2 AS b) ORDER BY b DESC) s1 WHERE a=1; +a b +DROP TABLE t1; +# +# Test of collective fix for three parser bugs: +# +# Bug #17727401, Bug #17426017, Bug #17473479: +# The server accepts wrong syntax and then fails in different ways +# +CREATE TABLE t1 (i INT); +# bug #17426017 +SELECT (SELECT EXISTS(SELECT * LIMIT 1 ORDER BY VALUES (c00))); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY VALUES (c00)))' at line 1 +# bug#17473479 +CREATE TABLE a(a int); +CREATE TABLE b(a int); +DELETE FROM b ORDER BY(SELECT 1 FROM a ORDER BY a ORDER BY a); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY a)' at line 1 +DROP TABLE a, b; +# bug #17727401 +SELECT '' IN (SELECT '1' c FROM t1 ORDER BY '' ORDER BY '') FROM t1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY '') FROM t1' at line 1 +# regression & coverage tests +# uniform syntax for FROM DUAL clause: +SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 +FOR UPDATE; +1 +1 +SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 +PROCEDURE ANALYSE() FOR UPDATE; +ERROR HY000: Can't use ORDER clause with this procedure +SELECT 1 FROM +(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 +FOR UPDATE) a; +1 +1 +SELECT 1 FROM +(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 +PROCEDURE ANALYSE() FOR UPDATE) a; +ERROR HY000: Incorrect usage of PROCEDURE and subquery +SELECT 1 FROM t1 +WHERE EXISTS(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 +FOR UPDATE); +1 +SELECT 1 FROM t1 +WHERE EXISTS(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 +PROCEDURE ANALYSE() FOR UPDATE); +ERROR HY000: Incorrect usage of PROCEDURE and subquery +SELECT 1 FROM t1 +UNION +SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 +FOR UPDATE; +1 +1 +SELECT 1 FROM t1 +UNION +SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 +PROCEDURE ANALYSE() FOR UPDATE; +ERROR HY000: Incorrect usage of PROCEDURE and subquery +SELECT 1 FROM DUAL PROCEDURE ANALYSE() +UNION +SELECT 1 FROM t1; +ERROR HY000: Incorrect usage of UNION and SELECT ... PROCEDURE ANALYSE() +(SELECT 1 FROM t1) +UNION +(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 +FOR UPDATE); +1 +1 +(SELECT 1 FROM t1) +UNION +(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 +PROCEDURE ANALYSE() FOR UPDATE); +ERROR HY000: Incorrect usage of PROCEDURE and subquery +# "FOR UPDATE" tests +SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1; +1 +SELECT 1 FROM t1 FOR UPDATE UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1; +1 +SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 FOR UPDATE; +1 +# "INTO" clause tests +SELECT 1 FROM t1 INTO @var17727401; +Warnings: +Warning 1329 No data - zero rows fetched, selected, or processed +SELECT 1 FROM DUAL INTO @var17727401; +SELECT 1 INTO @var17727401; +SELECT 1 INTO @var17727401 FROM t1; +Warnings: +Warning 1329 No data - zero rows fetched, selected, or processed +SELECT 1 INTO @var17727401 FROM DUAL; +SELECT 1 INTO @var17727401_1 FROM t1 INTO @var17727401_2; +ERROR HY000: Incorrect usage of INTO and INTO +SELECT 1 INTO @var17727401_1 FROM DUAL +INTO @var17727401_2; +ERROR HY000: Incorrect usage of INTO and INTO +SELECT 1 INTO @var17727401 FROM t1 WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1; +Warnings: +Warning 1329 No data - zero rows fetched, selected, or processed +SELECT 1 FROM t1 WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1 INTO @var17727401; +Warnings: +Warning 1329 No data - zero rows fetched, selected, or processed +SELECT 1 FROM t1 WHERE 1 INTO @var17727401 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1' at line 1 +SELECT 1 INTO @var17727401_1 +FROM t1 WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1 +INTO @var17727401_2; +ERROR HY000: Incorrect usage of INTO and INTO +SELECT (SELECT 1 FROM t1 INTO @var17727401); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @var17727401)' at line 1 +SELECT 1 FROM (SELECT 1 FROM t1 INTO @var17727401) a; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @var17727401) a' at line 1 +SELECT EXISTS(SELECT 1 FROM t1 INTO @var17727401); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @var17727401)' at line 1 +SELECT 1 FROM t1 INTO @var17727401 UNION SELECT 1 FROM t1 INTO t1; +ERROR HY000: Incorrect usage of UNION and INTO +(SELECT 1 FROM t1 INTO @var17727401) UNION (SELECT 1 FROM t1 INTO t1); +ERROR HY000: Incorrect usage of UNION and INTO +SELECT 1 FROM t1 UNION SELECT 1 FROM t1 INTO @var17727401; +Warnings: +Warning 1329 No data - zero rows fetched, selected, or processed +SELECT 1 INTO @var17727401 FROM t1 PROCEDURE ANALYSE(); +ERROR HY000: Incorrect usage of PROCEDURE and INTO +SELECT 1 FROM t1 PROCEDURE ANALYSE() INTO @var17727401; +ERROR HY000: Incorrect usage of PROCEDURE and INTO +# ORDER and LIMIT clause combinations +(SELECT 1 FROM t1 ORDER BY 1) ORDER BY 1; +1 +(SELECT 1 FROM t1 LIMIT 1) LIMIT 1; +1 +((SELECT 1 FROM t1 ORDER BY 1) ORDER BY 1) ORDER BY 1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY 1) ORDER BY 1' at line 1 +((SELECT 1 FROM t1 LIMIT 1) LIMIT 1) LIMIT 1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LIMIT 1) LIMIT 1' at line 1 +(SELECT 1 FROM t1 ORDER BY 1) LIMIT 1; +1 +(SELECT 1 FROM t1 LIMIT 1) ORDER BY 1; +1 +((SELECT 1 FROM t1 ORDER BY 1) LIMIT 1) ORDER BY 1); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LIMIT 1) ORDER BY 1)' at line 1 +((SELECT 1 FROM t1 LIMIT 1) ORDER BY 1) LIMIT 1); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY 1) LIMIT 1)' at line 1 +SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1; +1 +SELECT (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1); +(SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1) +NULL +SELECT 1 FROM (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1) a; +1 +SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1; +1 +SELECT (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1); +(SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1) +NULL +SELECT 1 FROM (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1) a; +1 +SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1; +1 +SELECT (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1); +(SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1) +NULL +SELECT 1 FROM (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1) a; +1 +SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1 ORDER BY 1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY 1' at line 1 +SELECT (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1 ORDER BY 1); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY 1)' at line 1 +SELECT 1 FROM (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1 ORDER BY 1) a; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY 1) a' at line 1 +SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1; +ERROR HY000: Incorrect usage of UNION and ORDER BY +SELECT (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1); +ERROR HY000: Incorrect usage of UNION and ORDER BY +SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1) a; +ERROR HY000: Incorrect usage of UNION and ORDER BY +SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1; +ERROR HY000: Incorrect usage of UNION and LIMIT +SELECT (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1); +ERROR HY000: Incorrect usage of UNION and LIMIT +SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1) a; +ERROR HY000: Incorrect usage of UNION and LIMIT +SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1; +ERROR HY000: Incorrect usage of UNION and ORDER BY +SELECT (SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1); +ERROR HY000: Incorrect usage of UNION and ORDER BY +SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1) a; +ERROR HY000: Incorrect usage of UNION and ORDER BY +SELECT 1 FROM t1 LIMIT 1 ORDER BY 1 UNION SELECT 1 FROM t1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY 1 UNION SELECT 1 FROM t1' at line 1 +SELECT (SELECT 1 FROM t1 LIMIT 1 ORDER BY 1 UNION SELECT 1 FROM t1); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY 1 UNION SELECT 1 FROM t1)' at line 1 +SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 ORDER BY 1 UNION SELECT 1 FROM t1) a; +ERROR HY000: Incorrect usage of UNION and ORDER BY +SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1; +ERROR HY000: Incorrect usage of UNION and ORDER BY +SELECT (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1); +ERROR HY000: Incorrect usage of UNION and ORDER BY +SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1) a; +ERROR HY000: Incorrect usage of UNION and ORDER BY +SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1; +ERROR HY000: Incorrect usage of UNION and LIMIT +SELECT (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1); +ERROR HY000: Incorrect usage of UNION and LIMIT +SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1) a; +ERROR HY000: Incorrect usage of UNION and LIMIT +SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1; +ERROR HY000: Incorrect usage of UNION and LIMIT +SELECT (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1); +ERROR HY000: Incorrect usage of UNION and LIMIT +SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1) a; +ERROR HY000: Incorrect usage of UNION and LIMIT +SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1; +ERROR HY000: Incorrect usage of UNION and ORDER BY +SELECT (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1); +ERROR HY000: Incorrect usage of UNION and ORDER BY +SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1) a; +ERROR HY000: Incorrect usage of UNION and ORDER BY +DROP TABLE t1; +# +# MDEV-8380: Subquery parse error +# +CREATE TABLE t1 ( a INT); +INSERT INTO t1 VALUES ( 2 ); +SELECT * +FROM ( (SELECT a FROM t1 ORDER BY a) UNION (SELECT 1 as b ORDER BY b ) ) AS a1 +WHERE a1.a = 1 OR a1.a = 2; +a +2 +1 +DROP TABLE t1; diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 233494238a5..71adc194693 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -2628,3 +2628,16 @@ alter table t1 drop partition if exists p5; Warnings: Note 1507 Error in list of partitions to DROP DROP TABLE t1; +# +# Start of 10.1 tests +# +# +# MDEV-8283 crash in get_mm_leaf with xor on binary col +# +CREATE TABLE t1(a BINARY(80)) PARTITION BY KEY(a) PARTITIONS 3; +SELECT 1 FROM t1 WHERE a XOR 'a'; +1 +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/partition_bug18198.result b/mysql-test/r/partition_bug18198.result index ee7bf514807..80f11edaaf6 100644 --- a/mysql-test/r/partition_bug18198.result +++ b/mysql-test/r/partition_bug18198.result @@ -130,7 +130,8 @@ ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitio create table t1 (col1 datetime) partition by range(week(col1)) (partition p0 values less than (10), partition p1 values less than (30)); -ERROR HY000: This partition function is not allowed +ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ') +(partition p0 values less than (10), partition p1 values less than (30))' at line 2 create table t1 (col1 varchar(25)) partition by range(cast(col1 as signed)) (partition p0 values less than (10), partition p1 values less than (30)); diff --git a/mysql-test/r/partition_cache.result b/mysql-test/r/partition_cache.result index cd579d00952..39ba4841337 100644 --- a/mysql-test/r/partition_cache.result +++ b/mysql-test/r/partition_cache.result @@ -1,3 +1,5 @@ +SET global query_cache_type=ON; +SET local query_cache_type=ON; SET SESSION STORAGE_ENGINE = InnoDB; drop table if exists t1,t2,t3; set @save_query_cache_size = @@global.query_cache_size; @@ -203,3 +205,4 @@ Variable_name Value Qcache_hits 1 set @@global.query_cache_size = @save_query_cache_size; drop table t2; +SET global query_cache_type=default; diff --git a/mysql-test/r/partition_cache_innodb.result b/mysql-test/r/partition_cache_innodb.result index 0d0abbb096c..271b23eed92 100644 --- a/mysql-test/r/partition_cache_innodb.result +++ b/mysql-test/r/partition_cache_innodb.result @@ -1,3 +1,5 @@ +SET global query_cache_type=ON; +SET local query_cache_type=ON; SET SESSION STORAGE_ENGINE = innodb; drop table if exists t1; set @save_query_cache_size = @@global.query_cache_size; @@ -149,3 +151,4 @@ Variable_name Value Qcache_hits 1 drop table t1; set @@global.query_cache_size = @save_query_cache_size; +SET global query_cache_type=default; diff --git a/mysql-test/r/partition_cache_myisam.result b/mysql-test/r/partition_cache_myisam.result index 0b617c03590..b7d3dc53599 100644 --- a/mysql-test/r/partition_cache_myisam.result +++ b/mysql-test/r/partition_cache_myisam.result @@ -1,3 +1,5 @@ +SET global query_cache_type=ON; +SET local query_cache_type=ON; SET SESSION STORAGE_ENGINE = myisam; drop table if exists t1; set @save_query_cache_size = @@global.query_cache_size; @@ -151,3 +153,4 @@ Variable_name Value Qcache_hits 2 drop table t1; set @@global.query_cache_size = @save_query_cache_size; +SET global query_cache_type=default; diff --git a/mysql-test/r/partition_datatype.result b/mysql-test/r/partition_datatype.result index 804d9dd1c34..fa58df3dec3 100644 --- a/mysql-test/r/partition_datatype.result +++ b/mysql-test/r/partition_datatype.result @@ -326,7 +326,7 @@ partition by hash (a) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bit(27) NOT NULL DEFAULT b'0', + `a` bit(27) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (a) @@ -699,7 +699,7 @@ a tz 2038-01-19 03:14:06 Moscow UPDATE t2 SET a = TIMESTAMPADD(SECOND, 1, a); Warnings: -Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' Warning 1264 Out of range value for column 'a' at row 34 Warning 1264 Out of range value for column 'a' at row 35 SELECT MIN(a), MAX(a) FROM t2; @@ -782,9 +782,9 @@ a tz 2011-10-30 00:00:02 Moscow UPDATE t2 SET a = TIMESTAMPADD(SECOND, -1, a); Warnings: -Warning 1292 Incorrect datetime value: '0000-00-00' -Warning 1292 Incorrect datetime value: '0000-00-00' -Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' +Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' +Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' SELECT MIN(a), MAX(a) FROM t2; MIN(a) MAX(a) 1970-01-01 00:00:01 2038-01-19 03:14:06 @@ -1179,7 +1179,7 @@ a tz 2038-01-19 06:14:06 Moscow UPDATE t2 SET a = TIMESTAMPADD(SECOND, 1, a); Warnings: -Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' Warning 1299 Invalid TIMESTAMP value in column 'a' at row 8 Warning 1299 Invalid TIMESTAMP value in column 'a' at row 9 Warning 1264 Out of range value for column 'a' at row 34 @@ -1264,9 +1264,9 @@ a tz 2011-10-30 03:00:02 Moscow UPDATE t2 SET a = TIMESTAMPADD(SECOND, -1, a); Warnings: -Warning 1292 Incorrect datetime value: '0000-00-00' -Warning 1292 Incorrect datetime value: '0000-00-00' -Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' +Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' +Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' Warning 1299 Invalid TIMESTAMP value in column 'a' at row 18 Warning 1299 Invalid TIMESTAMP value in column 'a' at row 19 SELECT MIN(a), MAX(a) FROM t2; diff --git a/mysql-test/r/partition_example.result b/mysql-test/r/partition_example.result index 7b6e9aa5213..2129eea0818 100644 --- a/mysql-test/r/partition_example.result +++ b/mysql-test/r/partition_example.result @@ -7,7 +7,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `VAROPT`='5' +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (1) ENGINE = EXAMPLE, PARTITION p1 VALUES IN (2) ENGINE = EXAMPLE) */ @@ -20,7 +20,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12340 `VAROPT`='5' +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12340 /*!50100 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (1) ENGINE = EXAMPLE, PARTITION p1 VALUES IN (2) ENGINE = EXAMPLE) */ diff --git a/mysql-test/r/partition_exchange.result b/mysql-test/r/partition_exchange.result index fec08e99c72..0f6ac2cf480 100644 --- a/mysql-test/r/partition_exchange.result +++ b/mysql-test/r/partition_exchange.result @@ -485,14 +485,14 @@ INSERT INTO tsp VALUES (2, "First value"), (10, "Ten"), (50, "Fifty"), (200, "Tw SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -523,14 +523,14 @@ ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -583,14 +583,14 @@ ERROR HY000: Found a row that does not match the partition SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -639,14 +639,14 @@ ERROR HY000: Table to exchange with partition is partitioned: 'tp' SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -656,7 +656,7 @@ tp CREATE TABLE `tp` ( SHOW CREATE TABLE tsp; Table Create Table tsp CREATE TABLE `tsp` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -693,14 +693,14 @@ ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -731,14 +731,14 @@ ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -770,14 +770,14 @@ ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t; SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE tsp; Table Create Table tsp CREATE TABLE `tsp` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -815,14 +815,14 @@ ALTER TABLE tp ENGINE = InnoDB; SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -853,14 +853,14 @@ ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -894,14 +894,14 @@ ALTER TABLE tp ENGINE = InnoDB; SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -913,14 +913,14 @@ ERROR HY000: The mix of handlers in the partitions is not allowed in this versio SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -946,14 +946,14 @@ INSERT INTO t SELECT * FROM tmp2; SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=1000 MAX_ROWS=100000 SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -975,7 +975,7 @@ ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t; SHOW CREATE TABLE t; Table Create Table t CREATE TABLE `t` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`), KEY `ba_key` (`b`,`a`) @@ -983,7 +983,7 @@ t CREATE TABLE `t` ( SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`), KEY `ba_key` (`b`,`a`) @@ -1034,7 +1034,7 @@ ALTER TABLE tmp RENAME TO t; SHOW CREATE TABLE t; Table Create Table t CREATE TEMPORARY TABLE `t` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`), KEY `ba_key` (`b`,`a`) @@ -1042,7 +1042,7 @@ t CREATE TEMPORARY TABLE `t` ( SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`), KEY `ba_key` (`b`,`a`) @@ -1055,7 +1055,7 @@ ERROR HY000: Table to exchange with partition is temporary: 't' SHOW CREATE TABLE t; Table Create Table t CREATE TEMPORARY TABLE `t` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`), KEY `ba_key` (`b`,`a`) @@ -1063,7 +1063,7 @@ t CREATE TEMPORARY TABLE `t` ( SHOW CREATE TABLE tp; Table Create Table tp CREATE TABLE `tp` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` varchar(55) DEFAULT NULL, PRIMARY KEY (`a`), KEY `ba_key` (`b`,`a`) diff --git a/mysql-test/r/partition_grant.result b/mysql-test/r/partition_grant.result index c334a473a2a..f036b0bcc28 100644 --- a/mysql-test/r/partition_grant.result +++ b/mysql-test/r/partition_grant.result @@ -3,6 +3,7 @@ create schema mysqltest_1; use mysqltest_1; create table t1 (a int) partition by list (a) (partition p1 values in (1), partition p2 values in (2), partition p3 values in (3)); insert into t1 values (1),(2); +create user mysqltest_1@localhost; grant usage on *.* to mysqltest_1@localhost; revoke all privileges on *.* from mysqltest_1@localhost; grant select,alter on mysqltest_1.* to mysqltest_1@localhost; diff --git a/mysql-test/r/partition_hash.result b/mysql-test/r/partition_hash.result index 90126bdd4fd..9a63db3f974 100644 --- a/mysql-test/r/partition_hash.result +++ b/mysql-test/r/partition_hash.result @@ -166,9 +166,11 @@ select * from t1; f1 f2 -1 ####### drop table t1; +set sql_mode=""; CREATE TABLE t1 (s1 int) ENGINE=BLACKHOLE PARTITION BY HASH (s1); INSERT INTO t1 VALUES (0); DROP TABLE t1; +set sql_mode=default; create table t1 (c1 int DEFAULT NULL, c2 varchar (30) DEFAULT NULL, c3 date DEFAULT NULL) diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result index f1c3795791a..bfe9dc96bc2 100644 --- a/mysql-test/r/partition_innodb.result +++ b/mysql-test/r/partition_innodb.result @@ -429,6 +429,7 @@ where a between '2006-01-01' and '2007-06-01'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where drop table t1; +SET SQL_MODE=""; create table t1 (a int) engine = x partition by key (a); @@ -457,6 +458,7 @@ t1 CREATE TABLE `t1` ( /*!50100 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0) ENGINE = InnoDB) */ drop table t1; +SET SQL_MODE=default; create table t1 ( id int unsigned auto_increment, diff --git a/mysql-test/r/partition_innodb_plugin.result b/mysql-test/r/partition_innodb_plugin.result index 7057bb0a55b..63c9da69955 100644 --- a/mysql-test/r/partition_innodb_plugin.result +++ b/mysql-test/r/partition_innodb_plugin.result @@ -24,7 +24,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, - `time` date NOT NULL DEFAULT '0000-00-00', + `time` date NOT NULL, `id2` bigint(20) NOT NULL, PRIMARY KEY (`id`,`time`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 diff --git a/mysql-test/r/partition_not_blackhole.result b/mysql-test/r/partition_not_blackhole.result index 7759f947c32..ff1e51df892 100644 --- a/mysql-test/r/partition_not_blackhole.result +++ b/mysql-test/r/partition_not_blackhole.result @@ -9,7 +9,7 @@ SHOW TABLES; Tables_in_test t1 SHOW CREATE TABLE t1; -ERROR HY000: Incorrect information in file: './test/t1.frm' +ERROR HY000: Failed to read from the .par file DROP TABLE t1; ERROR HY000: Got error 1 "Operation not permitted" from storage engine partition t1.frm diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index 65b788a7d1b..fe19473f8e4 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -1636,139 +1636,139 @@ INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'), (1, '2009-04-05'), (1, '2009-04-06'), (1, '2009-04-07'); EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 6 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 8 Using where; Using index +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 9 NULL 8 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 12 NULL 2 Using where; Using index +1 SIMPLE t1 p20090403 index NULL PRIMARY 9 NULL 2 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 6 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 6 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090402 index NULL PRIMARY 12 NULL 3 Using where; Using index +1 SIMPLE t1 p20090402 index NULL PRIMARY 9 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 13 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 6 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 8 Using where; Using index +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 9 NULL 8 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 12 NULL 2 Using where; Using index +1 SIMPLE t1 p20090403 index NULL PRIMARY 9 NULL 2 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 6 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 8 Using where; Using index +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 9 NULL 8 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 12 NULL 2 Using where; Using index +1 SIMPLE t1 p20090403 index NULL PRIMARY 9 NULL 2 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 6 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 6 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090402 index NULL PRIMARY 12 NULL 3 Using where; Using index +1 SIMPLE t1 p20090402 index NULL PRIMARY 9 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 13 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 6 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 8 Using where; Using index +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 9 NULL 8 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 12 NULL 2 Using where; Using index +1 SIMPLE t1 p20090403 index NULL PRIMARY 9 NULL 2 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03'; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 8 Using where; Using index +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 9 NULL 8 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 12 NULL 8 Using where; Using index +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 9 NULL 8 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 12 NULL 2 Using where; Using index +1 SIMPLE t1 p20090403 index NULL PRIMARY 9 NULL 2 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 10 Using where; Using index +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 6 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 12 NULL 6 Using where; Using index +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090402 index NULL PRIMARY 12 NULL 3 Using where; Using index +1 SIMPLE t1 p20090402 index NULL PRIMARY 9 NULL 3 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 13 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME); id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 12 NULL 13 Using where; Using index +1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 13 Using where; Using index DROP TABLE t1; # Test with DATE column NOT NULL CREATE TABLE t1 ( @@ -3138,7 +3138,6 @@ explain partitions select 1 from t1 union all select 2; id select_type table partitions type possible_keys key key_len ref rows Extra 1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 const row not found 2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL drop table t1; create table t1 (a bigint unsigned not null) partition by range(a) ( partition p0 values less than (10), diff --git a/mysql-test/r/perror.result b/mysql-test/r/perror.result index 30a56840b1b..432a4fd4c04 100644 --- a/mysql-test/r/perror.result +++ b/mysql-test/r/perror.result @@ -2,5 +2,5 @@ Illegal error code: 10000 MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d MySQL error code 1408 (ER_STARTUP): %s: ready for connections. Version: '%s' socket: '%s' port: %d %s -MySQL error code 1459 (ER_TABLE_NEEDS_UPGRADE): Table upgrade required. Please do "REPAIR TABLE `%-.32s`" or dump/reload to fix it! +MySQL error code 1459 (ER_TABLE_NEEDS_UPGRADE): Upgrade required. Please do "REPAIR %s %`s" or dump/reload to fix it! MySQL error code 1461 (ER_MAX_PREPARED_STMT_COUNT_REACHED): Can't create more than max_prepared_stmt_count statements (current value: %lu) diff --git a/mysql-test/r/plugin.result b/mysql-test/r/plugin.result index ce382e35bd1..c23c4f2d8a2 100644 --- a/mysql-test/r/plugin.result +++ b/mysql-test/r/plugin.result @@ -1,8 +1,5 @@ CREATE TABLE t1(a int) ENGINE=EXAMPLE; -Warnings: -Warning 1286 Unknown storage engine 'EXAMPLE' -Warning 1266 Using storage engine MyISAM for table 't1' -DROP TABLE t1; +ERROR 42000: Unknown storage engine 'EXAMPLE' INSTALL PLUGIN example SONAME 'ha_example'; INSTALL PLUGIN EXAMPLE SONAME 'ha_example'; ERROR HY000: Plugin 'EXAMPLE' already installed @@ -15,7 +12,7 @@ PLUGIN_STATUS ACTIVE PLUGIN_TYPE STORAGE ENGINE PLUGIN_TYPE_VERSION # PLUGIN_LIBRARY ha_example.so -PLUGIN_LIBRARY_VERSION 1.8 +PLUGIN_LIBRARY_VERSION 1.11 PLUGIN_AUTHOR Brian Aker, MySQL AB PLUGIN_DESCRIPTION Example storage engine PLUGIN_LICENSE GPL @@ -28,7 +25,7 @@ PLUGIN_STATUS ACTIVE PLUGIN_TYPE DAEMON PLUGIN_TYPE_VERSION # PLUGIN_LIBRARY ha_example.so -PLUGIN_LIBRARY_VERSION 1.8 +PLUGIN_LIBRARY_VERSION 1.11 PLUGIN_AUTHOR Sergei Golubchik PLUGIN_DESCRIPTION Unusable Daemon PLUGIN_LICENSE GPL @@ -67,7 +64,7 @@ PLUGIN_STATUS DELETED PLUGIN_TYPE STORAGE ENGINE PLUGIN_TYPE_VERSION # PLUGIN_LIBRARY ha_example.so -PLUGIN_LIBRARY_VERSION 1.8 +PLUGIN_LIBRARY_VERSION 1.11 PLUGIN_AUTHOR Brian Aker, MySQL AB PLUGIN_DESCRIPTION Example storage engine PLUGIN_LICENSE GPL @@ -127,7 +124,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL `complex`='c,f,f,f' -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ULL`=10000 `STR`='dskj' `one_or_two`='one' `YESNO`=0 `VAROPT`='5' +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ULL`=10000 `STR`='dskj' `one_or_two`='one' `YESNO`=0 drop table t1; SET @OLD_SQL_MODE=@@SQL_MODE; SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS'; @@ -142,7 +139,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ULL`=10000000000000000000 `one_or_two`='ttt' `YESNO`=SSS `VAROPT`='5' +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ULL`=10000000000000000000 `one_or_two`='ttt' `YESNO`=SSS #alter table alter table t1 ULL=10000000; Warnings: @@ -152,7 +149,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `one_or_two`='ttt' `YESNO`=SSS `VAROPT`='5' `ULL`=10000000 +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `one_or_two`='ttt' `YESNO`=SSS `ULL`=10000000 alter table t1 change a a int complex='c,c,c'; Warnings: Note 1105 EXAMPLE DEBUG: Field `a` COMPLEX '(null)' -> 'c,c,c' @@ -161,14 +158,14 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL `complex`='c,c,c', `b` int(11) DEFAULT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `one_or_two`='ttt' `YESNO`=SSS `VAROPT`='5' `ULL`=10000000 +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `one_or_two`='ttt' `YESNO`=SSS `ULL`=10000000 alter table t1 one_or_two=two; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL `complex`='c,c,c', `b` int(11) DEFAULT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `YESNO`=SSS `VAROPT`='5' `ULL`=10000000 `one_or_two`=two +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `YESNO`=SSS `ULL`=10000000 `one_or_two`=two drop table t1; #illegal value error SET SQL_MODE=''; @@ -183,11 +180,11 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ULL`=4660 `VAROPT`='5' +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ULL`=4660 SET example_varopt_default=33; select create_options from information_schema.tables where table_schema='test' and table_name='t1'; create_options -`ULL`=4660 `VAROPT`='5' +`ULL`=4660 ALTER TABLE t1 ULL=DEFAULT; Warnings: Note 1105 EXAMPLE DEBUG: ULL 4660 -> 4294967295 @@ -195,14 +192,14 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `VAROPT`='5' +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 DROP TABLE t1; create table t1 (a int) engine=example; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `VAROPT`='33' +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `VAROPT`=33 drop table t1; create table t1 (a int) engine=example varopt=15; show create table t1; @@ -215,7 +212,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `VAROPT`='33' +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `VAROPT`=33 drop table t1; SET @@SQL_MODE=@OLD_SQL_MODE; select 1; diff --git a/mysql-test/r/plugin_auth.result b/mysql-test/r/plugin_auth.result index 0d3948dd313..626722f9dd1 100644 --- a/mysql-test/r/plugin_auth.result +++ b/mysql-test/r/plugin_auth.result @@ -1,3 +1,5 @@ +SET GLOBAL SQL_MODE=""; +SET LOCAL SQL_MODE=""; SELECT PLUGIN_STATUS, PLUGIN_TYPE, PLUGIN_DESCRIPTION FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME='test_plugin_server'; PLUGIN_STATUS ACTIVE @@ -44,7 +46,7 @@ plug@localhost plug_dest@% ## test no_auto_create_user sql mode with plugin users SET @@sql_mode=no_auto_create_user; GRANT INSERT ON TEST.* TO grant_user IDENTIFIED WITH 'test_plugin_server'; -SET @@sql_mode=default; +SET @@sql_mode=""; DROP USER grant_user; ## test utf-8 user name CREATE USER `Ÿ` IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; @@ -426,4 +428,5 @@ USER() CURRENT_USER() bug12818542@localhost bug12818542_dest@localhost DROP USER bug12818542@localhost; DROP USER bug12818542_dest@localhost; +SET GLOBAL SQL_MODE=default; End of 5.5 tests diff --git a/mysql-test/r/plugin_auth_qa.result b/mysql-test/r/plugin_auth_qa.result index b86a01f6b52..4f274c45971 100644 --- a/mysql-test/r/plugin_auth_qa.result +++ b/mysql-test/r/plugin_auth_qa.result @@ -1,3 +1,4 @@ +set sql_mode=""; CREATE DATABASE test_user_db; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; user plugin authentication_string diff --git a/mysql-test/r/plugin_loaderr.result b/mysql-test/r/plugin_loaderr.result index d1189217355..fbb144a7b90 100644 --- a/mysql-test/r/plugin_loaderr.result +++ b/mysql-test/r/plugin_loaderr.result @@ -3,7 +3,7 @@ SELECT PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE,PLUGIN_LIBRARY,PLUGIN_LIBRARY_VERSION,LOAD_OPTION FROM INFORMATION_SCHEMA.PLUGINS WHERE plugin_name = 'innodb'; PLUGIN_NAME InnoDB -PLUGIN_STATUS DISABLED +PLUGIN_STATUS INACTIVE PLUGIN_TYPE STORAGE ENGINE PLUGIN_LIBRARY NULL PLUGIN_LIBRARY_VERSION NULL diff --git a/mysql-test/r/plugin_not_embedded.result b/mysql-test/r/plugin_not_embedded.result index 27553366660..8106abc497f 100644 --- a/mysql-test/r/plugin_not_embedded.result +++ b/mysql-test/r/plugin_not_embedded.result @@ -1,6 +1,7 @@ # # Bug#51770: UNINSTALL PLUGIN requires no privileges # +CREATE USER bug51770@localhost; GRANT INSERT ON mysql.plugin TO bug51770@localhost; INSTALL PLUGIN example SONAME 'ha_example.so'; UNINSTALL PLUGIN example; diff --git a/mysql-test/r/processlist.result b/mysql-test/r/processlist.result index eb3af67c5bf..ebec6175a5b 100644 --- a/mysql-test/r/processlist.result +++ b/mysql-test/r/processlist.result @@ -17,3 +17,21 @@ select command, time < 5 from information_schema.processlist where id != connect command time < 5 Sleep 1 set debug_sync='reset'; +# +# 10.1 tests +# +# +# MDEV-7807 information_schema.processlist truncates queries with binary strings +# +SET NAMES utf8; +SELECT INFO, INFO_BINARY, 'xxx😎yyy' AS utf8mb4_string FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%xxx%yyy%'; +INFO SELECT INFO, INFO_BINARY, 'xxx????yyy' AS utf8mb4_string FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%xxx%yyy%' +INFO_BINARY SELECT INFO, INFO_BINARY, 'xxx😎yyy' AS utf8mb4_string FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%xxx%yyy%' +utf8mb4_string xxx😎yyy +Warnings: +Level Warning +Code 1366 +Message Incorrect string value: '\xF0\x9F\x98\x8Eyy...' for column 'INFO' at row 1 +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 8d073f8da1e..e8a7eb133fb 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -1,5 +1,6 @@ call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.'); drop table if exists t1,t2,t3,t4; +drop database if exists mysqltest1; drop database if exists client_test_db; create table t1 ( @@ -1105,7 +1106,7 @@ t1 CREATE TABLE `t1` ( show create table mysqltest.t2; Table Create Table t2 CREATE TABLE `t2` ( - `test` varchar(4) CHARACTER SET latin1 NOT NULL DEFAULT '' + `test` varchar(4) CHARACTER SET latin1 NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 drop table mysqltest.t1; drop table mysqltest.t2; @@ -1120,7 +1121,7 @@ t1 CREATE TABLE `t1` ( show create table mysqltest.t2; Table Create Table t2 CREATE TABLE `t2` ( - `test` varchar(4) NOT NULL DEFAULT '' + `test` varchar(4) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop database mysqltest; deallocate prepare stmt1; @@ -1201,13 +1202,13 @@ SET @aux= "SELECT COUNT(*) prepare my_stmt from @aux; execute my_stmt; COUNT(*) -44 +46 execute my_stmt; COUNT(*) -44 +46 execute my_stmt; COUNT(*) -44 +46 deallocate prepare my_stmt; drop procedure if exists p1| drop table if exists t1| @@ -2118,9 +2119,9 @@ select Host, Db from mysql.host limit 0; Host Db show open tables from mysql; Database Table In_use Name_locked -mysql user 0 0 mysql general_log 0 0 mysql host 0 0 +mysql user 0 0 call proc_1(); show open tables from mysql; Database Table In_use Name_locked @@ -2131,9 +2132,9 @@ select Host, Db from mysql.host limit 0; Host Db show open tables from mysql; Database Table In_use Name_locked -mysql user 0 0 mysql general_log 0 0 mysql host 0 0 +mysql user 0 0 call proc_1(); show open tables from mysql; Database Table In_use Name_locked @@ -2144,9 +2145,9 @@ select Host, Db from mysql.host limit 0; Host Db show open tables from mysql; Database Table In_use Name_locked -mysql user 0 0 mysql general_log 0 0 mysql host 0 0 +mysql user 0 0 call proc_1(); show open tables from mysql; Database Table In_use Name_locked @@ -2157,9 +2158,9 @@ select Host, Db from mysql.host limit 0; Host Db show open tables from mysql; Database Table In_use Name_locked -mysql user 0 0 mysql general_log 0 0 mysql host 0 0 +mysql user 0 0 flush tables; create function func_1() returns int begin flush tables; return 1; end| ERROR 0A000: FLUSH is not allowed in stored function or trigger @@ -2175,9 +2176,9 @@ select Host, Db from mysql.host limit 0; Host Db show open tables from mysql; Database Table In_use Name_locked -mysql user 0 0 mysql general_log 0 0 mysql host 0 0 +mysql user 0 0 prepare abc from "flush tables"; execute abc; show open tables from mysql; @@ -2189,9 +2190,9 @@ select Host, Db from mysql.host limit 0; Host Db show open tables from mysql; Database Table In_use Name_locked -mysql user 0 0 mysql general_log 0 0 mysql host 0 0 +mysql user 0 0 execute abc; show open tables from mysql; Database Table In_use Name_locked @@ -2202,9 +2203,9 @@ select Host, Db from mysql.host limit 0; Host Db show open tables from mysql; Database Table In_use Name_locked -mysql user 0 0 mysql general_log 0 0 mysql host 0 0 +mysql user 0 0 execute abc; show open tables from mysql; Database Table In_use Name_locked @@ -2215,9 +2216,9 @@ select Host, Db from mysql.host limit 0; Host Db show open tables from mysql; Database Table In_use Name_locked -mysql user 0 0 mysql general_log 0 0 mysql host 0 0 +mysql user 0 0 flush tables; deallocate prepare abc; create procedure proc_1() flush logs; @@ -2389,15 +2390,15 @@ create procedure a() select 42; create procedure proc_1(a char(2)) show create procedure a; call proc_1("bb"); Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() +a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() select 42 latin1 latin1_swedish_ci latin1_swedish_ci call proc_1("bb"); Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() +a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() select 42 latin1 latin1_swedish_ci latin1_swedish_ci call proc_1("bb"); Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() +a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() select 42 latin1 latin1_swedish_ci latin1_swedish_ci drop procedure proc_1; create function func_1() returns int begin show create procedure a; return 1; end| @@ -2409,15 +2410,15 @@ ERROR 42000: FUNCTION test.func_1 does not exist prepare abc from "show create procedure a"; execute abc; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() +a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() select 42 latin1 latin1_swedish_ci latin1_swedish_ci execute abc; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() +a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() select 42 latin1 latin1_swedish_ci latin1_swedish_ci execute abc; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() +a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() select 42 latin1 latin1_swedish_ci latin1_swedish_ci deallocate prepare abc; drop procedure a; @@ -2426,15 +2427,15 @@ create function a() returns int return 42+13; create procedure proc_1(a char(2)) show create function a; call proc_1("bb"); Function sql_mode Create Function character_set_client collation_connection Database Collation -a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) +a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci call proc_1("bb"); Function sql_mode Create Function character_set_client collation_connection Database Collation -a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) +a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci call proc_1("bb"); Function sql_mode Create Function character_set_client collation_connection Database Collation -a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) +a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci drop procedure proc_1; create function func_1() returns int begin show create function a; return 1; end| @@ -2446,15 +2447,15 @@ ERROR 42000: FUNCTION test.func_1 does not exist prepare abc from "show create function a"; execute abc; Function sql_mode Create Function character_set_client collation_connection Database Collation -a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) +a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci execute abc; Function sql_mode Create Function character_set_client collation_connection Database Collation -a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) +a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci execute abc; Function sql_mode Create Function character_set_client collation_connection Database Collation -a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) +a NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci deallocate prepare abc; drop function a; @@ -2464,22 +2465,22 @@ create procedure proc_1() show create table tab1; call proc_1(); Table Create Table tab1 CREATE TABLE `tab1` ( - `a` int(11) NOT NULL DEFAULT '0', - `b` char(1) NOT NULL DEFAULT '', + `a` int(11) NOT NULL, + `b` char(1) NOT NULL, PRIMARY KEY (`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 call proc_1(); Table Create Table tab1 CREATE TABLE `tab1` ( - `a` int(11) NOT NULL DEFAULT '0', - `b` char(1) NOT NULL DEFAULT '', + `a` int(11) NOT NULL, + `b` char(1) NOT NULL, PRIMARY KEY (`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 call proc_1(); Table Create Table tab1 CREATE TABLE `tab1` ( - `a` int(11) NOT NULL DEFAULT '0', - `b` char(1) NOT NULL DEFAULT '', + `a` int(11) NOT NULL, + `b` char(1) NOT NULL, PRIMARY KEY (`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop procedure proc_1; @@ -2493,22 +2494,22 @@ prepare abc from "show create table tab1"; execute abc; Table Create Table tab1 CREATE TABLE `tab1` ( - `a` int(11) NOT NULL DEFAULT '0', - `b` char(1) NOT NULL DEFAULT '', + `a` int(11) NOT NULL, + `b` char(1) NOT NULL, PRIMARY KEY (`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 execute abc; Table Create Table tab1 CREATE TABLE `tab1` ( - `a` int(11) NOT NULL DEFAULT '0', - `b` char(1) NOT NULL DEFAULT '', + `a` int(11) NOT NULL, + `b` char(1) NOT NULL, PRIMARY KEY (`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 execute abc; Table Create Table tab1 CREATE TABLE `tab1` ( - `a` int(11) NOT NULL DEFAULT '0', - `b` char(1) NOT NULL DEFAULT '', + `a` int(11) NOT NULL, + `b` char(1) NOT NULL, PRIMARY KEY (`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 deallocate prepare abc; diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result index 9981156bc5f..326d37ee560 100644 --- a/mysql-test/r/ps_1general.result +++ b/mysql-test/r/ps_1general.result @@ -17,7 +17,8 @@ create table t9 c1 tinyint, c2 smallint, c3 mediumint, c4 int, c5 integer, c6 bigint, c7 float, c8 double, c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), -c13 date, c14 datetime, c15 timestamp, c16 time, +c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP +ON UPDATE CURRENT_TIMESTAMP, c16 time, c17 year, c18 tinyint, c19 bool, c20 char, c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, c25 blob, c26 text, c27 mediumblob, c28 mediumtext, @@ -300,7 +301,7 @@ t2 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # # latin1_swedish_ci NULL prepare stmt4 from ' show table status from test like ''t9%'' '; execute stmt4; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t9 MyISAM 10 Dynamic 2 216 432 # 2048 0 NULL # # # latin1_swedish_ci NULL +t9 MyISAM 10 Dynamic 2 212 424 # 2048 0 NULL # # # latin1_swedish_ci NULL prepare stmt4 from ' show status like ''Threads_running'' '; execute stmt4; Variable_name Value @@ -308,7 +309,7 @@ Threads_running # prepare stmt4 from ' show variables like ''sql_mode'' '; execute stmt4; Variable_name Value -sql_mode +sql_mode NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION prepare stmt4 from ' show engine myisam logs '; execute stmt4; Type Name Status @@ -446,9 +447,9 @@ def id 8 3 1 Y 32928 0 63 def select_type 253 19 6 N 1 31 8 def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 -def possible_keys 253 4096 0 Y 0 31 8 +def possible_keys 253 4_OR_8_K 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 0 31 8 +def key_len 253 4_OR_8_K 0 Y 0 31 8 def ref 253 2048 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 14 N 1 31 8 @@ -462,9 +463,9 @@ def id 8 3 1 Y 32928 0 63 def select_type 253 19 6 N 1 31 8 def table 253 64 2 Y 0 31 8 def type 253 10 5 Y 0 31 8 -def possible_keys 253 4096 7 Y 0 31 8 +def possible_keys 253 4_OR_8_K 7 Y 0 31 8 def key 253 64 7 Y 0 31 8 -def key_len 253 4096 1 Y 0 31 8 +def key_len 253 4_OR_8_K 1 Y 0 31 8 def ref 253 2048 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 37 N 1 31 8 diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index 6ca76191db5..6d7544deb4e 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -10,7 +10,8 @@ create table t9 c1 tinyint, c2 smallint, c3 mediumint, c4 int, c5 integer, c6 bigint, c7 float, c8 double, c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), -c13 date, c14 datetime, c15 timestamp, c16 time, +c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP +ON UPDATE CURRENT_TIMESTAMP, c16 time, c17 year, c18 tinyint, c19 bool, c20 char, c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, c25 blob, c26 text, c27 mediumblob, c28 mediumtext, @@ -49,7 +50,7 @@ test_sequence prepare stmt1 from ' select * from t9 order by c1 ' ; execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t9 t9 c1 c1 1 4 1 N 49155 0 63 +def test t9 t9 c1 c1 1 4 1 N 53251 0 63 def test t9 t9 c2 c2 2 6 1 Y 32768 0 63 def test t9 t9 c3 c3 9 9 1 Y 32768 0 63 def test t9 t9 c4 c4 3 11 1 Y 32768 0 63 @@ -1156,9 +1157,9 @@ def id 8 3 1 Y 32928 0 63 def select_type 253 19 6 N 1 31 8 def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 -def possible_keys 253 4096 0 Y 0 31 8 +def possible_keys 253 4_OR_8_K 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 0 31 8 +def key_len 253 4_OR_8_K 0 Y 0 31 8 def ref 253 2048 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 @@ -1775,21 +1776,21 @@ NULL as const12, @arg12 as param12, show create table t5 ; Table Create Table t5 CREATE TABLE `t5` ( - `const01` int(1) NOT NULL DEFAULT '0', + `const01` int(1) NOT NULL, `param01` bigint(20) DEFAULT NULL, - `const02` decimal(2,1) NOT NULL DEFAULT '0.0', + `const02` decimal(2,1) NOT NULL, `param02` decimal(65,30) DEFAULT NULL, - `const03` double NOT NULL DEFAULT '0', + `const03` double NOT NULL, `param03` double DEFAULT NULL, - `const04` varchar(3) NOT NULL DEFAULT '', + `const04` varchar(3) NOT NULL, `param04` longtext, - `const05` varbinary(3) NOT NULL DEFAULT '', + `const05` varbinary(3) NOT NULL, `param05` longblob, - `const06` varchar(10) NOT NULL DEFAULT '', + `const06` varchar(10) NOT NULL, `param06` longtext, `const07` date DEFAULT NULL, `param07` longtext, - `const08` varchar(19) NOT NULL DEFAULT '', + `const08` varchar(19) NOT NULL, `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longtext, @@ -1805,21 +1806,21 @@ t5 CREATE TABLE `t5` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t5 ; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t5 t5 const01 const01 3 1 1 N 32769 0 63 +def test t5 t5 const01 const01 3 1 1 N 36865 0 63 def test t5 t5 param01 param01 8 20 1 Y 32768 0 63 -def test t5 t5 const02 const02 246 4 3 N 32769 1 63 +def test t5 t5 const02 const02 246 4 3 N 36865 1 63 def test t5 t5 param02 param02 246 67 32 Y 32768 30 63 -def test t5 t5 const03 const03 5 17 1 N 32769 31 63 +def test t5 t5 const03 const03 5 17 1 N 36865 31 63 def test t5 t5 param03 param03 5 23 1 Y 32768 31 63 -def test t5 t5 const04 const04 253 3 3 N 1 0 8 +def test t5 t5 const04 const04 253 3 3 N 4097 0 8 def test t5 t5 param04 param04 252 4294967295 3 Y 16 0 8 -def test t5 t5 const05 const05 253 3 3 N 129 0 63 +def test t5 t5 const05 const05 253 3 3 N 4225 0 63 def test t5 t5 param05 param05 252 4294967295 3 Y 144 0 63 -def test t5 t5 const06 const06 253 10 10 N 1 0 8 +def test t5 t5 const06 const06 253 10 10 N 4097 0 8 def test t5 t5 param06 param06 252 4294967295 10 Y 16 0 8 def test t5 t5 const07 const07 10 10 10 Y 128 0 63 def test t5 t5 param07 param07 252 4294967295 10 Y 16 0 8 -def test t5 t5 const08 const08 253 19 19 N 1 0 8 +def test t5 t5 const08 const08 253 19 19 N 4097 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8 diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index 47237790ae5..a22135d30c0 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -10,7 +10,8 @@ create table t9 c1 tinyint, c2 smallint, c3 mediumint, c4 int, c5 integer, c6 bigint, c7 float, c8 double, c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), -c13 date, c14 datetime, c15 timestamp, c16 time, +c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP +ON UPDATE CURRENT_TIMESTAMP, c16 time, c17 year, c18 tinyint, c19 bool, c20 char, c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, c25 blob, c26 text, c27 mediumblob, c28 mediumtext, @@ -49,7 +50,7 @@ test_sequence prepare stmt1 from ' select * from t9 order by c1 ' ; execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t9 t9 c1 c1 1 4 1 N 49155 0 63 +def test t9 t9 c1 c1 1 4 1 N 53251 0 63 def test t9 t9 c2 c2 2 6 1 Y 32768 0 63 def test t9 t9 c3 c3 9 9 1 Y 32768 0 63 def test t9 t9 c4 c4 3 11 1 Y 32768 0 63 @@ -1156,9 +1157,9 @@ def id 8 3 1 Y 32928 0 63 def select_type 253 19 6 N 1 31 8 def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 -def possible_keys 253 4096 0 Y 0 31 8 +def possible_keys 253 4_OR_8_K 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 0 31 8 +def key_len 253 4_OR_8_K 0 Y 0 31 8 def ref 253 2048 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 @@ -1758,21 +1759,21 @@ NULL as const12, @arg12 as param12, show create table t5 ; Table Create Table t5 CREATE TABLE `t5` ( - `const01` int(1) NOT NULL DEFAULT '0', + `const01` int(1) NOT NULL, `param01` bigint(20) DEFAULT NULL, - `const02` decimal(2,1) NOT NULL DEFAULT '0.0', + `const02` decimal(2,1) NOT NULL, `param02` decimal(65,30) DEFAULT NULL, - `const03` double NOT NULL DEFAULT '0', + `const03` double NOT NULL, `param03` double DEFAULT NULL, - `const04` varchar(3) NOT NULL DEFAULT '', + `const04` varchar(3) NOT NULL, `param04` longtext, - `const05` varbinary(3) NOT NULL DEFAULT '', + `const05` varbinary(3) NOT NULL, `param05` longblob, - `const06` varchar(10) NOT NULL DEFAULT '', + `const06` varchar(10) NOT NULL, `param06` longtext, `const07` date DEFAULT NULL, `param07` longtext, - `const08` varchar(19) NOT NULL DEFAULT '', + `const08` varchar(19) NOT NULL, `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longtext, @@ -1788,21 +1789,21 @@ t5 CREATE TABLE `t5` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t5 ; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t5 t5 const01 const01 3 1 1 N 32769 0 63 +def test t5 t5 const01 const01 3 1 1 N 36865 0 63 def test t5 t5 param01 param01 8 20 1 Y 32768 0 63 -def test t5 t5 const02 const02 246 4 3 N 32769 1 63 +def test t5 t5 const02 const02 246 4 3 N 36865 1 63 def test t5 t5 param02 param02 246 67 32 Y 32768 30 63 -def test t5 t5 const03 const03 5 17 1 N 32769 31 63 +def test t5 t5 const03 const03 5 17 1 N 36865 31 63 def test t5 t5 param03 param03 5 23 1 Y 32768 31 63 -def test t5 t5 const04 const04 253 3 3 N 1 0 8 +def test t5 t5 const04 const04 253 3 3 N 4097 0 8 def test t5 t5 param04 param04 252 4294967295 3 Y 16 0 8 -def test t5 t5 const05 const05 253 3 3 N 129 0 63 +def test t5 t5 const05 const05 253 3 3 N 4225 0 63 def test t5 t5 param05 param05 252 4294967295 3 Y 144 0 63 -def test t5 t5 const06 const06 253 10 10 N 1 0 8 +def test t5 t5 const06 const06 253 10 10 N 4097 0 8 def test t5 t5 param06 param06 252 4294967295 10 Y 16 0 8 def test t5 t5 const07 const07 10 10 10 Y 128 0 63 def test t5 t5 param07 param07 252 4294967295 10 Y 16 0 8 -def test t5 t5 const08 const08 253 19 19 N 1 0 8 +def test t5 t5 const08 const08 253 19 19 N 4097 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8 diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index 57532797dd7..bbdb3ea7b23 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -11,7 +11,8 @@ create table t9 c1 tinyint, c2 smallint, c3 mediumint, c4 int, c5 integer, c6 bigint, c7 float, c8 double, c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), -c13 date, c14 datetime, c15 timestamp, c16 time, +c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP +ON UPDATE CURRENT_TIMESTAMP, c16 time, c17 year, c18 tinyint, c19 bool, c20 char, c21 char(10), c22 varchar(30), c23 varchar(100), c24 varchar(100), c25 varchar(100), c26 varchar(100), c27 varchar(100), c28 varchar(100), @@ -50,7 +51,7 @@ test_sequence prepare stmt1 from ' select * from t9 order by c1 ' ; execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t9 t9 c1 c1 1 4 1 N 49155 0 63 +def test t9 t9 c1 c1 1 4 1 N 53251 0 63 def test t9 t9 c2 c2 2 6 1 Y 32768 0 63 def test t9 t9 c3 c3 9 9 1 Y 32768 0 63 def test t9 t9 c4 c4 3 11 1 Y 32768 0 63 @@ -1157,9 +1158,9 @@ def id 8 3 1 Y 32928 0 63 def select_type 253 19 6 N 1 31 8 def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 -def possible_keys 253 4096 0 Y 0 31 8 +def possible_keys 253 4_OR_8_K 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 0 31 8 +def key_len 253 4_OR_8_K 0 Y 0 31 8 def ref 253 2048 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 @@ -1759,21 +1760,21 @@ NULL as const12, @arg12 as param12, show create table t5 ; Table Create Table t5 CREATE TABLE `t5` ( - `const01` int(1) NOT NULL DEFAULT '0', + `const01` int(1) NOT NULL, `param01` bigint(20) DEFAULT NULL, - `const02` decimal(2,1) NOT NULL DEFAULT '0.0', + `const02` decimal(2,1) NOT NULL, `param02` decimal(65,30) DEFAULT NULL, - `const03` double NOT NULL DEFAULT '0', + `const03` double NOT NULL, `param03` double DEFAULT NULL, - `const04` varchar(3) NOT NULL DEFAULT '', + `const04` varchar(3) NOT NULL, `param04` longtext, - `const05` varbinary(3) NOT NULL DEFAULT '', + `const05` varbinary(3) NOT NULL, `param05` longblob, - `const06` varchar(10) NOT NULL DEFAULT '', + `const06` varchar(10) NOT NULL, `param06` longtext, `const07` date DEFAULT NULL, `param07` longtext, - `const08` varchar(19) NOT NULL DEFAULT '', + `const08` varchar(19) NOT NULL, `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longtext, @@ -1789,21 +1790,21 @@ t5 CREATE TABLE `t5` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t5 ; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t5 t5 const01 const01 3 1 1 N 32769 0 63 +def test t5 t5 const01 const01 3 1 1 N 36865 0 63 def test t5 t5 param01 param01 8 20 1 Y 32768 0 63 -def test t5 t5 const02 const02 246 4 3 N 32769 1 63 +def test t5 t5 const02 const02 246 4 3 N 36865 1 63 def test t5 t5 param02 param02 246 67 32 Y 32768 30 63 -def test t5 t5 const03 const03 5 17 1 N 32769 31 63 +def test t5 t5 const03 const03 5 17 1 N 36865 31 63 def test t5 t5 param03 param03 5 23 1 Y 32768 31 63 -def test t5 t5 const04 const04 253 3 3 N 1 0 8 +def test t5 t5 const04 const04 253 3 3 N 4097 0 8 def test t5 t5 param04 param04 252 4294967295 3 Y 16 0 8 -def test t5 t5 const05 const05 253 3 3 N 129 0 63 +def test t5 t5 const05 const05 253 3 3 N 4225 0 63 def test t5 t5 param05 param05 252 4294967295 3 Y 144 0 63 -def test t5 t5 const06 const06 253 10 10 N 1 0 8 +def test t5 t5 const06 const06 253 10 10 N 4097 0 8 def test t5 t5 param06 param06 252 4294967295 10 Y 16 0 8 def test t5 t5 const07 const07 10 10 10 Y 128 0 63 def test t5 t5 param07 param07 252 4294967295 10 Y 16 0 8 -def test t5 t5 const08 const08 253 19 19 N 1 0 8 +def test t5 t5 const08 const08 253 19 19 N 4097 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8 diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index 9a9f457a212..0262c52d948 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -12,7 +12,8 @@ create table t9 c1 tinyint, c2 smallint, c3 mediumint, c4 int, c5 integer, c6 bigint, c7 float, c8 double, c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), -c13 date, c14 datetime, c15 timestamp, c16 time, +c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP +ON UPDATE CURRENT_TIMESTAMP, c16 time, c17 year, c18 tinyint, c19 bool, c20 char, c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, c25 blob, c26 text, c27 mediumblob, c28 mediumtext, @@ -32,7 +33,8 @@ create table t9 c1 tinyint, c2 smallint, c3 mediumint, c4 int, c5 integer, c6 bigint, c7 float, c8 double, c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), -c13 date, c14 datetime, c15 timestamp, c16 time, +c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP +ON UPDATE CURRENT_TIMESTAMP, c16 time, c17 year, c18 tinyint, c19 bool, c20 char, c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, c25 blob, c26 text, c27 mediumblob, c28 mediumtext, @@ -52,7 +54,7 @@ create table t9 c1 tinyint, c2 smallint, c3 mediumint, c4 int, c5 integer, c6 bigint, c7 float, c8 double, c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), -c13 date, c14 datetime, c15 timestamp, c16 time, +c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c16 time, c17 year, c18 tinyint, c19 bool, c20 char, c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, c25 blob, c26 text, c27 mediumblob, c28 mediumtext, @@ -92,7 +94,7 @@ test_sequence prepare stmt1 from ' select * from t9 order by c1 ' ; execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t9 t9 c1 c1 1 4 1 N 49155 0 63 +def test t9 t9 c1 c1 1 4 1 N 53251 0 63 def test t9 t9 c2 c2 2 6 1 Y 32768 0 63 def test t9 t9 c3 c3 9 9 1 Y 32768 0 63 def test t9 t9 c4 c4 3 11 1 Y 32768 0 63 @@ -1199,9 +1201,9 @@ def id 8 3 1 Y 32928 0 63 def select_type 253 19 6 N 1 31 8 def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 -def possible_keys 253 4096 0 Y 0 31 8 +def possible_keys 253 4_OR_8_K 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 0 31 8 +def key_len 253 4_OR_8_K 0 Y 0 31 8 def ref 253 2048 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 @@ -1695,21 +1697,21 @@ NULL as const12, @arg12 as param12, show create table t5 ; Table Create Table t5 CREATE TABLE `t5` ( - `const01` int(1) NOT NULL DEFAULT '0', + `const01` int(1) NOT NULL, `param01` bigint(20) DEFAULT NULL, - `const02` decimal(2,1) NOT NULL DEFAULT '0.0', + `const02` decimal(2,1) NOT NULL, `param02` decimal(65,30) DEFAULT NULL, - `const03` double NOT NULL DEFAULT '0', + `const03` double NOT NULL, `param03` double DEFAULT NULL, - `const04` varchar(3) NOT NULL DEFAULT '', + `const04` varchar(3) NOT NULL, `param04` longtext, - `const05` varbinary(3) NOT NULL DEFAULT '', + `const05` varbinary(3) NOT NULL, `param05` longblob, - `const06` varchar(10) NOT NULL DEFAULT '', + `const06` varchar(10) NOT NULL, `param06` longtext, `const07` date DEFAULT NULL, `param07` longtext, - `const08` varchar(19) NOT NULL DEFAULT '', + `const08` varchar(19) NOT NULL, `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longtext, @@ -1725,21 +1727,21 @@ t5 CREATE TABLE `t5` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t5 ; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t5 t5 const01 const01 3 1 1 N 32769 0 63 +def test t5 t5 const01 const01 3 1 1 N 36865 0 63 def test t5 t5 param01 param01 8 20 1 Y 32768 0 63 -def test t5 t5 const02 const02 246 4 3 N 32769 1 63 +def test t5 t5 const02 const02 246 4 3 N 36865 1 63 def test t5 t5 param02 param02 246 67 32 Y 32768 30 63 -def test t5 t5 const03 const03 5 17 1 N 32769 31 63 +def test t5 t5 const03 const03 5 17 1 N 36865 31 63 def test t5 t5 param03 param03 5 23 1 Y 32768 31 63 -def test t5 t5 const04 const04 253 3 3 N 1 0 8 +def test t5 t5 const04 const04 253 3 3 N 4097 0 8 def test t5 t5 param04 param04 252 4294967295 3 Y 16 0 8 -def test t5 t5 const05 const05 253 3 3 N 129 0 63 +def test t5 t5 const05 const05 253 3 3 N 4225 0 63 def test t5 t5 param05 param05 252 4294967295 3 Y 144 0 63 -def test t5 t5 const06 const06 253 10 10 N 1 0 8 +def test t5 t5 const06 const06 253 10 10 N 4097 0 8 def test t5 t5 param06 param06 252 4294967295 10 Y 16 0 8 def test t5 t5 const07 const07 10 10 10 Y 128 0 63 def test t5 t5 param07 param07 252 4294967295 10 Y 16 0 8 -def test t5 t5 const08 const08 253 19 19 N 1 0 8 +def test t5 t5 const08 const08 253 19 19 N 4097 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8 @@ -3406,7 +3408,7 @@ create table t9 c1 tinyint, c2 smallint, c3 mediumint, c4 int, c5 integer, c6 bigint, c7 float, c8 double, c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), -c13 date, c14 datetime, c15 timestamp, c16 time, +c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c16 time, c17 year, c18 tinyint, c19 bool, c20 char, c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, c25 blob, c26 text, c27 mediumblob, c28 mediumtext, @@ -3446,7 +3448,7 @@ test_sequence prepare stmt1 from ' select * from t9 order by c1 ' ; execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t9 t9 c1 c1 1 4 1 N 49155 0 63 +def test t9 t9 c1 c1 1 4 1 N 53251 0 63 def test t9 t9 c2 c2 2 6 1 Y 32768 0 63 def test t9 t9 c3 c3 9 9 1 Y 32768 0 63 def test t9 t9 c4 c4 3 11 1 Y 32768 0 63 @@ -4553,9 +4555,9 @@ def id 8 3 1 Y 32928 0 63 def select_type 253 19 6 N 1 31 8 def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 -def possible_keys 253 4096 0 Y 0 31 8 +def possible_keys 253 4_OR_8_K 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 0 31 8 +def key_len 253 4_OR_8_K 0 Y 0 31 8 def ref 253 2048 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 @@ -5049,21 +5051,21 @@ NULL as const12, @arg12 as param12, show create table t5 ; Table Create Table t5 CREATE TABLE `t5` ( - `const01` int(1) NOT NULL DEFAULT '0', + `const01` int(1) NOT NULL, `param01` bigint(20) DEFAULT NULL, - `const02` decimal(2,1) NOT NULL DEFAULT '0.0', + `const02` decimal(2,1) NOT NULL, `param02` decimal(65,30) DEFAULT NULL, - `const03` double NOT NULL DEFAULT '0', + `const03` double NOT NULL, `param03` double DEFAULT NULL, - `const04` varchar(3) NOT NULL DEFAULT '', + `const04` varchar(3) NOT NULL, `param04` longtext, - `const05` varbinary(3) NOT NULL DEFAULT '', + `const05` varbinary(3) NOT NULL, `param05` longblob, - `const06` varchar(10) NOT NULL DEFAULT '', + `const06` varchar(10) NOT NULL, `param06` longtext, `const07` date DEFAULT NULL, `param07` longtext, - `const08` varchar(19) NOT NULL DEFAULT '', + `const08` varchar(19) NOT NULL, `param08` longtext, `const09` datetime DEFAULT NULL, `param09` longtext, @@ -5079,21 +5081,21 @@ t5 CREATE TABLE `t5` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t5 ; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t5 t5 const01 const01 3 1 1 N 32769 0 63 +def test t5 t5 const01 const01 3 1 1 N 36865 0 63 def test t5 t5 param01 param01 8 20 1 Y 32768 0 63 -def test t5 t5 const02 const02 246 4 3 N 32769 1 63 +def test t5 t5 const02 const02 246 4 3 N 36865 1 63 def test t5 t5 param02 param02 246 67 32 Y 32768 30 63 -def test t5 t5 const03 const03 5 17 1 N 32769 31 63 +def test t5 t5 const03 const03 5 17 1 N 36865 31 63 def test t5 t5 param03 param03 5 23 1 Y 32768 31 63 -def test t5 t5 const04 const04 253 3 3 N 1 0 8 +def test t5 t5 const04 const04 253 3 3 N 4097 0 8 def test t5 t5 param04 param04 252 4294967295 3 Y 16 0 8 -def test t5 t5 const05 const05 253 3 3 N 129 0 63 +def test t5 t5 const05 const05 253 3 3 N 4225 0 63 def test t5 t5 param05 param05 252 4294967295 3 Y 144 0 63 -def test t5 t5 const06 const06 253 10 10 N 1 0 8 +def test t5 t5 const06 const06 253 10 10 N 4097 0 8 def test t5 t5 param06 param06 252 4294967295 10 Y 16 0 8 def test t5 t5 const07 const07 10 10 10 Y 128 0 63 def test t5 t5 param07 param07 252 4294967295 10 Y 16 0 8 -def test t5 t5 const08 const08 253 19 19 N 1 0 8 +def test t5 t5 const08 const08 253 19 19 N 4097 0 8 def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8 def test t5 t5 const09 const09 12 19 19 Y 128 0 63 def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8 diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index 118c6785136..d34c96cd568 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -1,4 +1,13 @@ +SET GLOBAL query_cache_type= Off; +SET LOCAL query_cache_type= Off; +SET LOCAL query_cache_type= 0; +SET LOCAL query_cache_type= on; +ERROR HY000: Query cache is globally disabled and you can't enable it only for this session +SET LOCAL query_cache_type= 1; +ERROR HY000: Query cache is globally disabled and you can't enable it only for this session set GLOBAL query_cache_size=1355776; +SET GLOBAL query_cache_type= ON; +SET LOCAL query_cache_type= ON; flush query cache; flush query cache; reset query cache; @@ -1599,7 +1608,9 @@ show status like 'Qcache_free_blocks'; Variable_name Value Qcache_free_blocks 0 set global query_cache_size=102400; -ERROR HY000: Query cache is disabled; set query_cache_type to ON or DEMAND to enable it +show status like 'Qcache_free_blocks'; +Variable_name Value +Qcache_free_blocks 1 set global query_cache_type=on; set session query_cache_type=on; Restore default values. @@ -1660,6 +1671,8 @@ set GLOBAL query_cache_limit=default; set GLOBAL query_cache_min_res_unit=default; set GLOBAL query_cache_size=default; set local query_cache_type=default; +set GLOBAL query_cache_type=on; +set local query_cache_type=on; FLUSH STATUS; SET GLOBAL query_cache_size=10*1024*1024; SET @save_concurrent_insert= @@concurrent_insert; diff --git a/mysql-test/r/query_cache_debug.result b/mysql-test/r/query_cache_debug.result index 50a3a02fe4d..01c642b325b 100644 --- a/mysql-test/r/query_cache_debug.result +++ b/mysql-test/r/query_cache_debug.result @@ -1,3 +1,4 @@ +set global query_cache_type= ON; flush status; set query_cache_type=DEMAND; set global query_cache_size= 1024*768; diff --git a/mysql-test/r/query_cache_merge.result b/mysql-test/r/query_cache_merge.result index c324df65f77..e31ab05b396 100644 --- a/mysql-test/r/query_cache_merge.result +++ b/mysql-test/r/query_cache_merge.result @@ -1,3 +1,5 @@ +SET GLOBAL query_cache_type=ON; +SET LOCAL query_cache_type=ON; SET @@global.query_cache_size=1355776; flush status; select count(*) from t00; @@ -1690,6 +1692,7 @@ DROP TABLE t4; DROP TABLE t3; DROP TABLE t2; DROP TABLE t1; -SET @@global.query_cache_size = 0; +SET @@global.query_cache_size = default; SET @@global.table_definition_cache = @save_table_definition_cache; +SET GLOBAL query_cache_type=default; End of 5.1 tests diff --git a/mysql-test/r/query_cache_notembedded.result b/mysql-test/r/query_cache_notembedded.result index f2021f9d2e7..400ac2b2718 100644 --- a/mysql-test/r/query_cache_notembedded.result +++ b/mysql-test/r/query_cache_notembedded.result @@ -1,4 +1,8 @@ -set GLOBAL query_cache_size=1355776; +set @sql_mode_save=@@global.sql_mode; +set @query_cache_type_save=@@global.query_cache_type; +set @query_cache_size_save=@@global.query_cache_size; +set GLOBAL sql_mode=""; +set LOCAL sql_mode=""; flush query cache; flush query cache; reset query cache; @@ -379,7 +383,8 @@ Qcache_queries_in_cache 1 USE test; DROP DATABASE bug30269; DROP USER 'bug30269'@'localhost'; -set GLOBAL query_cache_type=default; +set GLOBAL query_cache_type=ON; +set LOCAL query_cache_type=ON; set GLOBAL query_cache_limit=default; set GLOBAL query_cache_min_res_unit=default; set GLOBAL query_cache_size=default; @@ -435,3 +440,6 @@ flush query cache| delete from t1| drop procedure bug3583| drop table t1| +SET GLOBAL query_cache_size=@query_cache_size_save; +SET GLOBAL query_cache_type=@query_cache_type_save; +set GLOBAL sql_mode=@sql_mode_save; diff --git a/mysql-test/r/query_cache_ps_no_prot.result b/mysql-test/r/query_cache_ps_no_prot.result index 02e660450d1..5076003a7fb 100644 --- a/mysql-test/r/query_cache_ps_no_prot.result +++ b/mysql-test/r/query_cache_ps_no_prot.result @@ -1,3 +1,5 @@ +set GLOBAL query_cache_type=ON; +set LOCAL query_cache_type=ON; ---- establish connection con1 (root) ---- ---- switch to connection default ---- set @initial_query_cache_size = @@global.query_cache_size; @@ -572,3 +574,4 @@ deallocate prepare stmt; drop table t1; set @@global.query_cache_size=@initial_query_cache_size; flush status; +set GLOBAL query_cache_type=default; diff --git a/mysql-test/r/query_cache_ps_ps_prot.result b/mysql-test/r/query_cache_ps_ps_prot.result index 2115ecc62ff..4105bc40f94 100644 --- a/mysql-test/r/query_cache_ps_ps_prot.result +++ b/mysql-test/r/query_cache_ps_ps_prot.result @@ -1,3 +1,5 @@ +set GLOBAL query_cache_type=ON; +set LOCAL query_cache_type=ON; ---- establish connection con1 (root) ---- ---- switch to connection default ---- set @initial_query_cache_size = @@global.query_cache_size; @@ -572,3 +574,4 @@ deallocate prepare stmt; drop table t1; set @@global.query_cache_size=@initial_query_cache_size; flush status; +set GLOBAL query_cache_type=default; diff --git a/mysql-test/r/query_cache_with_views.result b/mysql-test/r/query_cache_with_views.result index 7f0417a60c7..763113dbac3 100644 --- a/mysql-test/r/query_cache_with_views.result +++ b/mysql-test/r/query_cache_with_views.result @@ -1,5 +1,7 @@ drop table if exists t1,t2,v1,v2,v3; drop view if exists t1,t2,v1,v2,v3; +set GLOBAL query_cache_type=ON; +set LOCAL query_cache_type=ON; set GLOBAL query_cache_size=1355776; flush status; create table t1 (a int, b int); @@ -207,3 +209,4 @@ DROP TABLE t2; DROP VIEW t1_view; SET AUTOCOMMIT=DEFAULT; set GLOBAL query_cache_size=default; +set GLOBAL query_cache_type=default; diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 89fac898414..a0e44f91d44 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -618,10 +618,10 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref a a 11 const 2 Using index condition explain select * from t1 where a=binary 'aaa'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 11 NULL 2 Using index condition +1 SIMPLE t1 ref a a 11 const 2 Using index condition explain select * from t1 where a='aaa' collate latin1_bin; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 11 NULL 2 Using index condition +1 SIMPLE t1 ref a a 11 const 2 Using index condition explain select * from t1 where a='aaa' collate latin1_german1_ci; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL a NULL NULL NULL 9 Using where @@ -2209,3 +2209,84 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t3 const PRIMARY PRIMARY 4 const 1 1 SIMPLE t2 range a a 5 NULL 1 Using where; Using index drop table t1,t2,t3; +# +# MDEV-6480: Remove conditions for which range optimizer returned SEL_ARG::IMPOSSIBLE. +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, b int, c int, key(a), key(b)); +insert into t2 +select +A.a + B.a* 10 + C.a * 100, +A.a + B.a* 10 + C.a * 100, +12345 +from +t1 A, t1 B, t1 C; +# EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where (b > 25 and b < 15) or a<44; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`a` < 44) +# EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where a < 44 or (b > 25 and b < 15); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`a` < 44) +# Here, conditions b will not be removed, because "c<44" is not sargable +# and hence (b.. and .. b) part is not analyzed at all: +explain extended select * from t2 where c < 44 or (b > 25 and b < 15); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` < 44) or ((`test`.`t2`.`b` > 25) and (`test`.`t2`.`b` < 15))) +# EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where (b > 25 and b < 15) or c < 44; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` < 44)) +# Try a case where both OR parts produce SEL_ARG::IMPOSSIBLE: +explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 0 +drop table t1,t2; +# +# Start of 10.1 tests +# +# +# MDEV-8189 field<>const and const<>field are not symmetric +# +CREATE TABLE t1 (a INT, b INT, KEY(a)); +INSERT INTO t1 (a) VALUES (10),(10),(10),(10),(10),(10),(10),(10),(10),(10),(70); +EXPLAIN SELECT * FROM t1 WHERE a<>10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 5 NULL 3 Using index condition +EXPLAIN SELECT * FROM t1 WHERE 10<>a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 5 NULL 3 Using index condition +SELECT * FROM t1 WHERE a<>10; +a b +70 NULL +SELECT * FROM t1 WHERE 10<>a; +a b +70 NULL +DROP TABLE t1; +# +# MDEV-8613 Full table scan for WHERE indexed_varchar_column <=> 'bad-character' +# +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8, KEY(a)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'),('e'); +EXPLAIN SELECT * FROM t1 WHERE a<=>'😎'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column 'a' at row 1 +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result index 0350e36eec9..c16d3b4adae 100644 --- a/mysql-test/r/range_mrr_icp.result +++ b/mysql-test/r/range_mrr_icp.result @@ -620,10 +620,10 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref a a 11 const 2 Using index condition explain select * from t1 where a=binary 'aaa'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 11 NULL 2 Using index condition; Rowid-ordered scan +1 SIMPLE t1 ref a a 11 const 2 Using index condition explain select * from t1 where a='aaa' collate latin1_bin; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 11 NULL 2 Using index condition; Rowid-ordered scan +1 SIMPLE t1 ref a a 11 const 2 Using index condition explain select * from t1 where a='aaa' collate latin1_german1_ci; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL a NULL NULL NULL 9 Using where @@ -2211,4 +2211,85 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t3 const PRIMARY PRIMARY 4 const 1 1 SIMPLE t2 range a a 5 NULL 1 Using where; Using index drop table t1,t2,t3; +# +# MDEV-6480: Remove conditions for which range optimizer returned SEL_ARG::IMPOSSIBLE. +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, b int, c int, key(a), key(b)); +insert into t2 +select +A.a + B.a* 10 + C.a * 100, +A.a + B.a* 10 + C.a * 100, +12345 +from +t1 A, t1 B, t1 C; +# EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where (b > 25 and b < 15) or a<44; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition; Rowid-ordered scan +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`a` < 44) +# EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where a < 44 or (b > 25 and b < 15); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition; Rowid-ordered scan +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`a` < 44) +# Here, conditions b will not be removed, because "c<44" is not sargable +# and hence (b.. and .. b) part is not analyzed at all: +explain extended select * from t2 where c < 44 or (b > 25 and b < 15); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` < 44) or ((`test`.`t2`.`b` > 25) and (`test`.`t2`.`b` < 15))) +# EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where (b > 25 and b < 15) or c < 44; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` < 44)) +# Try a case where both OR parts produce SEL_ARG::IMPOSSIBLE: +explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 0 +drop table t1,t2; +# +# Start of 10.1 tests +# +# +# MDEV-8189 field<>const and const<>field are not symmetric +# +CREATE TABLE t1 (a INT, b INT, KEY(a)); +INSERT INTO t1 (a) VALUES (10),(10),(10),(10),(10),(10),(10),(10),(10),(10),(70); +EXPLAIN SELECT * FROM t1 WHERE a<>10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 5 NULL 3 Using index condition; Rowid-ordered scan +EXPLAIN SELECT * FROM t1 WHERE 10<>a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 5 NULL 3 Using index condition; Rowid-ordered scan +SELECT * FROM t1 WHERE a<>10; +a b +70 NULL +SELECT * FROM t1 WHERE 10<>a; +a b +70 NULL +DROP TABLE t1; +# +# MDEV-8613 Full table scan for WHERE indexed_varchar_column <=> 'bad-character' +# +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8, KEY(a)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'),('e'); +EXPLAIN SELECT * FROM t1 WHERE a<=>'😎'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column 'a' at row 1 +DROP TABLE t1; +# +# End of 10.1 tests +# set optimizer_switch=@mrr_icp_extra_tmp; diff --git a/mysql-test/r/read_only.result b/mysql-test/r/read_only.result index c9c569137b2..964c259ebf8 100644 --- a/mysql-test/r/read_only.result +++ b/mysql-test/r/read_only.result @@ -1,11 +1,13 @@ set @start_read_only= @@global.read_only; DROP TABLE IF EXISTS t1,t2,t3; +create user test@localhost; grant CREATE, SELECT, DROP on *.* to test@localhost; connect (con1,localhost,test,,test); connection default; set global read_only=0; connection con1; create table t1 (a int); +create trigger trg1 before insert on t1 for each row set @a:=1; insert into t1 values(1); create table t2 select * from t1; connection default; @@ -20,6 +22,8 @@ create table t3 (a int); ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement insert into t1 values(1); ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement +drop trigger trg1; +ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement update t1 set a=1 where 1=0; ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement update t1,t2 set t1.a=t2.a+1 where t1.a=t2.a; @@ -136,6 +140,7 @@ delete from mysql.db where User like 'mysqltest_%'; delete from mysql.tables_priv where User like 'mysqltest_%'; delete from mysql.columns_priv where User like 'mysqltest_%'; flush privileges; +create user `mysqltest_u1`@`%`; grant all on mysqltest_db2.* to `mysqltest_u1`@`%`; create database mysqltest_db1; grant all on mysqltest_db1.* to `mysqltest_u1`@`%`; diff --git a/mysql-test/r/read_only_innodb.result b/mysql-test/r/read_only_innodb.result index 1e041395d3c..a276e6cbc19 100644 --- a/mysql-test/r/read_only_innodb.result +++ b/mysql-test/r/read_only_innodb.result @@ -1,4 +1,5 @@ DROP TABLE IF EXISTS table_11733 ; +create user test@localhost; grant CREATE, SELECT, DROP on *.* to test@localhost; set global read_only=0; create table table_11733 (a int) engine=InnoDb; @@ -16,6 +17,7 @@ ERROR HY000: The MariaDB server is running with the --read-only option so it can set global read_only=0; drop table table_11733 ; drop user test@localhost; +create user test@localhost; GRANT CREATE, SELECT, DROP ON *.* TO test@localhost; CREATE TABLE t1(a INT) ENGINE=INNODB; INSERT INTO t1 VALUES (0), (1); diff --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result index 79bc6d55c55..79ee0c7a9b8 100644 --- a/mysql-test/r/repair.result +++ b/mysql-test/r/repair.result @@ -126,7 +126,7 @@ id # Run CHECK TABLE, it should indicate table need a REPAIR TABLE CHECK TABLE t1 FOR UPGRADE; Table Op Msg_type Msg_text -test.t1 check error Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it! +test.t1 check error Upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it! # REPAIR old table USE_FRM should fail REPAIR TABLE t1 USE_FRM; Table Op Msg_type Msg_text diff --git a/mysql-test/r/repair_symlink-5543.result b/mysql-test/r/repair_symlink-5543.result index 051c9ca3472..98ded32686e 100644 --- a/mysql-test/r/repair_symlink-5543.result +++ b/mysql-test/r/repair_symlink-5543.result @@ -2,13 +2,12 @@ create table t1 (a int) engine=myisam data directory='MYSQL_TMP_DIR'; insert t1 values (1); repair table t1; Table Op Msg_type Msg_text -test.t1 repair error Can't create new tempfile: 'MYSQL_TMP_DIR/t1.TMD' -test.t1 repair status Operation failed +test.t1 repair status OK drop table t1; create table t2 (a int) engine=aria data directory='MYSQL_TMP_DIR'; insert t2 values (1); repair table t2; Table Op Msg_type Msg_text -test.t2 repair error Can't create new tempfile: 'MYSQL_TMP_DIR/t2.TMD' -test.t2 repair status Operation failed +test.t2 repair status OK drop table t2; +foobar5543 diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result index f94c958a1be..9a19c3b0604 100644 --- a/mysql-test/r/row.result +++ b/mysql-test/r/row.result @@ -50,6 +50,12 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select ((1,2,(3,4)) in ((3,2,(3,4)),(1,2,(3,NULL)))) AS `row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)))` +select row(1,2,row(3,null)) IN (row(3,2,row(3,4)), row(1,2,row(4,5))); +row(1,2,row(3,null)) IN (row(3,2,row(3,4)), row(1,2,row(4,5))) +0 +select row(1,2,row(3,null)) IN (row(3,2,row(3,4)), row(1,2,row(3,5))); +row(1,2,row(3,null)) IN (row(3,2,row(3,4)), row(1,2,row(3,5))) +NULL SELECT (1,2,3)=(0,NULL,3); (1,2,3)=(0,NULL,3) 0 @@ -130,7 +136,7 @@ ROW(c,2,3) IN(row(1,b,a), row(2,3,1)) 0 0 1 -NULL +0 select ROW(a,b,c) IN(row(1,2,3), row(3,2,1)) from t1; ROW(a,b,c) IN(row(1,2,3), row(3,2,1)) 1 @@ -489,3 +495,31 @@ SELECT i FROM t1 WHERE ROW(1,2) = (SELECT 1,3 FROM DUAL WHERE 1 = 0); i DROP TABLE t1; End of 5.1 tests +# +# Start of 10.1 tests +# +# +# MDEV-8709 Row equality elements do not get propagated +# +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (10,10),(20,20); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND b=10 AND a>=10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 10) and (`test`.`t1`.`b` = 10)) +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a,b)=(10,10) AND a>=10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 10) and (`test`.`t1`.`b` = 10)) +DROP TABLE t1; +# +# MDEV-9369 IN operator with ( num, NULL ) gives inconsistent result +# +SELECT (1,null) NOT IN ((2,2),(3,3)), (1,null) NOT IN ((2,2)), (1,null) NOT IN ((3,3)); +(1,null) NOT IN ((2,2),(3,3)) (1,null) NOT IN ((2,2)) (1,null) NOT IN ((3,3)) +1 1 1 +# +# End of 10.1 tests +# diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 7219a9c4462..9dbf6e0c46b 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2111,7 +2111,7 @@ INSERT INTO t1 (pseudo) VALUES ('test1'); SELECT 1 as rnd1 from t1 where rand() > 2; rnd1 DROP TABLE t1; -CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp NOT NULL, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM; +CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM; INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL); CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM; INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35); @@ -3742,7 +3742,7 @@ WHERE ID_better=1 AND ID1_with_null IS NULL AND id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where DROP TABLE t1; -CREATE TABLE t1 (a INT, ts TIMESTAMP, KEY ts(ts)); +CREATE TABLE t1 (a INT, ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, KEY ts(ts)); INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00"); ANALYZE TABLE t1; Table Op Msg_type Msg_text @@ -3784,9 +3784,9 @@ coalesce(9223372036854775808, 1) co; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `i` decimal(19,0) NOT NULL DEFAULT '0', - `c` decimal(19,0) NOT NULL DEFAULT '0', - `co` decimal(19,0) NOT NULL DEFAULT '0' + `i` decimal(19,0) NOT NULL, + `c` decimal(19,0) NOT NULL, + `co` decimal(19,0) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select @@ -4482,7 +4482,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select '2001-01-01' AS `a` from dual where 1 DROP TABLE t1; -CREATE TABLE t1(a TIMESTAMP NOT NULL); +CREATE TABLE t1(a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); INSERT INTO t1 VALUES('2001-01-01'); SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; a @@ -5301,7 +5301,6 @@ f1 Warnings: Warning 1292 Incorrect datetime value: 'zz' Warning 1292 Incorrect datetime value: 'aa' -Warning 1292 Incorrect datetime value: 'zz' SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ; f1 0000-00-00 diff --git a/mysql-test/r/select_jcl6.result b/mysql-test/r/select_jcl6.result index 3c62d0676ae..81e52929881 100644 --- a/mysql-test/r/select_jcl6.result +++ b/mysql-test/r/select_jcl6.result @@ -2122,7 +2122,7 @@ INSERT INTO t1 (pseudo) VALUES ('test1'); SELECT 1 as rnd1 from t1 where rand() > 2; rnd1 DROP TABLE t1; -CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp NOT NULL, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM; +CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM; INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL); CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM; INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35); @@ -3753,7 +3753,7 @@ WHERE ID_better=1 AND ID1_with_null IS NULL AND id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where DROP TABLE t1; -CREATE TABLE t1 (a INT, ts TIMESTAMP, KEY ts(ts)); +CREATE TABLE t1 (a INT, ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, KEY ts(ts)); INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00"); ANALYZE TABLE t1; Table Op Msg_type Msg_text @@ -3795,9 +3795,9 @@ coalesce(9223372036854775808, 1) co; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `i` decimal(19,0) NOT NULL DEFAULT '0', - `c` decimal(19,0) NOT NULL DEFAULT '0', - `co` decimal(19,0) NOT NULL DEFAULT '0' + `i` decimal(19,0) NOT NULL, + `c` decimal(19,0) NOT NULL, + `co` decimal(19,0) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select @@ -4493,7 +4493,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select '2001-01-01' AS `a` from dual where 1 DROP TABLE t1; -CREATE TABLE t1(a TIMESTAMP NOT NULL); +CREATE TABLE t1(a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); INSERT INTO t1 VALUES('2001-01-01'); SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; a @@ -5312,7 +5312,6 @@ f1 Warnings: Warning 1292 Incorrect datetime value: 'zz' Warning 1292 Incorrect datetime value: 'aa' -Warning 1292 Incorrect datetime value: 'zz' SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ; f1 0000-00-00 diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result index 7219a9c4462..9dbf6e0c46b 100644 --- a/mysql-test/r/select_pkeycache.result +++ b/mysql-test/r/select_pkeycache.result @@ -2111,7 +2111,7 @@ INSERT INTO t1 (pseudo) VALUES ('test1'); SELECT 1 as rnd1 from t1 where rand() > 2; rnd1 DROP TABLE t1; -CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp NOT NULL, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM; +CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM; INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL); CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM; INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35); @@ -3742,7 +3742,7 @@ WHERE ID_better=1 AND ID1_with_null IS NULL AND id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where DROP TABLE t1; -CREATE TABLE t1 (a INT, ts TIMESTAMP, KEY ts(ts)); +CREATE TABLE t1 (a INT, ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, KEY ts(ts)); INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00"); ANALYZE TABLE t1; Table Op Msg_type Msg_text @@ -3784,9 +3784,9 @@ coalesce(9223372036854775808, 1) co; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `i` decimal(19,0) NOT NULL DEFAULT '0', - `c` decimal(19,0) NOT NULL DEFAULT '0', - `co` decimal(19,0) NOT NULL DEFAULT '0' + `i` decimal(19,0) NOT NULL, + `c` decimal(19,0) NOT NULL, + `co` decimal(19,0) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select @@ -4482,7 +4482,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select '2001-01-01' AS `a` from dual where 1 DROP TABLE t1; -CREATE TABLE t1(a TIMESTAMP NOT NULL); +CREATE TABLE t1(a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); INSERT INTO t1 VALUES('2001-01-01'); SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; a @@ -5301,7 +5301,6 @@ f1 Warnings: Warning 1292 Incorrect datetime value: 'zz' Warning 1292 Incorrect datetime value: 'aa' -Warning 1292 Incorrect datetime value: 'zz' SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ; f1 0000-00-00 diff --git a/mysql-test/r/selectivity.result b/mysql-test/r/selectivity.result index 620bdc6bd50..4238359c201 100644 --- a/mysql-test/r/selectivity.result +++ b/mysql-test/r/selectivity.result @@ -1298,10 +1298,10 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` A select * from t1, t2, t1 as t3 where t1.b=t2.c and t2.d=t3.a and t3.b<5 and t1.a < 2000; a b c d a b -1495 89366 89366 28296 28296 3 -961 24512 24512 85239 85239 4 1063 89366 89366 28296 28296 3 +1495 89366 89366 28296 28296 3 221 56120 56120 28296 28296 3 +961 24512 24512 85239 85239 4 set optimizer_use_condition_selectivity=3; explain extended select * from t1, t2, t1 as t3 @@ -1315,10 +1315,10 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` A select * from t1, t2, t1 as t3 where t1.b=t2.c and t2.d=t3.a and t3.b<5 and t1.a < 2000; a b c d a b -961 24512 24512 85239 85239 4 -1495 89366 89366 28296 28296 3 1063 89366 89366 28296 28296 3 +1495 89366 89366 28296 28296 3 221 56120 56120 28296 28296 3 +961 24512 24512 85239 85239 4 set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; drop table t1,t2; set histogram_type=@save_histogram_type; @@ -1412,16 +1412,10 @@ drop table t0,t1,t2; # # Bug mdev-7316: a conjunct in WHERE with selectivity == 0 # -CREATE TABLE t1 (a varchar(16), b int, PRIMARY KEY(a), KEY(b)) ENGINE=INNODB; -Warnings: -Warning 1286 Unknown storage engine 'INNODB' -Warning 1266 Using storage engine MyISAM for table 't1' +CREATE TABLE t1 (a varchar(16), b int, PRIMARY KEY(a), KEY(b)); INSERT INTO t1 VALUES ('USAChinese',10), ('USAEnglish',20), ('USAFrench',30); -CREATE TABLE t2 (i int) ENGINE=INNODB; -Warnings: -Warning 1286 Unknown storage engine 'INNODB' -Warning 1266 Using storage engine MyISAM for table 't2' +CREATE TABLE t2 (i int); INSERT INTO t2 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(1),(2),(3),(4); ANALYZE TABLE t1, t2; diff --git a/mysql-test/r/selectivity_innodb.result b/mysql-test/r/selectivity_innodb.result index 0acbb465ba8..daf28073cf1 100644 --- a/mysql-test/r/selectivity_innodb.result +++ b/mysql-test/r/selectivity_innodb.result @@ -1308,10 +1308,10 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` A select * from t1, t2, t1 as t3 where t1.b=t2.c and t2.d=t3.a and t3.b<5 and t1.a < 2000; a b c d a b -1495 89366 89366 28296 28296 3 -961 24512 24512 85239 85239 4 1063 89366 89366 28296 28296 3 +1495 89366 89366 28296 28296 3 221 56120 56120 28296 28296 3 +961 24512 24512 85239 85239 4 set optimizer_use_condition_selectivity=3; explain extended select * from t1, t2, t1 as t3 @@ -1325,10 +1325,10 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` A select * from t1, t2, t1 as t3 where t1.b=t2.c and t2.d=t3.a and t3.b<5 and t1.a < 2000; a b c d a b -961 24512 24512 85239 85239 4 -1495 89366 89366 28296 28296 3 1063 89366 89366 28296 28296 3 +1495 89366 89366 28296 28296 3 221 56120 56120 28296 28296 3 +961 24512 24512 85239 85239 4 set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; drop table t1,t2; set histogram_type=@save_histogram_type; @@ -1422,10 +1422,10 @@ drop table t0,t1,t2; # # Bug mdev-7316: a conjunct in WHERE with selectivity == 0 # -CREATE TABLE t1 (a varchar(16), b int, PRIMARY KEY(a), KEY(b)) ENGINE=INNODB; +CREATE TABLE t1 (a varchar(16), b int, PRIMARY KEY(a), KEY(b)); INSERT INTO t1 VALUES ('USAChinese',10), ('USAEnglish',20), ('USAFrench',30); -CREATE TABLE t2 (i int) ENGINE=INNODB; +CREATE TABLE t2 (i int); INSERT INTO t2 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(1),(2),(3),(4); ANALYZE TABLE t1, t2; diff --git a/mysql-test/r/servers.result b/mysql-test/r/servers.result index c9d82c9cfcc..585f0f62af0 100644 --- a/mysql-test/r/servers.result +++ b/mysql-test/r/servers.result @@ -1,8 +1,26 @@ +set sql_mode=""; # # MDEV-4594 - CREATE SERVER crashes embedded # CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(HOST 'localhost'); SELECT * FROM mysql.servers; Server_name Host Db Username Password Port Socket Wrapper Owner -s1 localhost 0 mysql +s1 localhost 3306 mysql +DROP SERVER s1; +CREATE SERVER s1 FOREIGN DATA WRAPPER foo OPTIONS(USER 'bar'); +SELECT * FROM mysql.servers; +Server_name Host Db Username Password Port Socket Wrapper Owner +s1 bar 0 foo +DROP SERVER s1; +CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(USER 'bar'); +ERROR HY000: Can't create federated table. Foreign data src error: either HOST or SOCKET must be set +CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(HOST 'bar'); +SELECT * FROM mysql.servers; +Server_name Host Db Username Password Port Socket Wrapper Owner +s1 bar 3306 mysql +DROP SERVER s1; +CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(SOCKET 'bar'); +SELECT * FROM mysql.servers; +Server_name Host Db Username Password Port Socket Wrapper Owner +s1 3306 bar mysql DROP SERVER s1; diff --git a/mysql-test/r/set_password_plugin-9835.result b/mysql-test/r/set_password_plugin-9835.result index e9ee09fe952..3cc723957d8 100644 --- a/mysql-test/r/set_password_plugin-9835.result +++ b/mysql-test/r/set_password_plugin-9835.result @@ -1,3 +1,4 @@ +set global secure_auth=0; create user natauth@localhost identified via 'mysql_native_password' using '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29'; create user newpass@localhost identified by password '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29'; create user newpassnat@localhost identified via 'mysql_native_password'; @@ -8,10 +9,10 @@ create user oldpassold@localhost identified with 'mysql_old_password'; set password for oldpassold@localhost = '378b243e220ca493'; select user, host, password, plugin, authentication_string from mysql.user where user != 'root'; user host password plugin authentication_string -natauth localhost mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 +natauth localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 newpass localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 newpassnat localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 -oldauth localhost mysql_old_password 378b243e220ca493 +oldauth localhost 378b243e220ca493 oldpass localhost 378b243e220ca493 oldpassold localhost 378b243e220ca493 connect con,localhost,natauth,test,; @@ -156,3 +157,4 @@ disconnect con; connection default; drop user natauth@localhost, newpass@localhost, newpassnat@localhost; drop user oldauth@localhost, oldpass@localhost, oldpassold@localhost; +set global secure_auth=default; diff --git a/mysql-test/r/set_statement.result b/mysql-test/r/set_statement.result new file mode 100644 index 00000000000..ad6f3b7bf2e --- /dev/null +++ b/mysql-test/r/set_statement.result @@ -0,0 +1,1223 @@ +'# SET STATEMENT ..... FOR .... TEST' +DROP TABLE IF EXISTS t1; +DROP FUNCTION IF EXISTS myProc; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; +DROP PROCEDURE IF EXISTS p3; +DROP PROCEDURE IF EXISTS p4; +DROP PROCEDURE IF EXISTS p5; +DROP PROCEDURE IF EXISTS p6; +DROP VIEW IF EXISTS v1; +DROP TABLE IF EXISTS STATEMENT; +SET @save_binlog_format = @@binlog_format; +SET @save_keep_files_on_create = @@keep_files_on_create; +SET @save_max_join_size = @@max_join_size; +SET @save_myisam_repair_threads = @@myisam_repair_threads; +SET @save_myisam_sort_buffer_size = @@myisam_sort_buffer_size; +SET @save_sort_buffer_size = @@sort_buffer_size; +'# Setup database' +CREATE TABLE t1 (v1 INT, v2 INT); +INSERT INTO t1 VALUES (1,2); +INSERT INTO t1 VALUES (3,4); +'' +'#------------------ STATEMENT Test 1 -----------------------#' +'# Initialize variables to known setting' +SET SESSION sort_buffer_size=100000; +'' +'# Pre-STATEMENT variable value' +SHOW SESSION VARIABLES LIKE 'sort_buffer_size'; +Variable_name Value +sort_buffer_size 100000 +SET STATEMENT sort_buffer_size=150000 FOR SELECT *,@@sort_buffer_size FROM t1; +v1 v2 @@sort_buffer_size +1 2 150000 +3 4 150000 +'' +'# Post-STATEMENT variable value' +SHOW SESSION VARIABLES LIKE 'sort_buffer_size'; +Variable_name Value +sort_buffer_size 100000 +'' +'#------------------ STATEMENT Test 2 -----------------------#' +'# Initialize variables to known setting' +SET SESSION binlog_format=mixed; +SET SESSION sort_buffer_size=100000; +'# Pre-STATEMENT variable value' +SHOW SESSION VARIABLES LIKE 'sort_buffer_size'; +Variable_name Value +sort_buffer_size 100000 +SHOW SESSION VARIABLES LIKE 'binlog_format'; +Variable_name Value +binlog_format MIXED +SET STATEMENT sort_buffer_size=150000, binlog_format=row +FOR SELECT *,@@sort_buffer_size,@@binlog_format FROM t1; +v1 v2 @@sort_buffer_size @@binlog_format +1 2 150000 ROW +3 4 150000 ROW +'# Post-STATEMENT variable value' +SHOW SESSION VARIABLES LIKE 'sort_buffer_size'; +Variable_name Value +sort_buffer_size 100000 +SHOW SESSION VARIABLES LIKE 'binlog_format'; +Variable_name Value +binlog_format MIXED +'' +'#------------------ STATEMENT Test 3 -----------------------#' +'# set initial variable value, make prepared statement +SET SESSION binlog_format=row; +PREPARE stmt1 FROM 'SET STATEMENT binlog_format=row FOR SELECT *,@@binlog_format FROM t1'; +'' +'# Change variable setting' +SET SESSION binlog_format=mixed; +'' +'# Pre-STATEMENT variable value' +'' +SHOW SESSION VARIABLES LIKE 'binlog_format'; +Variable_name Value +binlog_format MIXED +'' +EXECUTE stmt1; +v1 v2 @@binlog_format +1 2 ROW +3 4 ROW +'' +'# Post-STATEMENT variable value' +SHOW SESSION VARIABLES LIKE 'binlog_format'; +Variable_name Value +binlog_format MIXED +'' +DEALLOCATE PREPARE stmt1; +'#------------------ STATEMENT Test 4 -----------------------#' +'# set initial variable value, make prepared statement +SET SESSION myisam_sort_buffer_size=500000, myisam_repair_threads=1; +'' +'# Pre-STATEMENT variable value' +SHOW SESSION VARIABLES LIKE 'myisam_sort_buffer_size'; +Variable_name Value +myisam_sort_buffer_size 500000 +SHOW SESSION VARIABLES LIKE 'myisam_repair_threads'; +Variable_name Value +myisam_repair_threads 1 +'' +SET STATEMENT myisam_sort_buffer_size=800000, +myisam_repair_threads=2 FOR OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +'' +'# Post-STATEMENT variable value' +SHOW SESSION VARIABLES LIKE 'myisam_sort_buffer_size'; +Variable_name Value +myisam_sort_buffer_size 500000 +SHOW SESSION VARIABLES LIKE 'myisam_repair_threads'; +Variable_name Value +myisam_repair_threads 1 +'' +'#------------------ STATEMENT Test 5 -----------------------#' +'# Initialize variables to known setting' +SET SESSION sort_buffer_size=100000; +'' +'# Pre-STATEMENT variable value' +SHOW SESSION VARIABLES LIKE 'sort_buffer_size'; +Variable_name Value +sort_buffer_size 100000 +'' +SET STATEMENT sort_buffer_size=150000 FOR SELECT * FROM t2; +ERROR 42S02: Table 'test.t2' doesn't exist +'' +'# Post-STATEMENT variable value' +SHOW SESSION VARIABLES LIKE 'sort_buffer_size'; +Variable_name Value +sort_buffer_size 100000 +'' +'#------------------ STATEMENT Test 6 -----------------------#' +'# Initialize variables to known setting' +SET SESSION keep_files_on_create=ON; +'' +'# Pre-STATEMENT variable value' +SHOW SESSION VARIABLES LIKE 'keep_files_on_create'; +Variable_name Value +keep_files_on_create ON +'' +SET STATEMENT keep_files_on_create=OFF FOR SELECT *,@@keep_files_on_create FROM t1; +v1 v2 @@keep_files_on_create +1 2 0 +3 4 0 +'' +'# Post-STATEMENT variable value' +SHOW SESSION VARIABLES LIKE 'keep_files_on_create'; +Variable_name Value +keep_files_on_create ON +'' +'#------------------ STATEMENT Test 7 -----------------------#' +'# Initialize variables to known setting' +SET SESSION max_join_size=2222220000000; +'' +'# Pre-STATEMENT variable value' +SHOW SESSION VARIABLES LIKE 'max_join_size'; +Variable_name Value +max_join_size 2222220000000 +'' +SET STATEMENT max_join_size=1000000000000 FOR SELECT *,@@max_join_size FROM t1; +v1 v2 @@max_join_size +1 2 1000000000000 +3 4 1000000000000 +'' +'# Post-STATEMENT variable value' +SHOW SESSION VARIABLES LIKE 'max_join_size'; +Variable_name Value +max_join_size 2222220000000 +'' +'#------------------Test 8-----------------------#' +'# Initialize test variables' +SET SESSION myisam_sort_buffer_size=500000, +myisam_repair_threads=1, +sort_buffer_size = 200000, +max_join_size=2222220000000, +keep_files_on_create=ON; +'' +'# LONG ' +SHOW SESSION VARIABLES LIKE 'sort_buffer_size'; +Variable_name Value +sort_buffer_size 200000 +SET STATEMENT sort_buffer_size = 100000 +FOR SHOW SESSION VARIABLES LIKE 'sort_buffer_size'; +Variable_name Value +sort_buffer_size 100000 +SHOW SESSION VARIABLES LIKE 'sort_buffer_size'; +Variable_name Value +sort_buffer_size 200000 +'' +'# MY_BOOL ' +SHOW SESSION VARIABLES LIKE 'keep_files_on_create'; +Variable_name Value +keep_files_on_create ON +SET STATEMENT keep_files_on_create=OFF +FOR SHOW SESSION VARIABLES LIKE 'keep_files_on_create'; +Variable_name Value +keep_files_on_create OFF +SHOW SESSION VARIABLES LIKE 'keep_files_on_create'; +Variable_name Value +keep_files_on_create ON +'' +'# INT/LONG ' +SHOW SESSION VARIABLES LIKE 'myisam_repair_threads'; +Variable_name Value +myisam_repair_threads 1 +SET STATEMENT myisam_repair_threads=2 +FOR SHOW SESSION VARIABLES LIKE 'myisam_repair_threads'; +Variable_name Value +myisam_repair_threads 2 +SHOW SESSION VARIABLES LIKE 'myisam_repair_threads'; +Variable_name Value +myisam_repair_threads 1 +'' +'# ULONGLONG ' +SHOW SESSION VARIABLES LIKE 'max_join_size'; +Variable_name Value +max_join_size 2222220000000 +SET STATEMENT max_join_size=2000000000000 +FOR SHOW SESSION VARIABLES LIKE 'max_join_size'; +Variable_name Value +max_join_size 2000000000000 +SHOW SESSION VARIABLES LIKE 'max_join_size'; +Variable_name Value +max_join_size 2222220000000 +'' +'#------------------Test 9-----------------------#' +'# set initial variable values +SET SESSION myisam_sort_buffer_size=500000, +myisam_repair_threads=1, +sort_buffer_size=100000, +binlog_format=mixed, +keep_files_on_create=ON, +max_join_size=2222220000000; +'' +'' +'# Pre-STATEMENT variable value +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +500000 1 100000 MIXED 1 2222220000000 +'' +'' +CREATE FUNCTION myProc (cost DECIMAL(10,2)) +RETURNS DECIMAL(10,2) +SQL SECURITY DEFINER +tax: BEGIN +DECLARE order_tax DECIMAL(10,2); +SET order_tax = cost * .05 + @@sort_buffer_size; +RETURN order_tax; +END| +'' +'# During Execution values +SET STATEMENT myisam_sort_buffer_size=400000, +myisam_repair_threads=2, +sort_buffer_size=200000, +binlog_format=row, +keep_files_on_create=OFF, +max_join_size=4444440000000 FOR +SELECT myProc(123.45); +myProc(123.45) +200006.17 +SET STATEMENT myisam_sort_buffer_size=400000, +myisam_repair_threads=2, +sort_buffer_size=300000, +binlog_format=row, +keep_files_on_create=OFF, +max_join_size=4444440000000 FOR +SELECT myProc(123.45); +myProc(123.45) +300006.17 +'' +'# Post-STATEMENT No 1 variable value Pre-STATEMENT for No 2' +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +500000 1 100000 MIXED 1 2222220000000 +'' +SET STATEMENT myisam_sort_buffer_size=400000, +myisam_repair_threads=2, +sort_buffer_size=200000, +binlog_format=row, +keep_files_on_create=OFF, +max_join_size=4444440000000 FOR +DROP FUNCTION myProc; +'' +'# Post-STATEMENT No 2 variable value +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +500000 1 100000 MIXED 1 2222220000000 +'' +'#------------------Test 11-----------------------#' +'# set initial variable values +SET SESSION myisam_sort_buffer_size=500000, +myisam_repair_threads=1, +sort_buffer_size=100000, +binlog_format=mixed, +keep_files_on_create=ON, +max_join_size=2222220000000; +'' +'' +'# Pre-STATEMENT variable value +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +500000 1 100000 MIXED 1 2222220000000 +'' +'' +SET STATEMENT myisam_sort_buffer_size=400000, +myisam_repair_threads=2, +sort_buffer_size=200000, +keep_files_on_create=OFF, +max_join_size=4444440000000 FOR +PREPARE stmt1 FROM +'SET STATEMENT binlog_format=row FOR SELECT *,@@binlog_format,@@sort_buffer_size FROM t1'; +'' +'Test No 1 Post Value & Test 2 Pre values' +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +500000 1 100000 MIXED 1 2222220000000 +'' +'' +SET STATEMENT myisam_sort_buffer_size=400000, +myisam_repair_threads=2, +sort_buffer_size=200000, +keep_files_on_create=OFF, +max_join_size=4444440000000 FOR +EXECUTE stmt1; +v1 v2 @@binlog_format @@sort_buffer_size +1 2 ROW 200000 +3 4 ROW 200000 +'' +'# Post-STATEMENT No 2 +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +500000 1 100000 MIXED 1 2222220000000 +'' +'' +'#------------------Test 12-----------------------#' +'# set initial variable values +SET SESSION myisam_sort_buffer_size=500000, +myisam_repair_threads=1, +sort_buffer_size=100000, +binlog_format=mixed, +keep_files_on_create=ON, +max_join_size=2222220000000; +'' +'' +'# Pre-STATEMENT variable value +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +500000 1 100000 MIXED 1 2222220000000 +'' +'' +SET STATEMENT myisam_sort_buffer_size=400000, +myisam_repair_threads=2, +sort_buffer_size=200000, +binlog_format=row, +keep_files_on_create=OFF, +max_join_size=4444440000000 FOR +CREATE PROCEDURE p1() BEGIN +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +END| +'' +'Test No 1 Post Value & Test 2 Pre values' +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +500000 1 100000 MIXED 1 2222220000000 +'' +'' +SET STATEMENT myisam_sort_buffer_size=400001, +myisam_repair_threads=3, +sort_buffer_size=200001, +binlog_format=row, +keep_files_on_create=OFF, +max_join_size=4444440000001 FOR +CALL p1(); +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +400001 3 200001 ROW 0 4444440000001 +'' +'# Post-STATEMENT No 2 +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +500000 1 100000 MIXED 1 2222220000000 +'' +'' +'#------------------Test 13-----------------------#' +'# set initial variable values +SET SESSION myisam_sort_buffer_size=500000, +myisam_repair_threads=1, +sort_buffer_size=100000, +binlog_format=mixed, +keep_files_on_create=ON, +max_join_size=2222220000000; +'' +'' +CREATE PROCEDURE p2() BEGIN +SET STATEMENT myisam_sort_buffer_size=400000, +myisam_repair_threads=3, +sort_buffer_size=300000, +binlog_format=mixed, +keep_files_on_create=OFF, +max_join_size=3333330000000 FOR +CALL p1(); +END| +'' +'# Pre-STATEMENT variable value +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +500000 1 100000 MIXED 1 2222220000000 +'' +'' +SET STATEMENT myisam_sort_buffer_size=400000, +myisam_repair_threads=2, +sort_buffer_size=200000, +binlog_format=row, +keep_files_on_create=OFF, +max_join_size=4444440000000 FOR +CALL p2(); +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +400000 3 300000 MIXED 0 3333330000000 +'' +'# Post-STATEMENT +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +500000 1 100000 MIXED 1 2222220000000 +'' +'' +'#------------------Test 14-----------------------#' +'# set initial variable values +SET SESSION myisam_sort_buffer_size=500000, +myisam_repair_threads=1, +sort_buffer_size=100000, +binlog_format=mixed, +keep_files_on_create=ON, +max_join_size=2222220000000; +'' +'' +CREATE PROCEDURE p3() BEGIN +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +SET STATEMENT myisam_sort_buffer_size=320000, +myisam_repair_threads=2, +sort_buffer_size=220022, +binlog_format=row, +keep_files_on_create=ON, +max_join_size=2222220000000 FOR +CALL p2(); +END| +'' +'# Pre-STATEMENT variable value +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +500000 1 100000 MIXED 1 2222220000000 +'' +'' +SET STATEMENT myisam_sort_buffer_size=400000, +myisam_repair_threads=2, +sort_buffer_size=200000, +binlog_format=row, +keep_files_on_create=OFF, +max_join_size=4444440000000 FOR +CALL p3(); +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +400000 2 200000 ROW 0 4444440000000 +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +400000 3 300000 MIXED 0 3333330000000 +'' +'# Post-STATEMENT +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +500000 1 100000 MIXED 1 2222220000000 +'' +'' +'' +'' +'#------------------Test 15-----------------------#' +'# set initial variable values +SET SESSION myisam_sort_buffer_size=500000, +myisam_repair_threads=1, +sort_buffer_size=100000, +binlog_format=mixed, +keep_files_on_create=ON, +max_join_size=2222220000000; +'' +'' +CREATE PROCEDURE p4() BEGIN +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +SET STATEMENT myisam_sort_buffer_size=320000, +myisam_repair_threads=2, +sort_buffer_size=220022, +binlog_format=row, +keep_files_on_create=ON, +max_join_size=2222220000000 FOR +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +SET STATEMENT myisam_sort_buffer_size=320000, +myisam_repair_threads=2, +sort_buffer_size=220022, +binlog_format=row, +keep_files_on_create=ON, +max_join_size=2222220000000 FOR +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +SET STATEMENT myisam_sort_buffer_size=320000, +myisam_repair_threads=2, +sort_buffer_size=220022, +binlog_format=row, +keep_files_on_create=ON, +max_join_size=2222220000000 FOR +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +END| +'' +'# Pre-STATEMENT variable value +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +500000 1 100000 MIXED 1 2222220000000 +'' +'' +SET STATEMENT myisam_sort_buffer_size=400000, +myisam_repair_threads=2, +sort_buffer_size=200000, +binlog_format=row, +keep_files_on_create=OFF, +max_join_size=4444440000000 FOR +CALL p4(); +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +400000 2 200000 ROW 0 4444440000000 +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +320000 2 220022 ROW 1 2222220000000 +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +320000 2 220022 ROW 1 2222220000000 +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +320000 2 220022 ROW 1 2222220000000 +'' +'# Post-STATEMENT +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +500000 1 100000 MIXED 1 2222220000000 +'' +'' +'#------------------Test 16-----------------------#' +'' +'# Pre-STATEMENT variable value +SELECT @@sql_mode; +@@sql_mode +NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +'' +'' +SET STATEMENT sql_mode='ansi' FOR PREPARE stmt FROM 'SELECT "t1".* FROM t1'; +execute stmt; +v1 v2 +1 2 +3 4 +ALTER TABLE t1 ADD COLUMN v3 int; +execute stmt; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '.* FROM t1' at line 1 +ALTER TABLE t1 drop COLUMN v3; +deallocate prepare stmt; +'' +'# Post-STATEMENT +SELECT @@sql_mode; +@@sql_mode +NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +check the same behaviour in normal set +SET sql_mode='ansi'; +PREPARE stmt FROM 'SELECT "t1".* FROM t1'; +SET sql_mode=default; +execute stmt; +v1 v2 +1 2 +3 4 +ALTER TABLE t1 ADD COLUMN v3 int; +execute stmt; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '.* FROM t1' at line 1 +ALTER TABLE t1 drop COLUMN v3; +deallocate prepare stmt; +SELECT @@sql_mode; +@@sql_mode +NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +SET sql_mode='ansi'; +SELECT @@sql_mode; +@@sql_mode +REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI +CREATE PROCEDURE p6() BEGIN +SELECT @@sql_mode; +SELECT "t1".* FROM t1; +END| +SET sql_mode=default; +call p6; +@@sql_mode +REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI +v1 v2 +1 2 +3 4 +ALTER TABLE t1 ADD COLUMN v3 int; +create view v1 as select * from t1; +drop view v1; +call p6; +@@sql_mode +REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI +v1 v2 v3 +1 2 NULL +3 4 NULL +ALTER TABLE t1 drop COLUMN v3; +drop procedure p6; +SELECT @@sql_mode; +@@sql_mode +NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +# SET and the statement parsed as one unit before the SET takes effect +SET STATEMENT sql_mode='ansi' FOR +CREATE PROCEDURE p6() BEGIN +SELECT @@sql_mode; +SELECT "t1".* FROM t1; +END| +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '.* FROM t1; +END' at line 4 +SELECT @@sql_mode; +@@sql_mode +NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +SET sql_mode='ansi'; +SELECT @@sql_mode; +@@sql_mode +REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI +BEGIN NOT ATOMIC +SELECT @@sql_mode; +SELECT "t1".* FROM t1; +END| +@@sql_mode +REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI +v1 v2 +1 2 +3 4 +SET sql_mode=default; +SELECT @@sql_mode; +@@sql_mode +NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +# SET and the statement parsed as one unit before the SET takes effect +SET STATEMENT sql_mode='ansi' FOR +BEGIN NOT ATOMIC +SELECT @@sql_mode; +SELECT "t1".* FROM t1; +END| +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '.* FROM t1; +END' at line 4 +SET STATEMENT sql_mode='ansi' FOR +BEGIN NOT ATOMIC +SELECT @@sql_mode; +SELECT * FROM t1; +SELECT @@sql_mode; +END| +@@sql_mode +REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI +v1 v2 +1 2 +3 4 +@@sql_mode +REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI +'' +'' +'#------------------Test 17-----------------------#' +'# set initial variable values +SET SESSION myisam_sort_buffer_size=500000, +myisam_repair_threads=1, +sort_buffer_size=100000, +binlog_format=mixed, +keep_files_on_create=ON, +max_join_size=2222220000000; +'' +'# Pre-STATEMENT variable value +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +500000 1 100000 MIXED 1 2222220000000 +'' +'' +SET STATEMENT myisam_sort_buffer_size=320000, +myisam_repair_threads=2, +sort_buffer_size=220022, +binlog_format=row, +keep_files_on_create=ON, +max_join_size=2222220000000 +FOR SET SESSION +myisam_sort_buffer_size=260000, +myisam_repair_threads=3, +sort_buffer_size=230013, +binlog_format=row, +keep_files_on_create=ON, +max_join_size=2323230000000; +'' +'# Post-STATEMENT +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +500000 1 100000 MIXED 1 2222220000000 +'' +'' +'#------------------Test 18-----------------------#' +'# set initial variable values +SET SESSION myisam_sort_buffer_size=500000, +myisam_repair_threads=1, +sort_buffer_size=100000, +binlog_format=mixed, +keep_files_on_create=ON, +max_join_size=2222220000000; +'' +'# Pre-STATEMENT variable value +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +500000 1 100000 MIXED 1 2222220000000 +'' +'' +CREATE PROCEDURE p5() BEGIN +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +SET SESSION +myisam_sort_buffer_size=260000, +myisam_repair_threads=3, +sort_buffer_size=230013, +binlog_format=row, +keep_files_on_create=ON, +max_join_size=2323230000000; +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +END| +'' +'' +SET STATEMENT myisam_sort_buffer_size=400000, +myisam_repair_threads=2, +sort_buffer_size=200000, +binlog_format=row, +keep_files_on_create=OFF, +max_join_size=4444440000000 FOR +CALL p5(); +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +400000 2 200000 ROW 0 4444440000000 +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +260000 3 230013 ROW 1 2323230000000 +'' +'# Post-STATEMENT +SELECT @@myisam_sort_buffer_size, +@@myisam_repair_threads, +@@sort_buffer_size, +@@binlog_format, +@@keep_files_on_create, +@@max_join_size; +@@myisam_sort_buffer_size @@myisam_repair_threads @@sort_buffer_size @@binlog_format @@keep_files_on_create @@max_join_size +500000 1 100000 MIXED 1 2222220000000 +'' +'' +'#------------------Test 19-----------------------#' +SET STATEMENT max_error_count=100 FOR; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 +SET STATEMENT max_error_count=100 INSERT t1 VALUES (1,2); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INSERT t1 VALUES (1,2)' at line 1 +SET STATEMENT FOR INSERT INTO t1 VALUES (1,2); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FOR INSERT INTO t1 VALUES (1,2)' at line 1 +SET max_error_count=100 FOR INSERT INTO t1 VALUES (1,2); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FOR INSERT INTO t1 VALUES (1,2)' at line 1 +SET STATEMENT GLOBAL max_error_count=100 FOR INSERT INTO t1 VALUES (1,2); +ERROR HY000: Unknown system variable 'GLOBAL' +SET STATEMENT @@global.max_error_count=100 FOR INSERT INTO t1 VALUES (1,2); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '@@global.max_error_count=100 FOR INSERT INTO t1 VALUES (1,2)' at line 1 +'' +'' +'#------------------Test 20-----------------------#' +SET STATEMENT connect_timeout=100 FOR INSERT INTO t1 VALUES (1,2); +ERROR HY000: Variable 'connect_timeout' is a GLOBAL variable and should be set with SET GLOBAL +'' +'' +'#------------------Test 21-----------------------#' +SELECT @@myisam_sort_buffer_size, @@sort_buffer_size; +@@myisam_sort_buffer_size @@sort_buffer_size +500000 100000 +SET STATEMENT myisam_sort_buffer_size = 700000, sort_buffer_size = 3000000 +FOR SET STATEMENT myisam_sort_buffer_size=200000 +FOR SELECT @@myisam_sort_buffer_size, @@sort_buffer_size; +@@myisam_sort_buffer_size @@sort_buffer_size +200000 100000 +SELECT @@myisam_sort_buffer_size, @@sort_buffer_size; +@@myisam_sort_buffer_size @@sort_buffer_size +500000 100000 +'' +'' +'#------------------Test 22-----------------------#' +CREATE TABLE STATEMENT(a INT); +DROP TABLE STATEMENT; +'' +'# Cleanup' +DROP TABLE t1; +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP PROCEDURE p3; +DROP PROCEDURE p4; +DROP PROCEDURE p5; +CREATE TABLE t1 (v1 INT, v2 INT); +insert into t1 values (1,1); +CREATE FUNCTION myProc () +RETURNS INT +SQL SECURITY DEFINER +BEGIN +DECLARE mx INT; +SET mx = (select max(v1) from t1); +RETURN mx; +END| +SET STATEMENT myisam_repair_threads=(select max(v1) from t1) FOR +select 1; +ERROR 42000: SET STATEMENT does not support subqueries or stored functions. +SET STATEMENT myisam_repair_threads=myProc() FOR +select 1; +ERROR 42000: SET STATEMENT does not support subqueries or stored functions. +drop function myProc; +drop table t1; +set session binlog_format=mixed; +PREPARE stmt1 FROM 'SELECT @@binlog_format'; +execute stmt1; +@@binlog_format +MIXED +set statement binlog_format=row for execute stmt1; +@@binlog_format +ROW +execute stmt1; +@@binlog_format +MIXED +deallocate prepare stmt1; +set statement binlog_format=row for PREPARE stmt1 FROM 'SELECT @@binlog_format'; +execute stmt1; +@@binlog_format +MIXED +execute stmt1; +@@binlog_format +MIXED +deallocate prepare stmt1; +PREPARE stmt1 FROM 'set statement binlog_format=row for SELECT @@binlog_format'; +execute stmt1; +@@binlog_format +ROW +execute stmt1; +@@binlog_format +ROW +deallocate prepare stmt1; +set session binlog_format=default; +set session binlog_format=mixed; +SET STATEMENT sort_buffer_size=150000 FOR set session binlog_format=row; +SELECT @@binlog_format; +@@binlog_format +ROW +SET @@binlog_format = @save_binlog_format; +SET @@keep_files_on_create = @save_keep_files_on_create; +SET @@max_join_size = @save_max_join_size; +SET @@myisam_repair_threads = @save_myisam_repair_threads; +SET @@myisam_sort_buffer_size = @save_myisam_sort_buffer_size; +SET @@sort_buffer_size = @save_sort_buffer_size; +#Correctly set timestamp +set session timestamp=4646464; +select @@timestamp != 4646464; +@@timestamp != 4646464 +0 +select @@timestamp != 4646464; +@@timestamp != 4646464 +0 +#Correctly returned normal behaviour +set session timestamp=default; +select @@timestamp != 4646464; +@@timestamp != 4646464 +1 +select @@timestamp != 4646464; +@@timestamp != 4646464 +1 +#here timestamp should be set only for the statement then restored default +set statement timestamp=4646464 for select @@timestamp; +@@timestamp +4646464.000000 +set @save_tm=@@timestamp; +select @@timestamp != 4646464; +@@timestamp != 4646464 +1 +select @@timestamp != 4646464; +@@timestamp != 4646464 +1 +select @@timestamp != @save_tm; +@@timestamp != @save_tm +1 +set @save_dfs=@@default_storage_engine; +SET @@default_storage_engine=MyISAM; +SET STATEMENT default_storage_engine=MEMORY for CREATE TABLE t1 (a int); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1 +select @@default_storage_engine; +@@default_storage_engine +MyISAM +drop table t1; +SET STATEMENT default_storage_engine=MyISAM for CREATE TABLE t1 (a int); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +SET @@default_storage_engine=@save_dfs; +SET STATEMENT keycache1.key_buffer_size=1024 FOR SELECT 1; +ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable and should be set with SET GLOBAL +set @save_general_log=@@global.general_log; +# SET STATEMENT works (OK) +set statement lock_wait_timeout=1 for select @@lock_wait_timeout; +@@lock_wait_timeout +1 +# Setting a totally unrelated global variable +set global general_log=0; +# SET STATEMENT should work +set statement lock_wait_timeout=1 for select @@lock_wait_timeout; +@@lock_wait_timeout +1 +set global general_log=@save_general_log; +# MDEV-7006 MDEV-7007: SET statement and slow log +set @save_long_query_time= @@long_query_time; +set @save_slow_query_log= @@slow_query_log; +set @save_log_output= @@log_output; +set statement long_query_time=default for select @@long_query_time; +@@long_query_time +10.000000 +set statement log_slow_filter=default for select @@log_slow_filter; +@@log_slow_filter +admin,filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk +set statement log_slow_verbosity=default for select @@log_slow_verbosity; +@@log_slow_verbosity + +set statement log_slow_rate_limit=default for select @@log_slow_rate_limit; +@@log_slow_rate_limit +1 +set statement slow_query_log=default for select @@slow_query_log; +@@slow_query_log +1 +truncate table mysql.slow_log; +set slow_query_log= 1; +set global log_output='TABLE'; +select sql_text from mysql.slow_log; +sql_text +set @@long_query_time=0.01; +#should be written +select sleep(0.1); +sleep(0.1) +0 +set @@long_query_time=@save_long_query_time; +select sql_text from mysql.slow_log; +sql_text +select sleep(0.1) +#--- +#should be written +set statement long_query_time=0.01 for select sleep(0.1); +sleep(0.1) +0 +select sql_text from mysql.slow_log; +sql_text +select sleep(0.1) +set statement long_query_time=0.01 for select sleep(0.1) +#--- +set @@long_query_time=0.01; +#should NOT be written +set statement slow_query_log=0 for select sleep(0.1); +sleep(0.1) +0 +set @@long_query_time=@save_long_query_time; +select sql_text from mysql.slow_log; +sql_text +select sleep(0.1) +set statement long_query_time=0.01 for select sleep(0.1) +#--- +#should NOT be written +set statement long_query_time=0.01,log_slow_filter='full_scan' for select sleep(0.1); +sleep(0.1) +0 +select sql_text from mysql.slow_log; +sql_text +select sleep(0.1) +set statement long_query_time=0.01 for select sleep(0.1) +#--- +#should NOT be written +set statement long_query_time=0.01,log_slow_rate_limit=9999 for select sleep(0.1); +sleep(0.1) +0 +select sql_text from mysql.slow_log; +sql_text +select sleep(0.1) +set statement long_query_time=0.01 for select sleep(0.1) +#--- +#should NOT be written +set statement long_query_time=0.01,min_examined_row_limit=50 for select sleep(0.1); +sleep(0.1) +0 +select sql_text from mysql.slow_log; +sql_text +select sleep(0.1) +set statement long_query_time=0.01 for select sleep(0.1) +#--- +set global log_output= @save_log_output; +set @@slow_query_log= @save_slow_query_log; +set @@long_query_time= @save_long_query_time; +truncate table mysql.slow_log; +set statement autocommit=default for select 1; +ERROR 42000: The system variable autocommit cannot be set in SET STATEMENT. +set statement tx_isolation=default for select 1; +ERROR 42000: The system variable tx_isolation cannot be set in SET STATEMENT. +set statement skip_replication=default for select 1; +ERROR 42000: The system variable skip_replication cannot be set in SET STATEMENT. +set statement sql_log_off=default for select 1; +ERROR 42000: The system variable sql_log_off cannot be set in SET STATEMENT. +set statement character_set_client=default for select 1; +ERROR 42000: The system variable character_set_client cannot be set in SET STATEMENT. +set statement character_set_connection=default for select 1; +ERROR 42000: The system variable character_set_connection cannot be set in SET STATEMENT. +set statement character_set_filesystem=default for select 1; +ERROR 42000: The system variable character_set_filesystem cannot be set in SET STATEMENT. +set statement collation_connection=default for select 1; +ERROR 42000: The system variable collation_connection cannot be set in SET STATEMENT. +set statement query_cache_type=default for select 1; +ERROR 42000: The system variable query_cache_type cannot be set in SET STATEMENT. +set statement wait_timeout=default for select 1; +ERROR 42000: The system variable wait_timeout cannot be set in SET STATEMENT. +set statement interactive_timeout=default for select 1; +ERROR 42000: The system variable interactive_timeout cannot be set in SET STATEMENT. +set @save_week_format=@@default_week_format; +set @@default_week_format=0; +SET STATEMENT default_week_format = 2 FOR SELECT WEEK('2000-01-01'); +WEEK('2000-01-01') +52 +create table t1 (a date); +insert t1 values ('2000-01-01'); +explain extended select week(a) from t1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +Warnings: +Note 1003 select week('2000-01-01',@@default_week_format) AS `week(a)` from dual +prepare stmt1 from "select week(a) from t1"; +execute stmt1; +week(a) +0 +set default_week_format = 2; +execute stmt1; +week(a) +52 +alter table t1 engine=myisam; +execute stmt1; +week(a) +52 +deallocate prepare stmt1; +drop table t1; +set @@default_week_format=@save_week_format; +set @save_old_passwords=@@old_passwords; +set @@old_passwords=0; +set statement OLD_PASSWORDS = 0 for select password('test'); +password('test') +*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 +set statement OLD_PASSWORDS = 1 for select password('test'); +password('test') +378b243e220ca493 +set statement OLD_PASSWORDS = 0 for explain extended select password('test'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select password('test') AS `password('test')` +set statement OLD_PASSWORDS = 1 for explain extended select password('test'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select password('test') AS `password('test')` +create table t1 (a char(10)); +insert t1 values ('qwertyuiop'); +prepare stmt1 from "select password(a) from t1"; +execute stmt1; +password(a) +*6063C78456BB048BAF36BE1104D12D547834DFEA +set old_passwords=1; +execute stmt1; +password(a) +2013610f6aac2950 +alter table t1 engine=myisam; +execute stmt1; +password(a) +2013610f6aac2950 +deallocate prepare stmt1; +drop table t1; +set @@old_passwords=@save_old_passwords; +# +#MDEV-6951:Erroneous SET STATEMENT produces two identical errors +# +set statement non_existing=1 for select 1; +ERROR HY000: Unknown system variable 'non_existing' +show errors; +Level Code Message +Error 1193 Unknown system variable 'non_existing' +# +# MDEV-6954: SET STATEMENT rand_seedX = ...FOR ... makes +# the next rand() to return 0 +# +set @rnd=1; +# test that rand() is not always 0 after restoring rand_seed, rand_seed2... +# @rnd should be 0 +select @rnd; +@rnd +0 diff --git a/mysql-test/r/set_statement_debug.result b/mysql-test/r/set_statement_debug.result new file mode 100644 index 00000000000..bf873a6e824 --- /dev/null +++ b/mysql-test/r/set_statement_debug.result @@ -0,0 +1,22 @@ +set @save_debug_dbug= @@debug_dbug; +set statement debug_dbug="d,something" for select @@debug_dbug; +@@debug_dbug +d,something +set @@debug_dbug= @save_debug_dbug; +CREATE TABLE t1(f0 int auto_increment primary key, f1 int); +INSERT INTO t1(f1) VALUES (0),(1),(2),(3),(4),(5); +CALL mtr.add_suppression("Out of sort memory"); +SET statement debug_dbug= '+d,alloc_sort_buffer_fail' for SELECT * FROM t1 ORDER BY f1 ASC, f0; +ERROR HY001: Out of sort memory, consider increasing server sort buffer size +SELECT * FROM t1 ORDER BY f1 ASC, f0; +f0 f1 +1 0 +2 1 +3 2 +4 3 +5 4 +6 5 +DROP TABLE t1; +set @@debug_dbug= @save_debug_dbug; +set statement DEBUG_SYNC = 'now SIGNAL hi' for select 1; +ERROR 42000: The system variable debug_sync cannot be set in SET STATEMENT. diff --git a/mysql-test/r/set_statement_notembedded.result b/mysql-test/r/set_statement_notembedded.result new file mode 100644 index 00000000000..561c30d49ac --- /dev/null +++ b/mysql-test/r/set_statement_notembedded.result @@ -0,0 +1,18 @@ +SELECT @@MAX_STATEMENT_TIME; +@@MAX_STATEMENT_TIME +0.000000 +SET STATEMENT MAX_STATEMENT_TIME=2 FOR SELECT SLEEP(1); +SLEEP(1) +0 +SHOW STATUS LIKE "max_statement_time_exceeded"; +Variable_name Value +Max_statement_time_exceeded 0 +SET STATEMENT MAX_STATEMENT_TIME=2 FOR SELECT SLEEP(3); +SLEEP(3) +1 +SHOW STATUS LIKE "max_statement_time_exceeded"; +Variable_name Value +Max_statement_time_exceeded 1 +SELECT @@MAX_STATEMENT_TIME; +@@MAX_STATEMENT_TIME +0.000000 diff --git a/mysql-test/r/set_statement_notembedded_binlog.result b/mysql-test/r/set_statement_notembedded_binlog.result new file mode 100644 index 00000000000..f23d4e97748 --- /dev/null +++ b/mysql-test/r/set_statement_notembedded_binlog.result @@ -0,0 +1,108 @@ +drop table if exists t1; +drop view if exists t1; +# +# MDEV-6948: SET STATEMENT gtid_domain_id = ... FOR has no effect +# (same for gtid_seq_no and server_id) +# +reset master; +create table t1 (i int); +set gtid_domain_id = 10; +insert into t1 values (1),(2); +set statement gtid_domain_id = 20 for insert into t1 values (3),(4); +show binlog events limit 5,5; +Log_name Pos Event_type Server_id End_log_pos Info +x x x x x BEGIN GTID 10-1-1 +x x x x x use `test`; insert into t1 values (1),(2) +x x x x x COMMIT +x x x x x BEGIN GTID 20-1-1 +x x x x x use `test`; set statement gtid_domain_id = 20 for insert into t1 values (3),(4) +drop table t1; +reset master; +SET @a=11; +create table t1 (a int not null auto_increment, c int, d int, primary key (a)); +create table t2 (b int); +insert into t2 values (1),(2); +CREATE function f1() returns int +BEGIN +SET STATEMENT last_insert_id=@a for insert into t1 values (NULL, @a, +last_insert_id()); +SET @a:=@a*100+13; +return @a; +end| +call mtr.add_suppression("Unsafe statement written to the binary log using"); +select f1() from t2; +f1() +1113 +111313 +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave. +show binlog events limit 16, 100; +Log_name Pos Event_type Server_id End_log_pos Info +x x x x x LAST_INSERT_ID=0 +x x x x x INSERT_ID=1 +x x x x x @`a`=11 +x x x x x @`a`=11 +x x x x x use `test`; SELECT `test`.`f1`() +x x x x x LAST_INSERT_ID=0 +x x x x x INSERT_ID=2 +x x x x x @`a`=1113 +x x x x x @`a`=1113 +x x x x x use `test`; SELECT `test`.`f1`() +x x x x x COMMIT +select * from t1; +a c d +1 11 11 +2 1113 1113 +drop function f1; +drop table t1,t2; +reset master; +SET @a=11; +create table t1 (a int not null auto_increment, c int, d int, primary key (a)); +create table t2 (b int); +insert into t2 values (1),(2); +CREATE function f1() returns int +BEGIN +SET @save= @@last_insert_id; +SET session last_insert_id=@a; +insert into t1 values (NULL, @a, last_insert_id()); +SET session last_insert_id=@save; +SET @a:=@a*100+13; +return @a; +end| +select f1() from t2; +f1() +1113 +111313 +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave. +show binlog events limit 13, 100; +Log_name Pos Event_type Server_id End_log_pos Info +x x x x x LAST_INSERT_ID=0 +x x x x x INSERT_ID=1 +x x x x x @`a`=11 +x x x x x @`save`=0 +x x x x x use `test`; SELECT `test`.`f1`() +x x x x x LAST_INSERT_ID=0 +x x x x x INSERT_ID=2 +x x x x x @`a`=1113 +x x x x x @`save`=0 +x x x x x use `test`; SELECT `test`.`f1`() +x x x x x COMMIT +select * from t1; +a c d +1 11 11 +2 1113 1113 +drop function f1; +drop table t1,t2; +reset master; +set statement last_insert_id = 112 for create table t1 as select last_insert_id(); +show binlog events limit 4,1; +Log_name Pos Event_type Server_id End_log_pos Info +x x x x x LAST_INSERT_ID=112 +drop table t1; diff --git a/mysql-test/r/set_statement_profiling.result b/mysql-test/r/set_statement_profiling.result new file mode 100644 index 00000000000..1f17c345680 --- /dev/null +++ b/mysql-test/r/set_statement_profiling.result @@ -0,0 +1,4 @@ +set statement profiling=default for select 1; +ERROR 42000: The system variable profiling cannot be set in SET STATEMENT. +set statement profiling_history_size=default for select 1; +ERROR 42000: The system variable profiling_history_size cannot be set in SET STATEMENT. diff --git a/mysql-test/r/show.result b/mysql-test/r/show.result new file mode 100644 index 00000000000..3dd7af5de05 --- /dev/null +++ b/mysql-test/r/show.result @@ -0,0 +1,12 @@ +show statistics; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'statistics' at line 1 +show spatial_ref_sys +--error ER_PARSE_ERROR +show system_variables; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'spatial_ref_sys +--error ER_PARSE_ERROR +show system_variables' at line 2 +show geometry_columns; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'geometry_columns' at line 1 +show nonexistent; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'nonexistent' at line 1 diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 880c424391e..654b00d68ae 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -100,20 +100,20 @@ drop table t1; -- after Bug#29394 is implemented. show variables like "wait_timeout%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema VARIABLES VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 -def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 1024 5 Y 0 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 5 N 1 0 8 Variable_name Value wait_timeout 28800 show variables like "WAIT_timeout%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema VARIABLES VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 -def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 1024 5 Y 0 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 5 N 1 0 8 Variable_name Value wait_timeout 28800 show variables like "this_doesn't_exists%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema VARIABLES VARIABLES VARIABLE_NAME Variable_name 253 64 0 N 1 0 8 -def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 1024 0 Y 0 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 0 N 1 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 0 N 1 0 8 Variable_name Value show table status from test like "this_doesn't_exists%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -133,7 +133,7 @@ def information_schema TABLES TABLES UPDATE_TIME Update_time 12 19 0 Y 128 0 63 def information_schema TABLES TABLES CHECK_TIME Check_time 12 19 0 Y 128 0 63 def information_schema TABLES TABLES TABLE_COLLATION Collation 253 32 0 Y 0 0 8 def information_schema TABLES TABLES CHECKSUM Checksum 8 21 0 Y 32800 0 63 -def information_schema TABLES TABLES CREATE_OPTIONS Create_options 253 255 0 Y 0 0 8 +def information_schema TABLES TABLES CREATE_OPTIONS Create_options 253 2048 0 Y 0 0 8 def information_schema TABLES TABLES TABLE_COMMENT Comment 253 2048 0 N 1 0 8 Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment show databases; @@ -259,8 +259,8 @@ create table t1(n int); insert into t1 values (1); show open tables; Database Table In_use Name_locked -test t1 0 0 mysql general_log 0 0 +test t1 0 0 drop table t1; create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed; show create table t1; @@ -316,7 +316,7 @@ type_numeric numeric(5,2), empty_char char(0), type_char char(2), type_varchar varchar(10), -type_timestamp timestamp not null, +type_timestamp timestamp not null default current_timestamp on update current_timestamp, type_date date not null default '0000-00-00', type_time time not null default '00:00:00', type_datetime datetime not null default '0000-00-00 00:00:00', @@ -518,8 +518,11 @@ Database Create Database mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */ create table mysqltest.t1(a int); insert into mysqltest.t1 values(1); +create user mysqltest_1@localhost; grant select on `mysqltest`.* to mysqltest_1@localhost; +create user mysqltest_2@localhost; grant usage on `mysqltest`.* to mysqltest_2@localhost; +create user mysqltest_3@localhost; grant drop on `mysqltest`.* to mysqltest_3@localhost; select * from t1; a @@ -932,7 +935,7 @@ def information_schema TABLES TABLES TABLE_TYPE TABLE_TYPE 253 192 10 N 1 0 33 def information_schema TABLES TABLES ENGINE ENGINE 253 192 6 Y 0 0 33 def information_schema TABLES TABLES ROW_FORMAT ROW_FORMAT 253 30 5 Y 0 0 33 def information_schema TABLES TABLES TABLE_COLLATION TABLE_COLLATION 253 96 17 Y 0 0 33 -def information_schema TABLES TABLES CREATE_OPTIONS CREATE_OPTIONS 253 765 0 Y 0 0 33 +def information_schema TABLES TABLES CREATE_OPTIONS CREATE_OPTIONS 253 6144 0 Y 0 0 33 def information_schema TABLES TABLES TABLE_COMMENT TABLE_COMMENT 253 6144 0 N 1 0 33 TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_COLLATION CREATE_OPTIONS TABLE_COMMENT def test t1 BASE TABLE MyISAM Fixed latin1_swedish_ci @@ -997,13 +1000,13 @@ def information_schema TRIGGERS TRIGGERS EVENT_OBJECT_TABLE Table 253 192 2 N 1 def information_schema TRIGGERS TRIGGERS ACTION_STATEMENT Statement 252 589815 10 N 17 0 33 def information_schema TRIGGERS TRIGGERS ACTION_TIMING Timing 253 18 6 N 1 0 33 def information_schema TRIGGERS TRIGGERS CREATED Created 12 19 0 Y 128 0 63 -def information_schema TRIGGERS TRIGGERS SQL_MODE sql_mode 253 24576 0 N 1 0 33 +def information_schema TRIGGERS TRIGGERS SQL_MODE sql_mode 253 24576 42 N 1 0 33 def information_schema TRIGGERS TRIGGERS DEFINER Definer 253 567 14 N 1 0 33 def information_schema TRIGGERS TRIGGERS CHARACTER_SET_CLIENT character_set_client 253 96 6 N 1 0 33 def information_schema TRIGGERS TRIGGERS COLLATION_CONNECTION collation_connection 253 96 6 N 1 0 33 def information_schema TRIGGERS TRIGGERS DATABASE_COLLATION Database Collation 253 96 17 N 1 0 33 Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation -t1_bi INSERT t1 SET @a = 1 BEFORE NULL root@localhost binary binary latin1_swedish_ci +t1_bi INSERT t1 SET @a = 1 BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost binary binary latin1_swedish_ci ---------------------------------------------------------------- SELECT TRIGGER_CATALOG, @@ -1041,10 +1044,10 @@ def information_schema TRIGGERS TRIGGERS ACTION_REFERENCE_OLD_TABLE ACTION_REFER def information_schema TRIGGERS TRIGGERS ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_NEW_TABLE 253 192 0 Y 0 0 33 def information_schema TRIGGERS TRIGGERS ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_OLD_ROW 253 9 3 N 1 0 33 def information_schema TRIGGERS TRIGGERS ACTION_REFERENCE_NEW_ROW ACTION_REFERENCE_NEW_ROW 253 9 3 N 1 0 33 -def information_schema TRIGGERS TRIGGERS SQL_MODE SQL_MODE 253 24576 0 N 1 0 33 +def information_schema TRIGGERS TRIGGERS SQL_MODE SQL_MODE 253 24576 42 N 1 0 33 def information_schema TRIGGERS TRIGGERS DEFINER DEFINER 253 567 14 N 1 0 33 TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW SQL_MODE DEFINER -def test t1_bi INSERT def test t1 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW root@localhost +def test t1_bi INSERT def test t1 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost ---------------------------------------------------------------- SHOW CREATE VIEW v1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -1069,19 +1072,20 @@ def information_schema VIEWS VIEWS DEFINER DEFINER 253 567 14 N 1 0 33 def information_schema VIEWS VIEWS SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33 def information_schema VIEWS VIEWS CHARACTER_SET_CLIENT CHARACTER_SET_CLIENT 253 96 6 N 1 0 33 def information_schema VIEWS VIEWS COLLATION_CONNECTION COLLATION_CONNECTION 253 96 6 N 1 0 33 -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -def test v1 select 1 AS `1` NONE NO root@localhost DEFINER binary binary +def information_schema VIEWS VIEWS ALGORITHM ALGORITHM 253 30 9 N 1 0 33 +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def test v1 select 1 AS `1` NONE NO root@localhost DEFINER binary binary UNDEFINED ---------------------------------------------------------------- SHOW CREATE PROCEDURE p1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def Procedure 253 192 2 N 1 31 33 -def sql_mode 253 0 0 N 1 31 33 +def sql_mode 253 126 42 N 1 31 33 def Create Procedure 253 3072 59 Y 0 31 33 def character_set_client 253 96 6 N 1 31 33 def collation_connection 253 96 6 N 1 31 33 def Database Collation 253 96 17 N 1 31 33 Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() +p1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() SELECT 1 binary binary latin1_swedish_ci ---------------------------------------------------------------- SELECT @@ -1121,22 +1125,22 @@ def information_schema ROUTINES ROUTINES IS_DETERMINISTIC IS_DETERMINISTIC 253 9 def information_schema ROUTINES ROUTINES SQL_DATA_ACCESS SQL_DATA_ACCESS 253 192 12 N 1 0 33 def information_schema ROUTINES ROUTINES SQL_PATH SQL_PATH 253 192 0 Y 0 0 33 def information_schema ROUTINES ROUTINES SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33 -def information_schema ROUTINES ROUTINES SQL_MODE SQL_MODE 253 24576 0 N 1 0 33 +def information_schema ROUTINES ROUTINES SQL_MODE SQL_MODE 253 24576 42 N 1 0 33 def information_schema ROUTINES ROUTINES ROUTINE_COMMENT ROUTINE_COMMENT 252 589815 0 N 17 0 33 def information_schema ROUTINES ROUTINES DEFINER DEFINER 253 567 14 N 1 0 33 SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE SQL_MODE ROUTINE_COMMENT DEFINER -p1 def test p1 PROCEDURE NULL SQL SELECT 1 NULL NULL SQL NO CONTAINS SQL NULL DEFINER root@localhost +p1 def test p1 PROCEDURE NULL SQL SELECT 1 NULL NULL SQL NO CONTAINS SQL NULL DEFINER NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost ---------------------------------------------------------------- SHOW CREATE FUNCTION f1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def Function 253 192 2 N 1 31 33 -def sql_mode 253 0 0 N 1 31 33 +def sql_mode 253 126 42 N 1 31 33 def Create Function 253 3072 74 Y 0 31 33 def character_set_client 253 96 6 N 1 31 33 def collation_connection 253 96 6 N 1 31 33 def Database Collation 253 96 17 N 1 31 33 Function sql_mode Create Function character_set_client collation_connection Database Collation -f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) +f1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) RETURN 1 binary binary latin1_swedish_ci ---------------------------------------------------------------- SELECT @@ -1176,11 +1180,11 @@ def information_schema ROUTINES ROUTINES IS_DETERMINISTIC IS_DETERMINISTIC 253 9 def information_schema ROUTINES ROUTINES SQL_DATA_ACCESS SQL_DATA_ACCESS 253 192 12 N 1 0 33 def information_schema ROUTINES ROUTINES SQL_PATH SQL_PATH 253 192 0 Y 0 0 33 def information_schema ROUTINES ROUTINES SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33 -def information_schema ROUTINES ROUTINES SQL_MODE SQL_MODE 253 24576 0 N 1 0 33 +def information_schema ROUTINES ROUTINES SQL_MODE SQL_MODE 253 24576 42 N 1 0 33 def information_schema ROUTINES ROUTINES ROUTINE_COMMENT ROUTINE_COMMENT 252 589815 0 N 17 0 33 def information_schema ROUTINES ROUTINES DEFINER DEFINER 253 567 14 N 1 0 33 SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE SQL_MODE ROUTINE_COMMENT DEFINER -f1 def test f1 FUNCTION int(11) SQL RETURN 1 NULL NULL SQL NO CONTAINS SQL NULL DEFINER root@localhost +f1 def test f1 FUNCTION int(11) SQL RETURN 1 NULL NULL SQL NO CONTAINS SQL NULL DEFINER NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost ---------------------------------------------------------------- DROP DATABASE mysqltest1; DROP TABLE t1; @@ -1278,6 +1282,7 @@ Database Create Database mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */ create table mysqltest.t1(a int); insert into mysqltest.t1 values(1); +create user mysqltest_4@localhost; grant select on `mysqltest`.`t1` to mysqltest_4@localhost; show create database mysqltest; Database Create Database @@ -1345,69 +1350,69 @@ CREATE TABLE t1(c1 INT); CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1; SHOW CREATE TRIGGER t1_bi; Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci CREATE PROCEDURE p1() SHOW CREATE TRIGGER t1_bi; CALL p1(); Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci CALL p1(); Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci CALL p1(); Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci CALL p1(); Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci CALL p1(); Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci CALL p1(); Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci CALL p1(); Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci CALL p1(); Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci CALL p1(); Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci CALL p1(); Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci PREPARE stmt1 FROM 'SHOW CREATE TRIGGER t1_bi'; EXECUTE stmt1; Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci EXECUTE stmt1; Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci EXECUTE stmt1; Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci EXECUTE stmt1; Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci EXECUTE stmt1; Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci EXECUTE stmt1; Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci EXECUTE stmt1; Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci EXECUTE stmt1; Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci EXECUTE stmt1; Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci EXECUTE stmt1; Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci DROP TABLE t1; DROP PROCEDURE p1; DEALLOCATE PREPARE stmt1; @@ -1431,20 +1436,20 @@ View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'теÑÑ‚' AS `test` koi8r koi8r_general_ci SHOW CREATE PROCEDURE p1; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() +p1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() SELECT 'теÑÑ‚' AS test koi8r koi8r_general_ci latin1_swedish_ci SHOW CREATE FUNCTION f1; Function sql_mode Create Function character_set_client collation_connection Database Collation -f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS char(10) CHARSET latin1 +f1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS char(10) CHARSET latin1 RETURN 'теÑÑ‚' koi8r koi8r_general_ci latin1_swedish_ci SHOW CREATE TRIGGER t1_bi; Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET NEW.c1 = 'теÑÑ‚' koi8r koi8r_general_ci latin1_swedish_ci SHOW CREATE EVENT ev1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 'теÑÑ‚' AS test koi8r koi8r_general_ci latin1_swedish_ci +ev1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 'теÑÑ‚' AS test koi8r koi8r_general_ci latin1_swedish_ci DROP VIEW v1; DROP PROCEDURE p1; DROP FUNCTION f1; @@ -1507,7 +1512,7 @@ LOCK TABLE t1 WRITE; # Connection default SHOW CREATE TRIGGER t1_bi; Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1 utf8 utf8_general_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1 utf8 utf8_general_ci latin1_swedish_ci # Connection con1 UNLOCK TABLES; # Test 2: ALTER TABLE with SHOW CREATE TRIGGER in transaction @@ -1515,7 +1520,7 @@ UNLOCK TABLES; START TRANSACTION; SHOW CREATE TRIGGER t1_bi; Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1 utf8 utf8_general_ci latin1_swedish_ci +t1_bi NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1 utf8 utf8_general_ci latin1_swedish_ci # Connection con1 ALTER TABLE t1 CHARACTER SET = utf8; # Connection default diff --git a/mysql-test/r/show_explain.result b/mysql-test/r/show_explain.result index a4d12ce05ce..0dc6f2b28ac 100644 --- a/mysql-test/r/show_explain.result +++ b/mysql-test/r/show_explain.result @@ -641,7 +641,7 @@ set debug_dbug='+d,show_explain_probe_join_exec_start'; SHOW INDEX FROM t1; show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE STATISTICS ALL NULL NULL NULL NULL NULL Skip_open_table; Scanned all databases +1 SIMPLE STATISTICS ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL Open_full_table; Scanned 0 databases Warnings: Note 1003 SHOW INDEX FROM t1 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment @@ -782,6 +782,7 @@ drop table t1,t3,t4; # # ---------- SHOW EXPLAIN and permissions ----------------- # +create user test2@localhost; grant ALL on test.* to test2@localhost; grant super on *.* to test2@localhost; # @@ -1036,7 +1037,7 @@ explain SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 system NULL NULL NULL NULL 1 -1 SIMPLE t1 index b b 6 NULL 107 Using where; Using index +1 SIMPLE t1 range b b 6 NULL 107 Using where; Using index 1 SIMPLE t3 ref PRIMARY PRIMARY 5 test.t1.b 1 Using index set @show_explain_probe_select_id=1; set debug_dbug='+d,show_explain_probe_do_select'; @@ -1044,7 +1045,7 @@ SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, fie show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 system NULL NULL NULL NULL 1 Using filesort -1 SIMPLE t1 index b b 6 NULL 107 Using where; Using index +1 SIMPLE t1 range b b 6 NULL 107 Using where; Using index 1 SIMPLE t3 ref PRIMARY PRIMARY 5 test.t1.b 1 Using index Warnings: Note 1003 SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2 diff --git a/mysql-test/r/show_grants_with_plugin-7985.result b/mysql-test/r/show_grants_with_plugin-7985.result index 1898c316ac5..81880e5cc40 100644 --- a/mysql-test/r/show_grants_with_plugin-7985.result +++ b/mysql-test/r/show_grants_with_plugin-7985.result @@ -7,7 +7,7 @@ create user u1; GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password; select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; user host password plugin authentication_string -u1 % mysql_native_password +u1 % # # The user's grants should show no password at all. # @@ -43,7 +43,7 @@ GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626'; select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; user host password plugin authentication_string -u1 % mysql_native_password *7AFEFD08B6B720E781FB000CAA418F54FA662626 +u1 % *7AFEFD08B6B720E781FB000CAA418F54FA662626 # # Test to see if connecting with password is succesful. # @@ -169,10 +169,10 @@ connection default; # # Clear all passwords from the user. # -GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password; +set password for u1 = ''; select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; user host password plugin authentication_string -u1 % mysql_native_password +u1 % # # Test no password connect. # diff --git a/mysql-test/r/single_delete_update.result b/mysql-test/r/single_delete_update.result index 9332effeb56..cdf97e20238 100644 --- a/mysql-test/r/single_delete_update.result +++ b/mysql-test/r/single_delete_update.result @@ -1166,35 +1166,3 @@ a b c 25 25 10 25 25 10 DROP TABLE t1, t2; -# -# Bug #53742: UPDATEs have no effect after applying patch for bug 36569 -# -CREATE TABLE t1 ( -pk INT NOT NULL AUTO_INCREMENT, -c1_idx CHAR(1) DEFAULT 'y', -c2 INT, -PRIMARY KEY (pk), -INDEX c1_idx (c1_idx) -) ENGINE=InnoDB; -INSERT INTO t1 VALUES (), (), (), (); -SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; -pk c1_idx c2 -4 y NULL -3 y NULL -UPDATE t1 SET c2 = 0 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; -SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; -pk c1_idx c2 -4 y 0 -3 y 0 -SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC; -pk c1_idx c2 -4 y 0 -3 y 0 -2 y NULL -1 y NULL -DELETE FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; -SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC; -pk c1_idx c2 -2 y NULL -1 y NULL -DROP TABLE t1; diff --git a/mysql-test/r/single_delete_update_innodb.result b/mysql-test/r/single_delete_update_innodb.result new file mode 100644 index 00000000000..aca40974054 --- /dev/null +++ b/mysql-test/r/single_delete_update_innodb.result @@ -0,0 +1,32 @@ +# +# Bug #53742: UPDATEs have no effect after applying patch for bug 36569 +# +CREATE TABLE t1 ( +pk INT NOT NULL AUTO_INCREMENT, +c1_idx CHAR(1) DEFAULT 'y', +c2 INT, +PRIMARY KEY (pk), +INDEX c1_idx (c1_idx) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES (), (), (), (); +SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; +pk c1_idx c2 +4 y NULL +3 y NULL +UPDATE t1 SET c2 = 0 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; +SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; +pk c1_idx c2 +4 y 0 +3 y 0 +SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC; +pk c1_idx c2 +4 y 0 +3 y 0 +2 y NULL +1 y NULL +DELETE FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; +SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC; +pk c1_idx c2 +2 y NULL +1 y NULL +DROP TABLE t1; diff --git a/mysql-test/r/skip_grants.result b/mysql-test/r/skip_grants.result index 75792a15afa..b167a197e50 100644 --- a/mysql-test/r/skip_grants.result +++ b/mysql-test/r/skip_grants.result @@ -39,11 +39,11 @@ View Create View character_set_client collation_connection v3 CREATE ALGORITHM=UNDEFINED DEFINER=`a`@`%` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`c` AS `c` from `t1` latin1 latin1_swedish_ci SHOW CREATE PROCEDURE p3; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p3 CREATE DEFINER=`a`@`%` PROCEDURE `p3`() +p3 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`a`@`%` PROCEDURE `p3`() SELECT 3 latin1 latin1_swedish_ci latin1_swedish_ci SHOW CREATE FUNCTION f3; Function sql_mode Create Function character_set_client collation_connection Database Collation -f3 CREATE DEFINER=`a`@`%` FUNCTION `f3`() RETURNS int(11) +f3 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`a`@`%` FUNCTION `f3`() RETURNS int(11) RETURN 3 latin1 latin1_swedish_ci latin1_swedish_ci DROP TRIGGER t1_bi; DROP TRIGGER ti_ai; @@ -82,3 +82,14 @@ End of 5.0 tests select no_such_function(1); ERROR 42000: FUNCTION test.no_such_function does not exist End of 5.1 tests +show global status like 'Acl%'; +Variable_name Value +Acl_column_grants 0 +Acl_database_grants 0 +Acl_function_grants 0 +Acl_procedure_grants 0 +Acl_proxy_users 0 +Acl_role_grants 0 +Acl_roles 0 +Acl_table_grants 0 +Acl_users 0 diff --git a/mysql-test/r/skip_name_resolve.result b/mysql-test/r/skip_name_resolve.result index 1d92d52110d..b2230ccbd91 100644 --- a/mysql-test/r/skip_name_resolve.result +++ b/mysql-test/r/skip_name_resolve.result @@ -1,3 +1,4 @@ +CREATE USER mysqltest_1@'127.0.0.1/255.255.255.255'; GRANT ALL ON test.* TO mysqltest_1@'127.0.0.1/255.255.255.255'; SHOW GRANTS FOR mysqltest_1@'127.0.0.1/255.255.255.255'; Grants for mysqltest_1@127.0.0.1/255.255.255.255 diff --git a/mysql-test/r/sp-destruct.result b/mysql-test/r/sp-destruct.result index 81c0adb36cc..0eddfa70dd1 100644 --- a/mysql-test/r/sp-destruct.result +++ b/mysql-test/r/sp-destruct.result @@ -128,11 +128,8 @@ CREATE FUNCTION f1() RETURNS INT RETURN 1; RENAME TABLE mysql.procs_priv TO procs_priv_backup; FLUSH TABLE mysql.procs_priv; DROP FUNCTION f1; -ERROR 42S02: Table 'mysql.procs_priv' doesn't exist SHOW WARNINGS; Level Code Message -Error 1146 Table 'mysql.procs_priv' doesn't exist -Warning 1405 Failed to revoke all privileges to dropped routine # Restore the procs_priv table RENAME TABLE procs_priv_backup TO mysql.procs_priv; FLUSH TABLE mysql.procs_priv; diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 71fab8c9654..1f38e3888a0 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -1223,9 +1223,7 @@ END' at line 1 CREATE PROCEDURE IF NOT EXISTS bug14702() BEGIN END; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'IF NOT EXISTS bug14702() -BEGIN -END' at line 1 +DROP PROCEDURE IF EXISTS bug14702; DROP TABLE IF EXISTS t1; CREATE TABLE t1 (i INT); CREATE PROCEDURE bug20953() CREATE VIEW v AS SELECT 1 INTO @a; @@ -1411,7 +1409,7 @@ end| ERROR 0A000: Not allowed to return a result set from a function drop function if exists bug20701; create function bug20701() returns varchar(25) binary return "test"; -ERROR 42000: This version of MariaDB doesn't yet support 'return value collation' +drop function bug20701; create function bug20701() returns varchar(25) return "test"; drop function bug20701; create procedure proc_26503_error_1() @@ -1760,7 +1758,7 @@ CAST('10 ' as unsigned integer) CAST('10 ' as unsigned integer) 10 Warnings: -Warning 1292 Truncated incorrect INTEGER value: '10 ' +Note 1292 Truncated incorrect INTEGER value: '10 ' DROP PROCEDURE p1; DROP PROCEDURE p2; @@ -1769,7 +1767,7 @@ DROP PROCEDURE p2; CREATE PROCEDURE p1() BEGIN DECLARE c INT DEFAULT 0; -DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1; +DECLARE CONTINUE HANDLER FOR SQLSTATE '22007' SET c = c + 1; CALL p2(); CALL p3(); CALL p4(); @@ -1799,7 +1797,7 @@ END| CREATE PROCEDURE P6() BEGIN DECLARE c INT DEFAULT 0; -DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1; +DECLARE CONTINUE HANDLER FOR SQLSTATE '22007' SET c = c + 1; CALL p5(); SELECT c; END| @@ -1823,7 +1821,7 @@ CALL p6(); CAST('10 ' as unsigned integer) 10 Level Code Message -Warning 1292 Truncated incorrect INTEGER value: '10 ' +Note 1292 Truncated incorrect INTEGER value: '10 ' c 1 DROP PROCEDURE p1; @@ -1984,9 +1982,9 @@ Level Code Message Warning 1264 Out of range value for column 'x' at row 1 Warning 1264 Out of range value for column 'y' at row 1 Warning 1264 Out of range value for column 'z' at row 1 -Warning 1292 Truncated incorrect INTEGER value: '111111 ' +Note 1292 Truncated incorrect INTEGER value: '111111 ' Warning 1264 Out of range value for column 'a' at row 1 -Warning 1292 Truncated incorrect INTEGER value: '222222 ' +Note 1292 Truncated incorrect INTEGER value: '222222 ' Warning 1264 Out of range value for column 'b' at row 1 Error 1048 Column 'c' cannot be null @@ -2746,14 +2744,14 @@ END| CALL p6()| Level Code Message -Warning 1292 Truncated incorrect INTEGER value: '1 ' -Warning 1292 Truncated incorrect INTEGER value: '1999999 ' +Note 1292 Truncated incorrect INTEGER value: '1 ' +Note 1292 Truncated incorrect INTEGER value: '1999999 ' Warning 1264 Out of range value for column 'a' at row 1 -Warning 1292 Truncated incorrect INTEGER value: '2 ' -Warning 1292 Truncated incorrect INTEGER value: '2999999 ' +Note 1292 Truncated incorrect INTEGER value: '2 ' +Note 1292 Truncated incorrect INTEGER value: '2999999 ' Warning 1264 Out of range value for column 'b' at row 1 -Warning 1292 Truncated incorrect INTEGER value: '3 ' -Warning 1292 Truncated incorrect INTEGER value: '3999999 ' +Note 1292 Truncated incorrect INTEGER value: '3 ' +Note 1292 Truncated incorrect INTEGER value: '3999999 ' Warning 1264 Out of range value for column 'c' at row 1 Msg Handler for 1292 diff --git a/mysql-test/r/sp-lock.result b/mysql-test/r/sp-lock.result index 860312dca3e..49ff0c7ba58 100644 --- a/mysql-test/r/sp-lock.result +++ b/mysql-test/r/sp-lock.result @@ -725,7 +725,7 @@ release_lock("test") get_lock("test", 10) 1 Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() +p1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() BEGIN SELECT get_lock("test", 10); SHOW CREATE PROCEDURE p1; diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result index e8c3fbff0e3..276da41a0fe 100644 --- a/mysql-test/r/sp-security.result +++ b/mysql-test/r/sp-security.result @@ -1,4 +1,5 @@ use test; +create user user1@localhost; grant usage on *.* to user1@localhost; flush privileges; drop table if exists t1; @@ -31,10 +32,13 @@ root@localhost 1 select db(); db() test +create user user1@'%'; grant execute on procedure db1_secret.stamp to user1@'%'; grant execute on function db1_secret.db to user1@'%'; +set sql_mode=''; grant execute on procedure db1_secret.stamp to ''@'%'; grant execute on function db1_secret.db to ''@'%'; +set sql_mode=default; call db1_secret.stamp(2); select db1_secret.db(); db1_secret.db() @@ -103,6 +107,7 @@ create table t2 (s1 int); insert into t2 values (0); grant usage on db2.* to user1@localhost; grant select on db2.* to user1@localhost; +create user user2@localhost; grant usage on db2.* to user2@localhost; grant select,insert,update,delete,create routine on db2.* to user2@localhost; grant create routine on db2.* to user1@localhost; @@ -156,8 +161,11 @@ delete from mysql.procs_priv where user='user1' or user='user2'; delete from mysql.procs_priv where user='' and host='%'; delete from mysql.db where user='user2'; flush privileges; +create user usera@localhost; grant usage on *.* to usera@localhost; +create user userb@localhost; grant usage on *.* to userb@localhost; +create user userc@localhost; grant usage on *.* to userc@localhost; create database sptest; create table t1 ( u varchar(64), i int ); @@ -220,9 +228,11 @@ delete from mysql.tables_priv where user='usera'; flush privileges; drop table t1; drop function if exists bug_9503; +drop user if exists user1@localhost; create database mysqltest// use mysqltest// create table t1 (s1 int)// +create user user1@localhost// grant select on t1 to user1@localhost// create function bug_9503 () returns int sql security invoker begin declare v int; select min(s1) into v from t1; return v; end// @@ -266,6 +276,7 @@ create procedure mysqltest_1.p1() begin select 1 from dual; end// +create user mysqltest_1@localhost; grant usage on *.* to mysqltest_1@localhost; call mysqltest_1.p1(); ERROR 42000: execute command denied to user 'mysqltest_1'@'localhost' for routine 'mysqltest_1.p1' @@ -366,19 +377,19 @@ Note 1449 The user specified as a definer ('a @ b @ c'@'localhost') does not exi USE mysqltest; SHOW CREATE PROCEDURE wl2897_p1; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -wl2897_p1 CREATE DEFINER=`mysqltest_2`@`localhost` PROCEDURE `wl2897_p1`() +wl2897_p1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`mysqltest_2`@`localhost` PROCEDURE `wl2897_p1`() SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci SHOW CREATE PROCEDURE wl2897_p3; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -wl2897_p3 CREATE DEFINER=`a @ b @ c`@`localhost` PROCEDURE `wl2897_p3`() +wl2897_p3 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`a @ b @ c`@`localhost` PROCEDURE `wl2897_p3`() SELECT 3 latin1 latin1_swedish_ci latin1_swedish_ci SHOW CREATE FUNCTION wl2897_f1; Function sql_mode Create Function character_set_client collation_connection Database Collation -wl2897_f1 CREATE DEFINER=`mysqltest_2`@`localhost` FUNCTION `wl2897_f1`() RETURNS int(11) +wl2897_f1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`mysqltest_2`@`localhost` FUNCTION `wl2897_f1`() RETURNS int(11) RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci SHOW CREATE FUNCTION wl2897_f3; Function sql_mode Create Function character_set_client collation_connection Database Collation -wl2897_f3 CREATE DEFINER=`a @ b @ c`@`localhost` FUNCTION `wl2897_f3`() RETURNS int(11) +wl2897_f3 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`a @ b @ c`@`localhost` FUNCTION `wl2897_f3`() RETURNS int(11) RETURN 3 latin1 latin1_swedish_ci latin1_swedish_ci DROP USER mysqltest_1@localhost; DROP USER mysqltest_2@localhost; @@ -444,7 +455,7 @@ SELECT a; END // SHOW CREATE PROCEDURE test.sp19857; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -sp19857 CREATE DEFINER=`user19857`@`localhost` PROCEDURE `sp19857`() +sp19857 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user19857`@`localhost` PROCEDURE `sp19857`() DETERMINISTIC BEGIN DECLARE a INT; @@ -612,7 +623,7 @@ GRANT SELECT ON mysql.proc TO user2@localhost; # This should work SHOW CREATE PROCEDURE db1.p1; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() +p1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci # Connection default DROP USER user2@localhost; @@ -647,3 +658,17 @@ ERROR 42000: execute command denied to user 'bug12602983_user'@'localhost' for r # Connection 'default'. drop user bug12602983_user@localhost; drop database mysqltest_db; +set password=password('foobar'); +create procedure sp1() select 1; +show grants; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*9B500343BC52E2911172EB52AE5CF4847604C6E5' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION +grant execute on procedure sp1 to current_user() identified by 'barfoo'; +show grants; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*343915A8181B5728EADBDC73E1F7E6B0C3998483' WITH GRANT OPTION +GRANT EXECUTE ON PROCEDURE `test`.`sp1` TO 'root'@'localhost' +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION +drop procedure sp1; +set password=''; diff --git a/mysql-test/r/sp-ucs2.result b/mysql-test/r/sp-ucs2.result index 605fe4ed151..3c444ad97de 100644 --- a/mysql-test/r/sp-ucs2.result +++ b/mysql-test/r/sp-ucs2.result @@ -40,7 +40,7 @@ BEGIN RETURN ''; END| Function sql_mode Create Function character_set_client collation_connection Database Collation -f CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET ucs2 COLLATE ucs2_bin +f NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET ucs2 COLLATE ucs2_bin BEGIN RETURN ''; END latin1 latin1_swedish_ci latin1_swedish_ci @@ -55,7 +55,7 @@ BEGIN RETURN ''; END| Function sql_mode Create Function character_set_client collation_connection Database Collation -f CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET ucs2 COLLATE ucs2_bin +f NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET ucs2 COLLATE ucs2_bin BEGIN RETURN ''; END latin1 latin1_swedish_ci latin1_swedish_ci @@ -67,7 +67,7 @@ BEGIN RETURN ''; END| Function sql_mode Create Function character_set_client collation_connection Database Collation -f CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET latin1 COLLATE latin1_bin +f NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET latin1 COLLATE latin1_bin BEGIN RETURN ''; END latin1 latin1_swedish_ci latin1_swedish_ci @@ -83,7 +83,7 @@ SET f2= f1; SET f2= concat(collation(f1), ' ', collation(f2)); END| Function sql_mode Create Function character_set_client collation_connection Database Collation -f CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET latin1 COLLATE latin1_bin +f NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS varchar(64) CHARSET latin1 COLLATE latin1_bin BEGIN RETURN ''; END latin1 latin1_swedish_ci latin1_swedish_ci @@ -106,20 +106,20 @@ RETURNS VARCHAR(64) CHARACTER SET ucs2 BEGIN RETURN 'str'; END| -ERROR 42000: This version of MariaDB doesn't yet support 'COLLATE with no CHARACTER SET in SP parameters, RETURNS, DECLARE' +ERROR 42000: COLLATION 'ucs2_unicode_ci' is not valid for CHARACTER SET 'latin1' CREATE FUNCTION f(f1 VARCHAR(64) CHARACTER SET ucs2) RETURNS VARCHAR(64) COLLATE ucs2_unicode_ci BEGIN RETURN 'str'; END| -ERROR 42000: This version of MariaDB doesn't yet support 'COLLATE with no CHARACTER SET in SP parameters, RETURNS, DECLARE' +ERROR 42000: COLLATION 'ucs2_unicode_ci' is not valid for CHARACTER SET 'latin1' CREATE FUNCTION f(f1 VARCHAR(64) CHARACTER SET ucs2) RETURNS VARCHAR(64) CHARACTER SET ucs2 BEGIN DECLARE f2 VARCHAR(64) COLLATE ucs2_unicode_ci; RETURN 'str'; END| -ERROR 42000: This version of MariaDB doesn't yet support 'COLLATE with no CHARACTER SET in SP parameters, RETURNS, DECLARE' +ERROR 42000: COLLATION 'ucs2_unicode_ci' is not valid for CHARACTER SET 'latin1' SET NAMES utf8; DROP FUNCTION IF EXISTS bug48766; CREATE FUNCTION bug48766 () @@ -127,7 +127,7 @@ RETURNS ENUM( 'w' ) CHARACTER SET ucs2 RETURN 0; SHOW CREATE FUNCTION bug48766; Function sql_mode Create Function character_set_client collation_connection Database Collation -bug48766 CREATE DEFINER=`root`@`localhost` FUNCTION `bug48766`() RETURNS enum('w') CHARSET ucs2 +bug48766 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `bug48766`() RETURNS enum('w') CHARSET ucs2 RETURN 0 utf8 utf8_general_ci latin1_swedish_ci SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME='bug48766'; @@ -139,7 +139,7 @@ RETURNS ENUM('а','б','в','г') CHARACTER SET ucs2 RETURN 0; SHOW CREATE FUNCTION bug48766; Function sql_mode Create Function character_set_client collation_connection Database Collation -bug48766 CREATE DEFINER=`root`@`localhost` FUNCTION `bug48766`() RETURNS enum('а','б','в','г') CHARSET ucs2 +bug48766 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `bug48766`() RETURNS enum('а','б','в','г') CHARSET ucs2 RETURN 0 utf8 utf8_general_ci latin1_swedish_ci SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME='bug48766'; diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 471576e563f..9453a1da3ca 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -791,7 +791,7 @@ comment 'Characteristics procedure test' insert into t1 values ("chistics", 1)| show create procedure chistics| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -chistics CREATE DEFINER=`root`@`localhost` PROCEDURE `chistics`() +chistics NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `chistics`() MODIFIES SQL DATA COMMENT 'Characteristics procedure test' insert into t1 values ("chistics", 1) latin1 latin1_swedish_ci latin1_swedish_ci @@ -803,7 +803,7 @@ delete from t1| alter procedure chistics sql security invoker| show create procedure chistics| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -chistics CREATE DEFINER=`root`@`localhost` PROCEDURE `chistics`() +chistics NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `chistics`() MODIFIES SQL DATA SQL SECURITY INVOKER COMMENT 'Characteristics procedure test' @@ -818,7 +818,7 @@ comment 'Characteristics procedure test' return 42| show create function chistics| Function sql_mode Create Function character_set_client collation_connection Database Collation -chistics CREATE DEFINER=`root`@`localhost` FUNCTION `chistics`() RETURNS int(11) +chistics NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `chistics`() RETURNS int(11) DETERMINISTIC SQL SECURITY INVOKER COMMENT 'Characteristics procedure test' @@ -831,7 +831,7 @@ no sql comment 'Characteristics function test'| show create function chistics| Function sql_mode Create Function character_set_client collation_connection Database Collation -chistics CREATE DEFINER=`root`@`localhost` FUNCTION `chistics`() RETURNS int(11) +chistics NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `chistics`() RETURNS int(11) NO SQL DETERMINISTIC SQL SECURITY INVOKER @@ -3548,7 +3548,10 @@ begin set f1= concat( 'hello', f1 ); return f1; end| -ERROR 42000: This version of MariaDB doesn't yet support 'return value collation' +select collation(bug9048("foo"))| +collation(bug9048("foo")) +latin1_bin +drop function bug9048| drop procedure if exists bug12849_1| create procedure bug12849_1(inout x char) select x into x| set @var='a'| @@ -6069,7 +6072,7 @@ insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807, show create table examplebug20777; Table Create Table examplebug20777 CREATE TABLE `examplebug20777` ( - `i` int(1) NOT NULL DEFAULT '0', + `i` int(1) NOT NULL, `2**63-2` bigint(20) unsigned DEFAULT NULL, `2**63-1` bigint(20) unsigned DEFAULT NULL, `2**63` bigint(20) unsigned DEFAULT NULL, @@ -7099,7 +7102,7 @@ CAST('10 ' as UNSIGNED INTEGER) 1 Warnings: Warning 1265 Data truncated for column 'a' at row 1 -Warning 1292 Truncated incorrect INTEGER value: '10 ' +Note 1292 Truncated incorrect INTEGER value: '10 ' DROP PROCEDURE p1; DROP PROCEDURE IF EXISTS p1; DROP PROCEDURE IF EXISTS p2; @@ -7125,7 +7128,7 @@ CAST('10 ' as UNSIGNED INTEGER) 2 2 Warnings: -Warning 1292 Truncated incorrect INTEGER value: '10 ' +Note 1292 Truncated incorrect INTEGER value: '10 ' DROP PROCEDURE p1; DROP PROCEDURE p2; DROP PROCEDURE p3; @@ -7911,3 +7914,80 @@ set global table_open_cache= @tmp_toc; set global table_definition_cache= @tmp_tdc; drop procedure p1; drop table t1,t2,t3,t4,t5,t6; +# End of 10.0 test +CREATE FUNCTION f(f1 VARCHAR(64) COLLATE latin1_german2_ci) +RETURNS VARCHAR(64) +BEGIN +RETURN 'str'; +END| +DROP FUNCTION f| +CREATE FUNCTION f(f1 VARCHAR(64)) +RETURNS VARCHAR(64) COLLATE latin1_german2_ci +BEGIN +RETURN 'str'; +END| +DROP FUNCTION f| +CREATE FUNCTION f(f1 VARCHAR(64)) +RETURNS VARCHAR(64) +BEGIN +DECLARE f2 VARCHAR(64) COLLATE latin1_german2_ci; +RETURN 'str'; +END| +DROP FUNCTION f| +# +# MDEV-7023: Error 2027: Malformed packet and assertion +# `field_types == 0 || field_types[field_pos] == MYSQL_TYPE_INT24 || +#field_types[field_pos] == MYSQL_TYPE_LONG' failure in +#Protocol_text::store_long +# +create table t1 (i int); +create table t2 (i int); +create function f() returns int +begin +analyze insert into t1 values (1); +return 1; +end | +ERROR 0A000: Not allowed to return a result set from a function +create function f() returns int +begin +analyze insert t1 select * from t2; +return 1; +end | +ERROR 0A000: Not allowed to return a result set from a function +create function f() returns int +begin +analyze delete from t1; +return 1; +end | +ERROR 0A000: Not allowed to return a result set from a function +create function f() returns int +begin +analyze delete t1 from t1,t2; +return 1; +end | +ERROR 0A000: Not allowed to return a result set from a function +create function f() returns int +begin +analyze update t1 set i=1; +return 1; +end | +ERROR 0A000: Not allowed to return a result set from a function +create function f() returns int +begin +analyze update t1,t2 set i=1; +return 1; +end | +ERROR 0A000: Not allowed to return a result set from a function +create function f() returns int +begin +analyze replace t1 set i=1; +return 1; +end | +ERROR 0A000: Not allowed to return a result set from a function +create function f() returns int +begin +analyze replace t1 select * from t2; +return 1; +end | +ERROR 0A000: Not allowed to return a result set from a function +drop table t1,t2; diff --git a/mysql-test/r/sp_notembedded.result b/mysql-test/r/sp_notembedded.result index 3cc4ff4238b..40a06d312a0 100644 --- a/mysql-test/r/sp_notembedded.result +++ b/mysql-test/r/sp_notembedded.result @@ -150,6 +150,7 @@ drop view v1| drop table t3| drop procedure if exists bug15298_1; drop procedure if exists bug15298_2; +create user 'mysqltest_1'@'localhost'; grant all privileges on test.* to 'mysqltest_1'@'localhost'; create procedure 15298_1 () sql security definer show grants for current_user; create procedure 15298_2 () sql security definer show grants; @@ -203,6 +204,8 @@ Warnings: Warning 1364 Field 'authentication_string' doesn't have a default value FLUSH PRIVILEGES; CREATE PROCEDURE p1(i INT) BEGIN END; +Warnings: +Warning 1404 Failed to grant EXECUTE and ALTER ROUTINE privileges DROP PROCEDURE p1; DELETE FROM mysql.user WHERE User='mysqltest_1'; FLUSH PRIVILEGES; diff --git a/mysql-test/r/sp_trans.result b/mysql-test/r/sp_trans.result index 5526fc19aae..c76615d644f 100644 --- a/mysql-test/r/sp_trans.result +++ b/mysql-test/r/sp_trans.result @@ -1,3 +1,4 @@ +set SQL_MODE=""; drop table if exists t1, t2, t3; drop procedure if exists bug8850| create table t1 (a int) engine=innodb| diff --git a/mysql-test/r/sql_mode.result b/mysql-test/r/sql_mode.result index 4fdac6b9cea..d71748bd9b1 100644 --- a/mysql-test/r/sql_mode.result +++ b/mysql-test/r/sql_mode.result @@ -144,7 +144,7 @@ ERROR 42000: Variable 'sql_mode' can't be set to the value of 'NULL' set session sql_mode=ansi; create table t1 (f1 integer auto_increment primary key, -f2 timestamp default current_timestamp on update current_timestamp); +f2 timestamp not null default current_timestamp on update current_timestamp); show create table t1; Table Create Table t1 CREATE TABLE "t1" ( diff --git a/mysql-test/r/stack-crash.result b/mysql-test/r/stack-crash.result index be5b6464b9a..62870db79f3 100644 --- a/mysql-test/r/stack-crash.result +++ b/mysql-test/r/stack-crash.result @@ -23,10 +23,7 @@ CREATE TABLE t1 ( `sspo_lu_uid` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`sspo_id`), KEY `post_uid` (`sspo_uid`,`sspo_cr_date`) -) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8; -Warnings: -Warning 1286 Unknown storage engine 'InnoDB' -Warning 1266 Using storage engine MyISAM for table 't1' +) AUTO_INCREMENT=30 DEFAULT CHARSET=utf8; INSERT INTO t1 VALUES (1,2,'P','test1','',0,'','',NULL,'','','','','A','2013-09-30 00:19:32',2,'2013-09-30 00:19:32',2),(2,2,'P','bbb','',0,'','',NULL,'','','','','A','2013-10-02 15:06:35',2,'2013-10-02 15:06:35',2); CREATE TABLE `t2` ( `spoo_id` int(11) NOT NULL AUTO_INCREMENT, @@ -41,10 +38,7 @@ CREATE TABLE `t2` ( `spoo_lu_uid` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`spoo_id`), KEY `object_option_main_idx` (`spoo_user_type_id`,`spoo_uid`,`spoo_option_id`,`spoo_value`(255)) -) ENGINE=InnoDB AUTO_INCREMENT=107 DEFAULT CHARSET=utf8; -Warnings: -Warning 1286 Unknown storage engine 'InnoDB' -Warning 1266 Using storage engine MyISAM for table 't2' +) AUTO_INCREMENT=107 DEFAULT CHARSET=utf8; INSERT INTO `t2` VALUES (19,1,2,6,'Dortmund','A','2013-09-26 01:36:51',2,'2013-09-26 01:36:51',2),(20,1,2,8,'49','A','2013-09-26 01:36:51',2,'2013-09-26 01:36:51',2); SELECT Count(*) FROM t1 AS tbl diff --git a/mysql-test/r/stat_tables_rbr.result b/mysql-test/r/stat_tables_rbr.result index 119801bf7d4..35e74e29b08 100644 --- a/mysql-test/r/stat_tables_rbr.result +++ b/mysql-test/r/stat_tables_rbr.result @@ -15,20 +15,17 @@ ALTER TABLE t1 ANALYZE PARTITION p1; Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK -SHOW BINLOG EVENTS; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 248 Server ver: #, Binlog ver: # -master-bin.000001 248 Gtid_list 1 273 [] -master-bin.000001 273 Binlog_checkpoint 1 313 master-bin.000001 -master-bin.000001 313 Gtid 1 351 GTID 0-1-1 -master-bin.000001 351 Query 1 451 use `test`; CREATE TABLE t1 (i INT) ENGINE=InnoDB -master-bin.000001 451 Gtid 1 489 GTID 0-1-2 -master-bin.000001 489 Query 1 568 use `test`; ANALYZE TABLE t1 -master-bin.000001 568 Gtid 1 606 GTID 0-1-3 -master-bin.000001 606 Query 1 710 use `test`; DROP TABLE `t1` /* generated by server */ -master-bin.000001 710 Gtid 1 748 GTID 0-1-4 -master-bin.000001 748 Query 1 884 use `test`; CREATE TABLE t1 ( a INT ) ENGINE=MyISAM PARTITION BY HASH(a) PARTITIONS 2 -master-bin.000001 884 Gtid 1 922 GTID 0-1-5 -master-bin.000001 922 Query 1 1020 use `test`; ALTER TABLE t1 ANALYZE PARTITION p1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (i INT) ENGINE=InnoDB +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; ANALYZE TABLE t1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 ( a INT ) ENGINE=MyISAM PARTITION BY HASH(a) PARTITIONS 2 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; ALTER TABLE t1 ANALYZE PARTITION p1 SET use_stat_tables = DEFAULT; DROP TABLE t1; diff --git a/mysql-test/r/statistics.result b/mysql-test/r/statistics.result index bd6a0849e3d..be2e39665b3 100644 --- a/mysql-test/r/statistics.result +++ b/mysql-test/r/statistics.result @@ -1212,6 +1212,7 @@ test t2 PRIMARY 1 1.0000 ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected +test.t1 analyze Warning Engine-independent statistics are not collected for column 'b' test.t1 analyze status OK SELECT * FROM mysql.column_stats; db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram @@ -1225,7 +1226,6 @@ test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL -test t1 b NULL NULL 0.2000 17.1250 NULL NULL NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 idx2 1 7.0000 @@ -1265,6 +1265,7 @@ set use_stat_tables='never'; ANALYZE TABLE t1 PERSISTENT FOR ALL; Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected +test.t1 analyze Warning Engine-independent statistics are not collected for column 'b' test.t1 analyze status Table is already up to date SELECT * FROM mysql.table_stats; db_name table_name cardinality @@ -1276,7 +1277,6 @@ test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 0 NULL NULL test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 0 NULL NULL test t1 e 0.01 0.112 0.2250 8.0000 6.2000 0 NULL NULL test t1 f 1 5 0.2000 1.0000 6.4000 0 NULL NULL -test t1 b NULL NULL 0.2000 17.1250 NULL NULL NULL NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 @@ -1291,6 +1291,28 @@ test t1 idx4 3 NULL DELETE FROM mysql.table_stats; DELETE FROM mysql.column_stats; DELETE FROM mysql.index_stats; +ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(); +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze Warning Engine-independent statistics are not collected for column 'b' +test.t1 analyze status Table is already up to date +ANALYZE TABLE t1 PERSISTENT FOR columns(a,b) INDEXES(); +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze Warning Engine-independent statistics are not collected for column 'b' +test.t1 analyze status Table is already up to date +ANALYZE TABLE t1 PERSISTENT FOR columns(b) indexes(idx2); +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze Warning Engine-independent statistics are not collected for column 'b' +test.t1 analyze status Table is already up to date +ANALYZE TABLE t1 PERSISTENT FOR columns() indexes(idx2); +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status Table is already up to date +DELETE FROM mysql.table_stats; +DELETE FROM mysql.column_stats; +DELETE FROM mysql.index_stats; DROP TABLE t1,t2; set names utf8; CREATE DATABASE world; @@ -1641,3 +1663,17 @@ FROM mysql.column_stats; db_name table_name column_name HEX(min_value) HEX(max_value) nulls_ratio avg_frequency hist_size hist_type HEX(histogram) test t1 a D879626AF872675F73E662F8 D879626AF872675F73E662F8 0.0000 1.0000 0 NULL NULL drop table t1; +# +# MDEV-9590: Always print "Engine-independent statistic" warnings and +# might be filtering columns unintentionally from engines +# +set use_stat_tables='NEVER'; +create table t1 (test blob); +show variables like 'use_stat_tables'; +Variable_name Value +use_stat_tables NEVER +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Table is already up to date +drop table t1; +set use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/r/statistics_index_crash-7362.result b/mysql-test/r/statistics_index_crash-7362.result index 99f65d7e1b7..c213fa49afe 100644 --- a/mysql-test/r/statistics_index_crash-7362.result +++ b/mysql-test/r/statistics_index_crash-7362.result @@ -3,6 +3,7 @@ INSERT INTO t1 VALUES (unhex('3E0D0A4141414142334E7A6143317963324541414141424977 ANALYZE TABLE t1 PERSISTENT FOR ALL; Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected +test.t1 analyze Warning Engine-independent statistics are not collected for column 'a' test.t1 analyze status OK SELECT * FROM mysql.index_stats WHERE index_name='a' AND table_name='t1'; db_name table_name index_name prefix_arity avg_frequency @@ -13,6 +14,7 @@ INSERT INTO t1 VALUES (unhex('3E0D0A4141414142334E7A6143317963324541414141424977 ANALYZE TABLE t1 PERSISTENT FOR ALL; Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected +test.t1 analyze Warning Engine-independent statistics are not collected for column 'a' test.t1 analyze status OK SELECT * FROM mysql.index_stats WHERE index_name='a' AND table_name='t1'; db_name table_name index_name prefix_arity avg_frequency diff --git a/mysql-test/r/status.result b/mysql-test/r/status.result index 140db7c5721..55afd159053 100644 --- a/mysql-test/r/status.result +++ b/mysql-test/r/status.result @@ -204,6 +204,7 @@ Com_drop_function 1 create database db37908; create table db37908.t1(f1 int); insert into db37908.t1 values(1); +create user mysqltest_1@localhost; grant usage,execute on test.* to mysqltest_1@localhost; create procedure proc37908() begin select 1; end | create function func37908() returns int sql security invoker diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index 7cc29ae4ed6..9dcd5975411 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -778,7 +778,7 @@ ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 VALUES ('-100E+1'); ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 VALUES ('-100E'); -ERROR 22007: Incorrect decimal value: '-100E' for column 'col1' at row 1 +ERROR 01000: Data truncated for column 'col1' at row 1 UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11; ERROR 22003: Out of range value for column 'col1' at row 6 UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0; @@ -790,10 +790,10 @@ ERROR 22007: Incorrect decimal value: '' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES ('a59b'); ERROR 22007: Incorrect decimal value: 'a59b' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES ('1a'); -ERROR 22007: Incorrect decimal value: '1a' for column 'col1' at row 1 +ERROR 01000: Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 (col1) VALUES ('2a'); Warnings: -Note 1265 Data truncated for column 'col1' at row 1 +Warning 1265 Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 values (1/0); Warnings: Warning 1365 Division by 0 @@ -853,9 +853,9 @@ ERROR 22012: Division by 0 UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0; ERROR 22012: Division by 0 INSERT INTO t1 (col1) VALUES (''); -ERROR 01000: Data truncated for column 'col1' at row 1 +ERROR 22007: Incorrect double value: '' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES ('a59b'); -ERROR 01000: Data truncated for column 'col1' at row 1 +ERROR 22007: Incorrect double value: 'a59b' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES ('1a'); ERROR 01000: Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 (col1) VALUES ('2a'); @@ -903,9 +903,9 @@ ERROR 22012: Division by 0 UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0; ERROR 22012: Division by 0 INSERT INTO t1 (col1) VALUES (''); -ERROR 01000: Data truncated for column 'col1' at row 1 +ERROR 22007: Incorrect double value: '' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES ('a59b'); -ERROR 01000: Data truncated for column 'col1' at row 1 +ERROR 22007: Incorrect double value: 'a59b' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES ('1a'); ERROR 01000: Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 (col1) VALUES ('2a'); @@ -1125,6 +1125,8 @@ ERROR 22007: Truncated incorrect INTEGER value: '10a' insert into t1 (col2) values (cast('10' as unsigned integer)); insert into t1 (col2) values (cast('10' as signed integer)); insert into t1 (col2) values (10E+0 + '0 '); +Warnings: +Note 1292 Truncated incorrect DOUBLE value: '0 ' select * from t1; col1 col2 NULL 10 @@ -1265,22 +1267,22 @@ d 2000-10-01 drop table t1; set @@sql_mode='traditional'; -create table t1(a int, b timestamp); +create table t1(a int, b timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); alter table t1 add primary key(a); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; -create table t1(a int, b timestamp default 20050102030405); +create table t1(a int, b timestamp not null default 20050102030405); alter table t1 add primary key(a); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, `b` timestamp NOT NULL DEFAULT '2005-01-02 03:04:05', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index fa6a0624dcb..ac874f9943c 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -130,12 +130,16 @@ Warning 1292 Truncated incorrect DOUBLE value: '1.5b' SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); (SELECT 'b',2,'a') = ROW(1.5,2,'a') 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'b' SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a'); (SELECT 1.5,2,'a') = ROW(1.5,'2','a') 1 SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); (SELECT 1.5,'c','a') = ROW(1.5,2,'a') 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'c' SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a); ERROR 21000: Operand should contain 1 column(s) SELECT 1 as a,(SELECT a+a) b,(SELECT b); @@ -402,13 +406,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03') +Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03') EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used 2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` +Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; date 2002-08-03 @@ -1052,6 +1056,8 @@ create table t1 (a float); select 10.5 IN (SELECT * from t1 LIMIT 1); ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5); +ERROR HY000: Incorrect usage of UNION and LIMIT +select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1); ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' drop table t1; create table t1 (a int, b int, c varchar(10)); @@ -1253,7 +1259,7 @@ a SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bigint(20) NOT NULL DEFAULT '0' + `a` bigint(20) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int); @@ -3696,8 +3702,8 @@ WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 ORDER BY t1.t DESC LIMIT 1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index -2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index +1 PRIMARY t1 index NULL PRIMARY 13 NULL 11 Using where; Using index +2 SUBQUERY t1 range PRIMARY PRIMARY 13 NULL 5 Using where; Using index SELECT * FROM t1,t2 WHERE t1.t = (SELECT t1.t FROM t1 WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 @@ -4663,6 +4669,8 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); 1 SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -5130,8 +5138,9 @@ SELECT a FROM t1 WHERE a = 2 a 1 2 -SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1 +SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a) q; +a +1 SELECT * FROM (SELECT 1 a UNION (SELECT 1 a)) alias; a 1 @@ -5173,7 +5182,7 @@ a 1 1 1 2 1 SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')) ON 1' at line 1 +ERROR 42000: Every derived table must have its own alias SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ON 1' at line 1 SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1; @@ -5292,7 +5301,10 @@ SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1)); SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1 SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') UNION SELECT 1 )' at line 1 +ERROR 42000: Every derived table must have its own alias +SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a; +1 +1 SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a; 1 1 @@ -5931,6 +5943,8 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); 1 SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -6310,12 +6324,22 @@ SELECT 1 FROM t1 WHERE a = ORDER BY b ); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t2 WHERE b = (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2) GROUP BY b ); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' DROP TABLE t1, t2; # # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) @@ -6974,7 +6998,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # @@ -7008,7 +7032,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # diff --git a/mysql-test/r/subselect2.result b/mysql-test/r/subselect2.result index 034cba58c8f..75e8c084026 100644 --- a/mysql-test/r/subselect2.result +++ b/mysql-test/r/subselect2.result @@ -287,7 +287,7 @@ ORDER BY mirror_date ASC ) AS calculated_result; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 -2 DERIVED t1 range date date 9 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using filesort +2 DERIVED t1 range date date 6 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using filesort SELECT * FROM ( SELECT node_uid, date, mirror_date, @result := 0 AS result FROM t1 @@ -310,7 +310,7 @@ ORDER BY mirror_date ASC ) AS calculated_result; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 -2 DERIVED t1 range date date 9 NULL 2 Using index condition; Using where; Using filesort +2 DERIVED t1 range date date 6 NULL 2 Using index condition; Using where; Using filesort SELECT * FROM ( SELECT node_uid, date, mirror_date, @result := 0 AS result FROM t1 diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result index a909230121d..87645d187f2 100644 --- a/mysql-test/r/subselect4.result +++ b/mysql-test/r/subselect4.result @@ -427,6 +427,8 @@ KEY `varchar_key` (`varchar_key`) INSERT INTO `t1` VALUES (10,'00:00:00','i','i'),(11,'00:00:00','',''); set @old_optimizer_switch = @@session.optimizer_switch; SET SESSION OPTIMIZER_SWITCH = 'materialization=off,semijoin=off,loosescan=off,firstmatch=off,mrr=on,engine_condition_pushdown=on'; +Warnings: +Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release. SELECT `time_nokey` G1 FROM t1 WHERE ( `varchar_nokey` , `varchar_key` ) IN ( SELECT `varchar_nokey` , `varchar_nokey` ) AND `varchar_key` >= 'c' HAVING G1 ORDER BY `pk` ; @@ -615,6 +617,8 @@ INSERT INTO t2 VALUES (9,1); # Enable Index condition pushdown set @old_icp=@@optimizer_switch; SET SESSION optimizer_switch="engine_condition_pushdown=on"; +Warnings: +Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release. SELECT pk FROM t2 diff --git a/mysql-test/r/subselect_cache.result b/mysql-test/r/subselect_cache.result index e5a2fe12526..8ca6bf52e0e 100644 --- a/mysql-test/r/subselect_cache.result +++ b/mysql-test/r/subselect_cache.result @@ -39,6 +39,231 @@ Handler_read_prev 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 31 +analyze format=json +select a, (select d from t2 where b=c) from t1; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 1, + "rows": 10, + "r_rows": 10, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + }, + "subqueries": [ + { + "expression_cache": { + "r_loops": 10, + "r_hit_ratio": 60, + "query_block": { + "select_id": 2, + "r_loops": 4, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t2", + "access_type": "ALL", + "r_loops": 4, + "rows": 4, + "r_rows": 4, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 18.75, + "attached_condition": "(t1.b = t2.c)" + } + } + } + } + ] + } +} +analyze format=json +select a, (select d from t2 where b=c), (select d from t2 where b=c union select 1 order by 1 limit 1) from t1; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 1, + "rows": 10, + "r_rows": 10, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + }, + "subqueries": [ + { + "expression_cache": { + "r_loops": 10, + "r_hit_ratio": 60, + "query_block": { + "union_result": { + "table_name": "<union3,4>", + "access_type": "ALL", + "r_loops": 4, + "r_rows": 1, + "query_specifications": [ + { + "query_block": { + "select_id": 3, + "r_loops": 4, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t2", + "access_type": "ALL", + "r_loops": 4, + "rows": 4, + "r_rows": 4, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 18.75, + "attached_condition": "(t1.b = t2.c)" + } + } + }, + { + "query_block": { + "select_id": 4, + "table": { + "message": "No tables used" + } + } + } + ] + } + } + } + }, + { + "expression_cache": { + "r_loops": 10, + "r_hit_ratio": 60, + "query_block": { + "select_id": 2, + "r_loops": 4, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t2", + "access_type": "ALL", + "r_loops": 4, + "rows": 4, + "r_rows": 4, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 18.75, + "attached_condition": "(t1.b = t2.c)" + } + } + } + } + ] + } +} +explain format=json +select a, (select d from t2 where b=c) from t1; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + }, + "subqueries": [ + { + "expression_cache": { + "state": "uninitialized", + "query_block": { + "select_id": 2, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 4, + "filtered": 100, + "attached_condition": "(t1.b = t2.c)" + } + } + } + } + ] + } +} +explain format=json +select a, (select d from t2 where b=c), (select d from t2 where b=c union select 1 order by 1 limit 1) from t1; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + }, + "subqueries": [ + { + "expression_cache": { + "state": "uninitialized", + "query_block": { + "union_result": { + "table_name": "<union3,4>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 4, + "filtered": 100, + "attached_condition": "(t1.b = t2.c)" + } + } + }, + { + "query_block": { + "select_id": 4, + "table": { + "message": "No tables used" + } + } + } + ] + } + } + } + }, + { + "expression_cache": { + "state": "uninitialized", + "query_block": { + "select_id": 2, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 4, + "filtered": 100, + "attached_condition": "(t1.b = t2.c)" + } + } + } + } + ] + } +} set optimizer_switch='subquery_cache=off'; flush status; select a, (select d from t2 where b=c) from t1; diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result index 07d00e96549..cfbe5d41418 100644 --- a/mysql-test/r/subselect_innodb.result +++ b/mysql-test/r/subselect_innodb.result @@ -296,8 +296,6 @@ INSERT INTO t1 VALUES ('2011-05-13', 0); SELECT * FROM t1 WHERE b < (SELECT CAST(a as date) FROM t1 GROUP BY a); a b 2011-05-13 0 -Warnings: -Warning 1292 Incorrect datetime value: '0' DROP TABLE t1; # # Bug #11766300 59387: FAILING ASSERTION: CURSOR->POS_STATE == 1997660512 (BTR_PCUR_IS_POSITIONE diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result index 5f3495aae6f..c9fa7c0c672 100644 --- a/mysql-test/r/subselect_mat.result +++ b/mysql-test/r/subselect_mat.result @@ -103,7 +103,7 @@ explain extended select * from t1i where a1 in (select max(b1) from t2i where b1 > '0' group by b1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1i index NULL # 18 # 3 100.00 # -2 MATERIALIZED t2i index it2i1,it2i3 # 9 # 5 100.00 # +2 MATERIALIZED t2i range it2i1,it2i3 # 9 # 5 100.00 # Warnings: Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`>(<in_optimizer>(`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( <materialize> (select max(`test`.`t2i`.`b1`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where ((`test`.`t1i`.`a1` = `<subquery2>`.`max(b1)`)))))) select * from t1i where a1 in (select max(b1) from t2i where b1 > '0' group by b1); @@ -545,6 +545,10 @@ Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.` select * from t1 group by (a1 in (select col from columns)); a1 a2 1 - 00 2 - 00 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1 - 00' +Warning 1292 Truncated incorrect DOUBLE value: '1 - 01' +Warning 1292 Truncated incorrect DOUBLE value: '1 - 02' /* ORDER BY clause */ explain extended select * from t1 order by (select col from columns limit 1); @@ -758,6 +762,10 @@ select left(a1,7), left(a2,7) from t1_512 where a1 in (select group_concat(b1) from t2_512 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() set @@group_concat_max_len = 256; explain extended select left(a1,7), left(a2,7) from t1_512 @@ -771,6 +779,10 @@ select left(a1,7), left(a2,7) from t1_512 where a1 in (select group_concat(b1) from t2_512 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() drop table t1_512, t2_512, t3_512; set @blob_len = 1024; set @suffix_len = @blob_len - @prefix_len; @@ -851,6 +863,10 @@ select left(a1,7), left(a2,7) from t1_1024 where a1 in (select group_concat(b1) from t2_1024 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() set @@group_concat_max_len = 256; explain extended select left(a1,7), left(a2,7) from t1_1024 @@ -864,6 +880,10 @@ select left(a1,7), left(a2,7) from t1_1024 where a1 in (select group_concat(b1) from t2_1024 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() drop table t1_1024, t2_1024, t3_1024; set @blob_len = 1025; set @suffix_len = @blob_len - @prefix_len; @@ -944,6 +964,10 @@ select left(a1,7), left(a2,7) from t1_1025 where a1 in (select group_concat(b1) from t2_1025 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() set @@group_concat_max_len = 256; explain extended select left(a1,7), left(a2,7) from t1_1025 @@ -957,6 +981,10 @@ select left(a1,7), left(a2,7) from t1_1025 where a1 in (select group_concat(b1) from t2_1025 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() drop table t1_1025, t2_1025, t3_1025; create table t1bit (a1 bit(3), a2 bit(3)); create table t2bit (b1 bit(3), b2 bit(3)); @@ -2514,3 +2542,18 @@ a b sq 4 4 1 4 2 1 drop table t1, t2; +# +# MDEV-9489: Assertion `0' failed in Protocol::end_statement() on +# UNION ALL +# +CREATE TABLE t1 (f1 INT); +CREATE TABLE t2 (f2 INT); +INSERT INTO t1 VALUES (1),(2); +( SELECT 1 FROM t1 WHERE f1 NOT IN ( SELECT f2 FROM t2 ) LIMIT 0 ) +UNION ALL +( SELECT 1 FROM t1 WHERE f1 NOT IN ( SELECT f2 FROM t2 ) ) +; +1 +1 +1 +drop table t1, t2; diff --git a/mysql-test/r/subselect_no_exists_to_in.result b/mysql-test/r/subselect_no_exists_to_in.result index 012d7a80610..6a5bec062c7 100644 --- a/mysql-test/r/subselect_no_exists_to_in.result +++ b/mysql-test/r/subselect_no_exists_to_in.result @@ -134,12 +134,16 @@ Warning 1292 Truncated incorrect DOUBLE value: '1.5b' SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); (SELECT 'b',2,'a') = ROW(1.5,2,'a') 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'b' SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a'); (SELECT 1.5,2,'a') = ROW(1.5,'2','a') 1 SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); (SELECT 1.5,'c','a') = ROW(1.5,2,'a') 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'c' SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a); ERROR 21000: Operand should contain 1 column(s) SELECT 1 as a,(SELECT a+a) b,(SELECT b); @@ -406,13 +410,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03') +Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03') EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used 2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` +Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; date 2002-08-03 @@ -1056,6 +1060,8 @@ create table t1 (a float); select 10.5 IN (SELECT * from t1 LIMIT 1); ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5); +ERROR HY000: Incorrect usage of UNION and LIMIT +select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1); ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' drop table t1; create table t1 (a int, b int, c varchar(10)); @@ -1257,7 +1263,7 @@ a SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bigint(20) NOT NULL DEFAULT '0' + `a` bigint(20) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int); @@ -3699,8 +3705,8 @@ WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 ORDER BY t1.t DESC LIMIT 1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index -2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index +1 PRIMARY t1 index NULL PRIMARY 13 NULL 11 Using where; Using index +2 SUBQUERY t1 range PRIMARY PRIMARY 13 NULL 5 Using where; Using index SELECT * FROM t1,t2 WHERE t1.t = (SELECT t1.t FROM t1 WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 @@ -4665,6 +4671,8 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); 1 SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -5132,8 +5140,9 @@ SELECT a FROM t1 WHERE a = 2 a 1 2 -SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1 +SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a) q; +a +1 SELECT * FROM (SELECT 1 a UNION (SELECT 1 a)) alias; a 1 @@ -5175,7 +5184,7 @@ a 1 1 1 2 1 SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')) ON 1' at line 1 +ERROR 42000: Every derived table must have its own alias SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ON 1' at line 1 SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1; @@ -5294,7 +5303,10 @@ SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1)); SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1 SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') UNION SELECT 1 )' at line 1 +ERROR 42000: Every derived table must have its own alias +SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a; +1 +1 SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a; 1 1 @@ -5931,6 +5943,8 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); 1 SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -6310,12 +6324,22 @@ SELECT 1 FROM t1 WHERE a = ORDER BY b ); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t2 WHERE b = (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2) GROUP BY b ); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' DROP TABLE t1, t2; # # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) @@ -6974,7 +6998,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # @@ -7008,7 +7032,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result index e83697fcb4f..a574319b175 100644 --- a/mysql-test/r/subselect_no_mat.result +++ b/mysql-test/r/subselect_no_mat.result @@ -137,12 +137,16 @@ Warning 1292 Truncated incorrect DOUBLE value: '1.5b' SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); (SELECT 'b',2,'a') = ROW(1.5,2,'a') 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'b' SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a'); (SELECT 1.5,2,'a') = ROW(1.5,'2','a') 1 SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); (SELECT 1.5,'c','a') = ROW(1.5,2,'a') 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'c' SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a); ERROR 21000: Operand should contain 1 column(s) SELECT 1 as a,(SELECT a+a) b,(SELECT b); @@ -409,13 +413,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03') +Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03') EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used 2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` +Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; date 2002-08-03 @@ -1059,6 +1063,8 @@ create table t1 (a float); select 10.5 IN (SELECT * from t1 LIMIT 1); ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5); +ERROR HY000: Incorrect usage of UNION and LIMIT +select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1); ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' drop table t1; create table t1 (a int, b int, c varchar(10)); @@ -1260,7 +1266,7 @@ a SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bigint(20) NOT NULL DEFAULT '0' + `a` bigint(20) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int); @@ -3699,8 +3705,8 @@ WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 ORDER BY t1.t DESC LIMIT 1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index -2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index +1 PRIMARY t1 index NULL PRIMARY 13 NULL 11 Using where; Using index +2 SUBQUERY t1 range PRIMARY PRIMARY 13 NULL 5 Using where; Using index SELECT * FROM t1,t2 WHERE t1.t = (SELECT t1.t FROM t1 WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 @@ -4663,6 +4669,8 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); 1 SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -5130,8 +5138,9 @@ SELECT a FROM t1 WHERE a = 2 a 1 2 -SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1 +SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a) q; +a +1 SELECT * FROM (SELECT 1 a UNION (SELECT 1 a)) alias; a 1 @@ -5173,7 +5182,7 @@ a 1 1 1 2 1 SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')) ON 1' at line 1 +ERROR 42000: Every derived table must have its own alias SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ON 1' at line 1 SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1; @@ -5292,7 +5301,10 @@ SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1)); SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1 SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') UNION SELECT 1 )' at line 1 +ERROR 42000: Every derived table must have its own alias +SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a; +1 +1 SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a; 1 1 @@ -5928,6 +5940,8 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); 1 SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -6305,12 +6319,22 @@ SELECT 1 FROM t1 WHERE a = ORDER BY b ); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t2 WHERE b = (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2) GROUP BY b ); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' DROP TABLE t1, t2; # # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) @@ -6968,7 +6992,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # @@ -7001,7 +7025,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result index c620f788cf7..62eecd568f0 100644 --- a/mysql-test/r/subselect_no_opts.result +++ b/mysql-test/r/subselect_no_opts.result @@ -133,12 +133,16 @@ Warning 1292 Truncated incorrect DOUBLE value: '1.5b' SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); (SELECT 'b',2,'a') = ROW(1.5,2,'a') 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'b' SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a'); (SELECT 1.5,2,'a') = ROW(1.5,'2','a') 1 SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); (SELECT 1.5,'c','a') = ROW(1.5,2,'a') 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'c' SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a); ERROR 21000: Operand should contain 1 column(s) SELECT 1 as a,(SELECT a+a) b,(SELECT b); @@ -405,13 +409,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03') +Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03') EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used 2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` +Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; date 2002-08-03 @@ -1055,6 +1059,8 @@ create table t1 (a float); select 10.5 IN (SELECT * from t1 LIMIT 1); ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5); +ERROR HY000: Incorrect usage of UNION and LIMIT +select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1); ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' drop table t1; create table t1 (a int, b int, c varchar(10)); @@ -1256,7 +1262,7 @@ a SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bigint(20) NOT NULL DEFAULT '0' + `a` bigint(20) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int); @@ -3695,8 +3701,8 @@ WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 ORDER BY t1.t DESC LIMIT 1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index -2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index +1 PRIMARY t1 index NULL PRIMARY 13 NULL 11 Using where; Using index +2 SUBQUERY t1 range PRIMARY PRIMARY 13 NULL 5 Using where; Using index SELECT * FROM t1,t2 WHERE t1.t = (SELECT t1.t FROM t1 WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 @@ -4659,6 +4665,8 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); 1 SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -5126,8 +5134,9 @@ SELECT a FROM t1 WHERE a = 2 a 1 2 -SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1 +SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a) q; +a +1 SELECT * FROM (SELECT 1 a UNION (SELECT 1 a)) alias; a 1 @@ -5169,7 +5178,7 @@ a 1 1 1 2 1 SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')) ON 1' at line 1 +ERROR 42000: Every derived table must have its own alias SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ON 1' at line 1 SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1; @@ -5288,7 +5297,10 @@ SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1)); SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1 SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') UNION SELECT 1 )' at line 1 +ERROR 42000: Every derived table must have its own alias +SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a; +1 +1 SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a; 1 1 @@ -5924,6 +5936,8 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); 1 SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -6301,12 +6315,22 @@ SELECT 1 FROM t1 WHERE a = ORDER BY b ); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t2 WHERE b = (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2) GROUP BY b ); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' DROP TABLE t1, t2; # # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) @@ -6965,7 +6989,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # @@ -6999,7 +7023,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result index b2b2518bdd3..174c791489c 100644 --- a/mysql-test/r/subselect_no_scache.result +++ b/mysql-test/r/subselect_no_scache.result @@ -136,12 +136,16 @@ Warning 1292 Truncated incorrect DOUBLE value: '1.5b' SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); (SELECT 'b',2,'a') = ROW(1.5,2,'a') 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'b' SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a'); (SELECT 1.5,2,'a') = ROW(1.5,'2','a') 1 SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); (SELECT 1.5,'c','a') = ROW(1.5,2,'a') 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'c' SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a); ERROR 21000: Operand should contain 1 column(s) SELECT 1 as a,(SELECT a+a) b,(SELECT b); @@ -408,13 +412,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03') +Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03') EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used 2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` +Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; date 2002-08-03 @@ -1058,6 +1062,8 @@ create table t1 (a float); select 10.5 IN (SELECT * from t1 LIMIT 1); ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5); +ERROR HY000: Incorrect usage of UNION and LIMIT +select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1); ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' drop table t1; create table t1 (a int, b int, c varchar(10)); @@ -1259,7 +1265,7 @@ a SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bigint(20) NOT NULL DEFAULT '0' + `a` bigint(20) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int); @@ -3702,8 +3708,8 @@ WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 ORDER BY t1.t DESC LIMIT 1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index -2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index +1 PRIMARY t1 index NULL PRIMARY 13 NULL 11 Using where; Using index +2 SUBQUERY t1 range PRIMARY PRIMARY 13 NULL 5 Using where; Using index SELECT * FROM t1,t2 WHERE t1.t = (SELECT t1.t FROM t1 WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 @@ -4669,6 +4675,8 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); 1 SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -5136,8 +5144,9 @@ SELECT a FROM t1 WHERE a = 2 a 1 2 -SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1 +SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a) q; +a +1 SELECT * FROM (SELECT 1 a UNION (SELECT 1 a)) alias; a 1 @@ -5179,7 +5188,7 @@ a 1 1 1 2 1 SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')) ON 1' at line 1 +ERROR 42000: Every derived table must have its own alias SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ON 1' at line 1 SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1; @@ -5298,7 +5307,10 @@ SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1)); SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1 SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') UNION SELECT 1 )' at line 1 +ERROR 42000: Every derived table must have its own alias +SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a; +1 +1 SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a; 1 1 @@ -5937,6 +5949,8 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); 1 SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -6316,12 +6330,22 @@ SELECT 1 FROM t1 WHERE a = ORDER BY b ); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t2 WHERE b = (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2) GROUP BY b ); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' DROP TABLE t1, t2; # # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) @@ -6980,7 +7004,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # @@ -7014,7 +7038,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result index 2bd82dffd36..e0d62ac6d14 100644 --- a/mysql-test/r/subselect_no_semijoin.result +++ b/mysql-test/r/subselect_no_semijoin.result @@ -133,12 +133,16 @@ Warning 1292 Truncated incorrect DOUBLE value: '1.5b' SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); (SELECT 'b',2,'a') = ROW(1.5,2,'a') 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'b' SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a'); (SELECT 1.5,2,'a') = ROW(1.5,'2','a') 1 SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); (SELECT 1.5,'c','a') = ROW(1.5,2,'a') 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'c' SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a); ERROR 21000: Operand should contain 1 column(s) SELECT 1 as a,(SELECT a+a) b,(SELECT b); @@ -405,13 +409,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03') +Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03') EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used 2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` +Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; date 2002-08-03 @@ -1055,6 +1059,8 @@ create table t1 (a float); select 10.5 IN (SELECT * from t1 LIMIT 1); ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5); +ERROR HY000: Incorrect usage of UNION and LIMIT +select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1); ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' drop table t1; create table t1 (a int, b int, c varchar(10)); @@ -1256,7 +1262,7 @@ a SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bigint(20) NOT NULL DEFAULT '0' + `a` bigint(20) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int); @@ -3695,8 +3701,8 @@ WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 ORDER BY t1.t DESC LIMIT 1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index -2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index +1 PRIMARY t1 index NULL PRIMARY 13 NULL 11 Using where; Using index +2 SUBQUERY t1 range PRIMARY PRIMARY 13 NULL 5 Using where; Using index SELECT * FROM t1,t2 WHERE t1.t = (SELECT t1.t FROM t1 WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 @@ -4659,6 +4665,8 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); 1 SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -5126,8 +5134,9 @@ SELECT a FROM t1 WHERE a = 2 a 1 2 -SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1 +SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a) q; +a +1 SELECT * FROM (SELECT 1 a UNION (SELECT 1 a)) alias; a 1 @@ -5169,7 +5178,7 @@ a 1 1 1 2 1 SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')) ON 1' at line 1 +ERROR 42000: Every derived table must have its own alias SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ON 1' at line 1 SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1; @@ -5288,7 +5297,10 @@ SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1)); SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) ); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1 SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ); -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') UNION SELECT 1 )' at line 1 +ERROR 42000: Every derived table must have its own alias +SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a; +1 +1 SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a; 1 1 @@ -5924,6 +5936,8 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2); 1 SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2); 1 1 @@ -6301,12 +6315,22 @@ SELECT 1 FROM t1 WHERE a = ORDER BY b ); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t2 WHERE b = (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2) GROUP BY b ); 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' DROP TABLE t1, t2; # # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) @@ -6965,7 +6989,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # @@ -6999,7 +7023,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result index 3ca3f0d35fb..be252802c15 100644 --- a/mysql-test/r/subselect_sj.result +++ b/mysql-test/r/subselect_sj.result @@ -2094,6 +2094,9 @@ f1 f2 f3 f3 4 0 0 0 4 0 0 0 0 NULL NULL NULL +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'foo' +Warning 1292 Truncated incorrect DOUBLE value: 'foo' DROP TABLE t1, t2, t3, t4; set @tmp803457=@@optimizer_switch; # @@ -2285,8 +2288,14 @@ CREATE TABLE t3 (a int, b int) ; PREPARE st1 FROM "SELECT * FROM t2 LEFT JOIN t1 ON t2.a != 0 AND ('j','r') IN ( SELECT b,a FROM t3)"; EXECUTE st1; a a +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'j' +Warning 1292 Truncated incorrect DOUBLE value: 'r' EXECUTE st1; a a +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'j' +Warning 1292 Truncated incorrect DOUBLE value: 'r' DROP TABLE t1, t2, t3; # # BUG#849776: Wrong result with semijoin + "Impossible where" @@ -2821,10 +2830,7 @@ col_varchar_nokey varchar(1) DEFAULT NULL, PRIMARY KEY (pk), KEY col_int_key (col_int_key), KEY col_varchar_key (col_varchar_key, col_int_key) -) ENGINE=InnoDB; -Warnings: -Warning 1286 Unknown storage engine 'InnoDB' -Warning 1266 Using storage engine MyISAM for table 't1' +); INSERT INTO t1 VALUES (10,8,'x','x'), (11,7,'d','d'), diff --git a/mysql-test/r/subselect_sj2.result b/mysql-test/r/subselect_sj2.result index e6259a3979b..21d97b3faea 100644 --- a/mysql-test/r/subselect_sj2.result +++ b/mysql-test/r/subselect_sj2.result @@ -703,7 +703,7 @@ create table t2 (id int, a int, primary key(id), key(a)) as select a as id, a as show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `id` int(11) NOT NULL DEFAULT '0', + `id` int(11) NOT NULL, `a` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `a` (`a`) @@ -1092,6 +1092,27 @@ AND ( alias5.b >= alias3.b OR alias5.c != alias3.c ) ); COUNT(*) 3724 +EXPLAIN +SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 +WHERE alias3.d IN ( +SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 +WHERE alias5.b = alias4.b +AND ( alias5.b >= alias3.b OR alias3.c != alias5.c ) +); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL 19 Using where +1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d 1 Using index +1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b 1 Using where; FirstMatch(alias3) +1 PRIMARY alias2 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join) +1 PRIMARY alias1 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join) +SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 +WHERE alias3.d IN ( +SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 +WHERE alias5.b = alias4.b +AND ( alias5.b >= alias3.b OR alias3.c != alias5.c ) +); +COUNT(*) +3724 set optimizer_prune_level=@tmp_951283; DROP TABLE t1,t2; # diff --git a/mysql-test/r/subselect_sj2_jcl6.result b/mysql-test/r/subselect_sj2_jcl6.result index 64f7ab2e6bf..eb91fe6d61b 100644 --- a/mysql-test/r/subselect_sj2_jcl6.result +++ b/mysql-test/r/subselect_sj2_jcl6.result @@ -717,7 +717,7 @@ create table t2 (id int, a int, primary key(id), key(a)) as select a as id, a as show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `id` int(11) NOT NULL DEFAULT '0', + `id` int(11) NOT NULL, `a` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `a` (`a`) @@ -1107,6 +1107,27 @@ AND ( alias5.b >= alias3.b OR alias5.c != alias3.c ) ); COUNT(*) 3724 +EXPLAIN +SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 +WHERE alias3.d IN ( +SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 +WHERE alias5.b = alias4.b +AND ( alias5.b >= alias3.b OR alias3.c != alias5.c ) +); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL 19 Using where +1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d 1 Using index +1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b 1 Using where; FirstMatch(alias3) +1 PRIMARY alias2 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join) +1 PRIMARY alias1 ALL NULL NULL NULL NULL 14 Using join buffer (incremental, BNL join) +SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 +WHERE alias3.d IN ( +SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 +WHERE alias5.b = alias4.b +AND ( alias5.b >= alias3.b OR alias3.c != alias5.c ) +); +COUNT(*) +3724 set optimizer_prune_level=@tmp_951283; DROP TABLE t1,t2; # diff --git a/mysql-test/r/subselect_sj2_mat.result b/mysql-test/r/subselect_sj2_mat.result index 08a97175487..16e8f88168d 100644 --- a/mysql-test/r/subselect_sj2_mat.result +++ b/mysql-test/r/subselect_sj2_mat.result @@ -705,7 +705,7 @@ create table t2 (id int, a int, primary key(id), key(a)) as select a as id, a as show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `id` int(11) NOT NULL DEFAULT '0', + `id` int(11) NOT NULL, `a` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `a` (`a`) @@ -1094,6 +1094,27 @@ AND ( alias5.b >= alias3.b OR alias5.c != alias3.c ) ); COUNT(*) 3724 +EXPLAIN +SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 +WHERE alias3.d IN ( +SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 +WHERE alias5.b = alias4.b +AND ( alias5.b >= alias3.b OR alias3.c != alias5.c ) +); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL 19 Using where +1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d 1 Using index +1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b 1 Using where; FirstMatch(alias3) +1 PRIMARY alias2 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join) +1 PRIMARY alias1 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join) +SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 +WHERE alias3.d IN ( +SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 +WHERE alias5.b = alias4.b +AND ( alias5.b >= alias3.b OR alias3.c != alias5.c ) +); +COUNT(*) +3724 set optimizer_prune_level=@tmp_951283; DROP TABLE t1,t2; # diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result index ed6bf8bc11b..8e95b963971 100644 --- a/mysql-test/r/subselect_sj_jcl6.result +++ b/mysql-test/r/subselect_sj_jcl6.result @@ -2108,6 +2108,9 @@ f1 f2 f3 f3 4 0 0 0 4 0 0 0 0 NULL NULL NULL +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'foo' +Warning 1292 Truncated incorrect DOUBLE value: 'foo' DROP TABLE t1, t2, t3, t4; set @tmp803457=@@optimizer_switch; # @@ -2299,8 +2302,14 @@ CREATE TABLE t3 (a int, b int) ; PREPARE st1 FROM "SELECT * FROM t2 LEFT JOIN t1 ON t2.a != 0 AND ('j','r') IN ( SELECT b,a FROM t3)"; EXECUTE st1; a a +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'j' +Warning 1292 Truncated incorrect DOUBLE value: 'r' EXECUTE st1; a a +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'j' +Warning 1292 Truncated incorrect DOUBLE value: 'r' DROP TABLE t1, t2, t3; # # BUG#849776: Wrong result with semijoin + "Impossible where" @@ -2835,10 +2844,7 @@ col_varchar_nokey varchar(1) DEFAULT NULL, PRIMARY KEY (pk), KEY col_int_key (col_int_key), KEY col_varchar_key (col_varchar_key, col_int_key) -) ENGINE=InnoDB; -Warnings: -Warning 1286 Unknown storage engine 'InnoDB' -Warning 1266 Using storage engine MyISAM for table 't1' +); INSERT INTO t1 VALUES (10,8,'x','x'), (11,7,'d','d'), diff --git a/mysql-test/r/subselect_sj_mat.result b/mysql-test/r/subselect_sj_mat.result index 34d5834bff4..2f3777a47fd 100644 --- a/mysql-test/r/subselect_sj_mat.result +++ b/mysql-test/r/subselect_sj_mat.result @@ -107,7 +107,7 @@ select * from t1i where a1 in (select max(b1) from t2i where b1 > '0' group by b id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1i index it1i1,it1i3 # 18 # 3 100.00 # 1 PRIMARY <subquery2> eq_ref distinct_key # 8 # 1 100.00 # -2 MATERIALIZED t2i index it2i1,it2i3 # 9 # 5 100.00 # +2 MATERIALIZED t2i range it2i1,it2i3 # 9 # 5 100.00 # Warnings: Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select max(`test`.`t2i`.`b1`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1i` where (`<subquery2>`.`max(b1)` = `test`.`t1i`.`a1`) select * from t1i where a1 in (select max(b1) from t2i where b1 > '0' group by b1); @@ -566,6 +566,10 @@ Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.` select * from t1 group by (a1 in (select col from columns)); a1 a2 1 - 00 2 - 00 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1 - 00' +Warning 1292 Truncated incorrect DOUBLE value: '1 - 01' +Warning 1292 Truncated incorrect DOUBLE value: '1 - 02' /* ORDER BY clause */ explain extended select * from t1 order by (select col from columns limit 1); @@ -783,6 +787,10 @@ select left(a1,7), left(a2,7) from t1_512 where a1 in (select group_concat(b1) from t2_512 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() set @@group_concat_max_len = 256; explain extended select left(a1,7), left(a2,7) from t1_512 @@ -797,6 +805,10 @@ select left(a1,7), left(a2,7) from t1_512 where a1 in (select group_concat(b1) from t2_512 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() drop table t1_512, t2_512, t3_512; set @blob_len = 1024; set @suffix_len = @blob_len - @prefix_len; @@ -878,6 +890,10 @@ select left(a1,7), left(a2,7) from t1_1024 where a1 in (select group_concat(b1) from t2_1024 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() set @@group_concat_max_len = 256; explain extended select left(a1,7), left(a2,7) from t1_1024 @@ -892,6 +908,10 @@ select left(a1,7), left(a2,7) from t1_1024 where a1 in (select group_concat(b1) from t2_1024 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() drop table t1_1024, t2_1024, t3_1024; set @blob_len = 1025; set @suffix_len = @blob_len - @prefix_len; @@ -973,6 +993,10 @@ select left(a1,7), left(a2,7) from t1_1025 where a1 in (select group_concat(b1) from t2_1025 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() set @@group_concat_max_len = 256; explain extended select left(a1,7), left(a2,7) from t1_1025 @@ -987,6 +1011,10 @@ select left(a1,7), left(a2,7) from t1_1025 where a1 in (select group_concat(b1) from t2_1025 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() drop table t1_1025, t2_1025, t3_1025; create table t1bit (a1 bit(3), a2 bit(3)); create table t2bit (b1 bit(3), b2 bit(3)); diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result index 279af1e44d2..b02c9a0c6f5 100644 --- a/mysql-test/r/symlink.result +++ b/mysql-test/r/symlink.result @@ -202,6 +202,9 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/' +select create_options from information_schema.tables where table_name='t1'; +create_options +DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/' # CREATE TABLE LIKE statement on table with INDEX/DATA DIRECTORY # options should not fail. Per documentation newly created table # should not inherit value of these options from the original table. diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index 53797e2a0a4..bc4de8b4171 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -130,6 +130,8 @@ user CREATE TABLE `user` ( `authentication_string` text COLLATE utf8_bin NOT NULL, `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', + `max_statement_time` decimal(12,6) NOT NULL DEFAULT '0.000000', PRIMARY KEY (`Host`,`User`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges' show create table func; @@ -271,7 +273,8 @@ slow_log CREATE TABLE `slow_log` ( `insert_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, `sql_text` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' show create table table_stats; Table Create Table diff --git a/mysql-test/r/system_mysql_db_fix30020.result b/mysql-test/r/system_mysql_db_fix30020.result deleted file mode 100644 index 4c106ae2e5a..00000000000 --- a/mysql-test/r/system_mysql_db_fix30020.result +++ /dev/null @@ -1,311 +0,0 @@ -show tables; -Tables_in_db -column_stats -columns_priv -db -event -func -general_log -gtid_slave_pos -help_category -help_keyword -help_relation -help_topic -host -index_stats -innodb_index_stats -innodb_table_stats -plugin -proc -procs_priv -proxies_priv -roles_mapping -servers -slow_log -table_stats -tables_priv -time_zone -time_zone_leap_second -time_zone_name -time_zone_transition -time_zone_transition_type -user -show create table db; -Table Create Table -db CREATE TABLE `db` ( - `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', - `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - PRIMARY KEY (`Host`,`Db`,`User`), - KEY `User` (`User`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database privileges' -show create table host; -Table Create Table -host CREATE TABLE `host` ( - `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - PRIMARY KEY (`Host`,`Db`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Host privileges; Merged with database privileges' -show create table user; -Table Create Table -user CREATE TABLE `user` ( - `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', - `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', - `Password` char(41) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '', - `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Reload_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Shutdown_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Process_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `File_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Show_db_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Super_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Repl_slave_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Repl_client_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '', - `ssl_cipher` blob NOT NULL, - `x509_issuer` blob NOT NULL, - `x509_subject` blob NOT NULL, - `max_questions` int(11) unsigned NOT NULL DEFAULT '0', - `max_updates` int(11) unsigned NOT NULL DEFAULT '0', - `max_connections` int(11) unsigned NOT NULL DEFAULT '0', - `max_user_connections` int(11) NOT NULL DEFAULT '0', - `plugin` char(64) CHARACTER SET latin1 NOT NULL DEFAULT '', - `authentication_string` text COLLATE utf8_bin NOT NULL, - `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - PRIMARY KEY (`Host`,`User`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges' -show create table func; -Table Create Table -func CREATE TABLE `func` ( - `name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `ret` tinyint(1) NOT NULL DEFAULT '0', - `dl` char(128) COLLATE utf8_bin NOT NULL DEFAULT '', - `type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL, - PRIMARY KEY (`name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User defined functions' -show create table tables_priv; -Table Create Table -tables_priv CREATE TABLE `tables_priv` ( - `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', - `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '', - `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', - PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), - KEY `Grantor` (`Grantor`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Table privileges' -show create table columns_priv; -Table Create Table -columns_priv CREATE TABLE `columns_priv` ( - `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', - `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', - PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges' -show create table procs_priv; -Table Create Table -procs_priv CREATE TABLE `procs_priv` ( - `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', - `Routine_name` char(64) CHARACTER SET utf8 NOT NULL DEFAULT '', - `Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL, - `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', - `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`), - KEY `Grantor` (`Grantor`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges' -show create table servers; -Table Create Table -servers CREATE TABLE `servers` ( - `Server_name` char(64) NOT NULL DEFAULT '', - `Host` char(64) NOT NULL DEFAULT '', - `Db` char(64) NOT NULL DEFAULT '', - `Username` char(80) NOT NULL DEFAULT '', - `Password` char(64) NOT NULL DEFAULT '', - `Port` int(4) NOT NULL DEFAULT '0', - `Socket` char(64) NOT NULL DEFAULT '', - `Wrapper` char(64) NOT NULL DEFAULT '', - `Owner` char(64) NOT NULL DEFAULT '', - PRIMARY KEY (`Server_name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='MySQL Foreign Servers table' -show create table proc; -Table Create Table -proc CREATE TABLE `proc` ( - `db` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `name` char(64) NOT NULL DEFAULT '', - `type` enum('FUNCTION','PROCEDURE') NOT NULL, - `specific_name` char(64) NOT NULL DEFAULT '', - `language` enum('SQL') NOT NULL DEFAULT 'SQL', - `sql_data_access` enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA') NOT NULL DEFAULT 'CONTAINS_SQL', - `is_deterministic` enum('YES','NO') NOT NULL DEFAULT 'NO', - `security_type` enum('INVOKER','DEFINER') NOT NULL DEFAULT 'DEFINER', - `param_list` blob NOT NULL, - `returns` longblob NOT NULL, - `body` longblob NOT NULL, - `definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '', - `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, - `character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, - `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, - `db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, - `body_utf8` longblob, - PRIMARY KEY (`db`,`name`,`type`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures' -show create table event; -Table Create Table -event CREATE TABLE `event` ( - `db` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `name` char(64) NOT NULL DEFAULT '', - `body` longblob NOT NULL, - `definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `execute_at` datetime DEFAULT NULL, - `interval_value` int(11) DEFAULT NULL, - `interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `last_executed` datetime DEFAULT NULL, - `starts` datetime DEFAULT NULL, - `ends` datetime DEFAULT NULL, - `status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED', - `on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP', - `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '', - `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `originator` int(10) unsigned NOT NULL, - `time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', - `character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, - `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, - `db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, - `body_utf8` longblob, - PRIMARY KEY (`db`,`name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events' -show create table general_log; -Table Create Table -general_log CREATE TABLE `general_log` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `user_host` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL, - `server_id` int(10) unsigned NOT NULL, - `command_type` varchar(64) NOT NULL, - `argument` mediumtext NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log' -show create table slow_log; -Table Create Table -slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `user_host` mediumtext NOT NULL, - `query_time` time(6) NOT NULL, - `lock_time` time(6) NOT NULL, - `rows_sent` int(11) NOT NULL, - `rows_examined` int(11) NOT NULL, - `db` varchar(512) NOT NULL, - `last_insert_id` int(11) NOT NULL, - `insert_id` int(11) NOT NULL, - `server_id` int(10) unsigned NOT NULL, - `sql_text` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' -show create table table_stats; -Table Create Table -table_stats CREATE TABLE `table_stats` ( - `db_name` varchar(64) COLLATE utf8_bin NOT NULL, - `table_name` varchar(64) COLLATE utf8_bin NOT NULL, - `cardinality` bigint(21) unsigned DEFAULT NULL, - PRIMARY KEY (`db_name`,`table_name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Statistics on Tables' -show create table column_stats; -Table Create Table -column_stats CREATE TABLE `column_stats` ( - `db_name` varchar(64) COLLATE utf8_bin NOT NULL, - `table_name` varchar(64) COLLATE utf8_bin NOT NULL, - `column_name` varchar(64) COLLATE utf8_bin NOT NULL, - `min_value` varchar(255) COLLATE utf8_bin DEFAULT NULL, - `max_value` varchar(255) COLLATE utf8_bin DEFAULT NULL, - `nulls_ratio` decimal(12,4) DEFAULT NULL, - `avg_length` decimal(12,4) DEFAULT NULL, - `avg_frequency` decimal(12,4) DEFAULT NULL, - `hist_size` tinyint(3) unsigned DEFAULT NULL, - `hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB') COLLATE utf8_bin DEFAULT NULL, - `histogram` varbinary(255) DEFAULT NULL, - PRIMARY KEY (`db_name`,`table_name`,`column_name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Statistics on Columns' -show create table index_stats; -Table Create Table -index_stats CREATE TABLE `index_stats` ( - `db_name` varchar(64) COLLATE utf8_bin NOT NULL, - `table_name` varchar(64) COLLATE utf8_bin NOT NULL, - `index_name` varchar(64) COLLATE utf8_bin NOT NULL, - `prefix_arity` int(11) unsigned NOT NULL, - `avg_frequency` decimal(12,4) DEFAULT NULL, - PRIMARY KEY (`db_name`,`table_name`,`index_name`,`prefix_arity`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Statistics on Indexes' -show tables; -Tables_in_test diff --git a/mysql-test/r/system_mysql_db_fix40123.result b/mysql-test/r/system_mysql_db_fix40123.result index 53797e2a0a4..bc4de8b4171 100644 --- a/mysql-test/r/system_mysql_db_fix40123.result +++ b/mysql-test/r/system_mysql_db_fix40123.result @@ -130,6 +130,8 @@ user CREATE TABLE `user` ( `authentication_string` text COLLATE utf8_bin NOT NULL, `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', + `max_statement_time` decimal(12,6) NOT NULL DEFAULT '0.000000', PRIMARY KEY (`Host`,`User`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges' show create table func; @@ -271,7 +273,8 @@ slow_log CREATE TABLE `slow_log` ( `insert_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, `sql_text` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' show create table table_stats; Table Create Table diff --git a/mysql-test/r/system_mysql_db_fix50030.result b/mysql-test/r/system_mysql_db_fix50030.result index 53797e2a0a4..bc4de8b4171 100644 --- a/mysql-test/r/system_mysql_db_fix50030.result +++ b/mysql-test/r/system_mysql_db_fix50030.result @@ -130,6 +130,8 @@ user CREATE TABLE `user` ( `authentication_string` text COLLATE utf8_bin NOT NULL, `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', + `max_statement_time` decimal(12,6) NOT NULL DEFAULT '0.000000', PRIMARY KEY (`Host`,`User`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges' show create table func; @@ -271,7 +273,8 @@ slow_log CREATE TABLE `slow_log` ( `insert_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, `sql_text` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' show create table table_stats; Table Create Table diff --git a/mysql-test/r/system_mysql_db_fix50117.result b/mysql-test/r/system_mysql_db_fix50117.result index 53797e2a0a4..bc4de8b4171 100644 --- a/mysql-test/r/system_mysql_db_fix50117.result +++ b/mysql-test/r/system_mysql_db_fix50117.result @@ -130,6 +130,8 @@ user CREATE TABLE `user` ( `authentication_string` text COLLATE utf8_bin NOT NULL, `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', + `max_statement_time` decimal(12,6) NOT NULL DEFAULT '0.000000', PRIMARY KEY (`Host`,`User`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges' show create table func; @@ -271,7 +273,8 @@ slow_log CREATE TABLE `slow_log` ( `insert_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, `sql_text` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' show create table table_stats; Table Create Table diff --git a/mysql-test/r/table_elim.result b/mysql-test/r/table_elim.result index c633261bcd3..3e0cc480aec 100644 --- a/mysql-test/r/table_elim.result +++ b/mysql-test/r/table_elim.result @@ -682,20 +682,14 @@ SET optimizer_switch=@save_optimizer_switch; # (just a testcase) CREATE TABLE t1 ( PostID int(10) unsigned NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -Warnings: -Warning 1286 Unknown storage engine 'InnoDB' -Warning 1266 Using storage engine MyISAM for table 't1' +) DEFAULT CHARSET=utf8; INSERT INTO t1 (PostID) VALUES (1), (2); CREATE TABLE t2 ( VoteID int(10) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, EntityID int(10) unsigned NOT NULL, UserID int(10) unsigned NOT NULL, UNIQUE KEY EntityID (EntityID,UserID) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -Warnings: -Warning 1286 Unknown storage engine 'InnoDB' -Warning 1266 Using storage engine MyISAM for table 't2' +) DEFAULT CHARSET=utf8; INSERT INTO t2 (EntityID, UserID) VALUES (1, 30), (2, 30); SELECT t1.*, T.Voted as Voted FROM diff --git a/mysql-test/r/table_options-5867.result b/mysql-test/r/table_options-5867.result index 21041c7c5c3..f915c2740ae 100644 --- a/mysql-test/r/table_options-5867.result +++ b/mysql-test/r/table_options-5867.result @@ -14,7 +14,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL `complex`='c,f,f,f' `invalid`=3 -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=10000 `str`='dskj' `one_or_two`='one' `yesno`=0 `foobar`=barfoo `VAROPT`='5' +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=10000 `str`='dskj' `one_or_two`='one' `yesno`=0 `foobar`=barfoo show create table t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -26,7 +26,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL `complex`='c,f,f,f' /* `invalid`=3 */ -) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=10000 `str`='dskj' `one_or_two`='one' `yesno`=0 /* `foobar`=barfoo */ `VAROPT`='5' +) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=10000 `str`='dskj' `one_or_two`='one' `yesno`=0 /* `foobar`=barfoo */ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result index 0a1701be0d7..ee0b3ab6d48 100644 --- a/mysql-test/r/temp_table.result +++ b/mysql-test/r/temp_table.result @@ -128,7 +128,7 @@ This is temp. table show create table v1; Table Create Table v1 CREATE TEMPORARY TABLE `v1` ( - `A` varchar(19) NOT NULL DEFAULT '' + `A` varchar(19) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show create view v1; View Create View character_set_client collation_connection @@ -291,3 +291,20 @@ test.t1 repair status OK test.t2 repair status OK test.t3 repair status OK DROP TABLES t1, t2, t3; +create temporary temporary table t1 (a int); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'temporary table t1 (a int)' at line 1 +flush status; +create table t1 (a int); +create temporary table t2 (a int); +create temporary table t3 (a int); +drop table t1; +drop table t2; +drop temporary table t3; +show status like 'com_create%table'; +Variable_name Value +Com_create_table 1 +Com_create_temporary_table 2 +show status like 'com_drop%table'; +Variable_name Value +Com_drop_table 2 +Com_drop_temporary_table 1 diff --git a/mysql-test/r/temp_table_frm.result b/mysql-test/r/temp_table_frm.result new file mode 100644 index 00000000000..19c66380af2 --- /dev/null +++ b/mysql-test/r/temp_table_frm.result @@ -0,0 +1,21 @@ +set @@session.max_heap_table_size=16*1024*1024; +create table t1 select * from information_schema.session_status where variable_name like 'Opened%'; +create temporary table t2 (a int) engine=memory; +select variable_name, session_status.variable_value - t1.variable_value +from information_schema.session_status join t1 using (variable_name); +variable_name session_status.variable_value - t1.variable_value +OPENED_FILES 0 +OPENED_PLUGIN_LIBRARIES 0 +OPENED_TABLE_DEFINITIONS 2 +OPENED_TABLES 1 +OPENED_VIEWS 0 +truncate table t2; +select variable_name, session_status.variable_value - t1.variable_value +from information_schema.session_status join t1 using (variable_name); +variable_name session_status.variable_value - t1.variable_value +OPENED_FILES 0 +OPENED_PLUGIN_LIBRARIES 0 +OPENED_TABLE_DEFINITIONS 2 +OPENED_TABLES 1 +OPENED_VIEWS 0 +drop table t1; diff --git a/mysql-test/r/temporal_literal.result b/mysql-test/r/temporal_literal.result index e317eba37f0..f4f43fe9ba3 100644 --- a/mysql-test/r/temporal_literal.result +++ b/mysql-test/r/temporal_literal.result @@ -40,7 +40,7 @@ CREATE TABLE t1 AS SELECT DATE'2010-01-01'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `DATE'2010-01-01'` date NOT NULL DEFAULT '0000-00-00' + `DATE'2010-01-01'` date NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 AS SELECT @@ -50,9 +50,9 @@ CREATE TABLE t1 AS SELECT SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `{d'2001-01-01'}` date NOT NULL DEFAULT '0000-00-00', - `{ d '2001-01-01' }` date NOT NULL DEFAULT '0000-00-00', - `2001-01-01 10:10:10` varchar(19) NOT NULL DEFAULT '' + `{d'2001-01-01'}` date NOT NULL, + `{ d '2001-01-01' }` date NOT NULL, + `2001-01-01 10:10:10` varchar(19) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; EXPLAIN EXTENDED SELECT {d'2010-01-01'}; @@ -150,14 +150,14 @@ TIME'10:10:10.123456'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `TIME'10:10:10'` time NOT NULL DEFAULT '00:00:00', - `TIME'10:10:10.'` time NOT NULL DEFAULT '00:00:00', - `TIME'10:10:10.1'` time(1) NOT NULL DEFAULT '00:00:00.0', - `TIME'10:10:10.12'` time(2) NOT NULL DEFAULT '00:00:00.00', - `TIME'10:10:10.123'` time(3) NOT NULL DEFAULT '00:00:00.000', - `TIME'10:10:10.1234'` time(4) NOT NULL DEFAULT '00:00:00.0000', - `TIME'10:10:10.12345'` time(5) NOT NULL DEFAULT '00:00:00.00000', - `TIME'10:10:10.123456'` time(6) NOT NULL DEFAULT '00:00:00.000000' + `TIME'10:10:10'` time NOT NULL, + `TIME'10:10:10.'` time NOT NULL, + `TIME'10:10:10.1'` time(1) NOT NULL, + `TIME'10:10:10.12'` time(2) NOT NULL, + `TIME'10:10:10.123'` time(3) NOT NULL, + `TIME'10:10:10.1234'` time(4) NOT NULL, + `TIME'10:10:10.12345'` time(5) NOT NULL, + `TIME'10:10:10.123456'` time(6) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 AS SELECT @@ -169,11 +169,11 @@ CREATE TABLE t1 AS SELECT SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `{t'10:10:10'}` time NOT NULL DEFAULT '00:00:00', - `{ t '10:10:10' }` time NOT NULL DEFAULT '00:00:00', - `{t'10:10:10.'}` time NOT NULL DEFAULT '00:00:00', - `{t'10:10:10.123456'}` time(6) NOT NULL DEFAULT '00:00:00.000000', - `2001-01-01` varchar(10) NOT NULL DEFAULT '' + `{t'10:10:10'}` time NOT NULL, + `{ t '10:10:10' }` time NOT NULL, + `{t'10:10:10.'}` time NOT NULL, + `{t'10:10:10.123456'}` time(6) NOT NULL, + `2001-01-01` varchar(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; EXPLAIN EXTENDED SELECT {t'10:01:01'}; @@ -242,14 +242,14 @@ TIMESTAMP'2010-01-01 10:10:10.123456'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `TIMESTAMP'2010-01-01 10:10:10'` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `TIMESTAMP'2010-01-01 10:10:10.'` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `TIMESTAMP'2010-01-01 10:10:10.1'` datetime(1) NOT NULL DEFAULT '0000-00-00 00:00:00.0', - `TIMESTAMP'2010-01-01 10:10:10.12'` datetime(2) NOT NULL DEFAULT '0000-00-00 00:00:00.00', - `TIMESTAMP'2010-01-01 10:10:10.123'` datetime(3) NOT NULL DEFAULT '0000-00-00 00:00:00.000', - `TIMESTAMP'2010-01-01 10:10:10.1234'` datetime(4) NOT NULL DEFAULT '0000-00-00 00:00:00.0000', - `TIMESTAMP'2010-01-01 10:10:10.12345'` datetime(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000', - `TIMESTAMP'2010-01-01 10:10:10.123456'` datetime(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' + `TIMESTAMP'2010-01-01 10:10:10'` datetime NOT NULL, + `TIMESTAMP'2010-01-01 10:10:10.'` datetime NOT NULL, + `TIMESTAMP'2010-01-01 10:10:10.1'` datetime(1) NOT NULL, + `TIMESTAMP'2010-01-01 10:10:10.12'` datetime(2) NOT NULL, + `TIMESTAMP'2010-01-01 10:10:10.123'` datetime(3) NOT NULL, + `TIMESTAMP'2010-01-01 10:10:10.1234'` datetime(4) NOT NULL, + `TIMESTAMP'2010-01-01 10:10:10.12345'` datetime(5) NOT NULL, + `TIMESTAMP'2010-01-01 10:10:10.123456'` datetime(6) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 AS SELECT @@ -261,11 +261,11 @@ CREATE TABLE t1 AS SELECT SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `{ts'2001-01-01 10:10:10'}` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `{ ts '2001-01-01 10:10:10' }` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `{ts'2001-01-01 10:10:10.'}` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `{ts'2001-01-01 10:10:10.123456'}` datetime(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', - `2001-01-01` varchar(10) NOT NULL DEFAULT '' + `{ts'2001-01-01 10:10:10'}` datetime NOT NULL, + `{ ts '2001-01-01 10:10:10' }` datetime NOT NULL, + `{ts'2001-01-01 10:10:10.'}` datetime NOT NULL, + `{ts'2001-01-01 10:10:10.123456'}` datetime(6) NOT NULL, + `2001-01-01` varchar(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; EXPLAIN EXTENDED SELECT {ts'2010-01-01 10:10:10'}; @@ -590,8 +590,8 @@ DATE'2001-01-00'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `DATE'2001-01-01'` date NOT NULL DEFAULT '0000-00-00', - `DATE'0000-01-01'` date NOT NULL DEFAULT '0000-00-00', + `DATE'2001-01-01'` date NOT NULL, + `DATE'0000-01-01'` date NOT NULL, `DATE'2001-00-00'` date DEFAULT NULL, `DATE'2001-00-01'` date DEFAULT NULL, `DATE'2001-01-00'` date DEFAULT NULL @@ -606,8 +606,8 @@ TIMESTAMP'2001-01-00 00:00:00'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `TIMESTAMP'2001-01-01 00:00:00'` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `TIMESTAMP'0000-01-01 00:00:00'` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `TIMESTAMP'2001-01-01 00:00:00'` datetime NOT NULL, + `TIMESTAMP'0000-01-01 00:00:00'` datetime NOT NULL, `TIMESTAMP'2001-00-00 00:00:00'` datetime DEFAULT NULL, `TIMESTAMP'2001-00-01 00:00:00'` datetime DEFAULT NULL, `TIMESTAMP'2001-01-00 00:00:00'` datetime DEFAULT NULL diff --git a/mysql-test/r/timezone_grant.result b/mysql-test/r/timezone_grant.result index 49918038da5..d33d92dbc9e 100644 --- a/mysql-test/r/timezone_grant.result +++ b/mysql-test/r/timezone_grant.result @@ -7,6 +7,7 @@ delete from mysql.columns_priv where user like 'mysqltest\_%'; flush privileges; create table t1 (a int, b datetime); create table t2 (c int, d datetime); +create user mysqltest_1@localhost; grant all privileges on test.* to mysqltest_1@localhost; show grants for current_user(); Grants for mysqltest_1@localhost @@ -63,6 +64,7 @@ flush privileges; drop table t1, t2; create table t1 (a int, b datetime); insert into t1 values (1, 20010101000000), (2, 20020101000000); +create user mysqltest_1@localhost; grant all privileges on test.* to mysqltest_1@localhost; create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1; select * from v1; diff --git a/mysql-test/r/trigger-compat.result b/mysql-test/r/trigger-compat.result index 8caba961624..7659667fb37 100644 --- a/mysql-test/r/trigger-compat.result +++ b/mysql-test/r/trigger-compat.result @@ -29,8 +29,8 @@ wl2818_trg2 mysqltest_dfn@localhost SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name; TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION -def mysqltest_db1 wl2818_trg1 INSERT def mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW BEFORE NULL NULL OLD NEW NULL latin1 latin1_swedish_ci latin1_swedish_ci -def mysqltest_db1 wl2818_trg2 INSERT def mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW AFTER NULL NULL OLD NEW NULL mysqltest_dfn@localhost latin1 latin1_swedish_ci latin1_swedish_ci +def mysqltest_db1 wl2818_trg1 INSERT def mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW BEFORE NULL NULL OLD NEW NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci +def mysqltest_db1 wl2818_trg2 INSERT def mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW AFTER NULL NULL OLD NEW NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION mysqltest_dfn@localhost latin1 latin1_swedish_ci latin1_swedish_ci DROP TRIGGER wl2818_trg1; Warnings: Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'wl2818_trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger. diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index 8bf31766031..86219875bed 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -214,12 +214,14 @@ end if; end| insert into t3 values (1); insert into t1 values (4, "four", 1), (5, "five", 2); -ERROR 23000: Column 'id' cannot be null +Warnings: +Warning 1048 Column 'id' cannot be null select * from t1; id data fk 1 one NULL 2 two NULL 4 four 1 +0 five 2 select * from t2; event INSERT INTO t1 id=1 data='one' @@ -415,6 +417,13 @@ i j k @b 15 NULL 15 Fired set @b:=""; load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, j); +Warnings: +Note 1265 Data truncated for column 'i' at row 1 +Note 1265 Data truncated for column 'j' at row 1 +Note 1265 Data truncated for column 'i' at row 2 +Note 1265 Data truncated for column 'j' at row 2 +Note 1265 Data truncated for column 'i' at row 3 +Note 1265 Data truncated for column 'j' at row 3 select *, @b from t1; i j k @b 10 NULL 10 Fired @@ -1957,6 +1966,8 @@ drop table if exists t1; create table t1 (i int, j int); create trigger t1_bi before insert on t1 for each row begin end; create trigger t1_bi before insert on t1 for each row begin end; +ERROR HY000: Trigger already exists +create trigger t1_bi2 before insert on t1 for each row begin end; ERROR 42000: This version of MariaDB doesn't yet support 'multiple triggers with the same action time and event for one table' drop trigger t1_bi; drop trigger t1_bi; @@ -2264,3 +2275,18 @@ SET optimizer_switch=@save_optimizer_switch; DROP TRIGGER tr; DROP TABLE t1, t2; End of 5.3 tests. +SET @@session.sql_mode = 'STRICT_ALL_TABLES,STRICT_TRANS_TABLES'; +CREATE TABLE t1 (c CHAR(1) NOT NULL); +CREATE TRIGGER t1_bi +BEFORE INSERT +ON t1 +FOR EACH ROW +BEGIN +SET NEW.c = 'www'; +END; +| +SET @@session.sql_mode = default; +INSERT INTO t1 VALUES ('a'); +ERROR 22001: Data too long for column 'c' at row 1 +DROP TRIGGER t1_bi; +DROP TABLE t1; diff --git a/mysql-test/r/trigger_notembedded.result b/mysql-test/r/trigger_notembedded.result index ef86e4c496c..795f722b0d4 100644 --- a/mysql-test/r/trigger_notembedded.result +++ b/mysql-test/r/trigger_notembedded.result @@ -138,8 +138,8 @@ INSERT INTO t1 VALUES(6); ERROR HY000: The user specified as a definer ('mysqltest_nonexs'@'localhost') does not exist SHOW TRIGGERS; Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation -trg1 INSERT t1 SET @new_sum = 0 BEFORE NULL mysqltest_inv@localhost latin1 latin1_swedish_ci latin1_swedish_ci -trg2 INSERT t1 SET @new_sum = 0 AFTER NULL mysqltest_nonexs@localhost latin1 latin1_swedish_ci latin1_swedish_ci +trg1 INSERT t1 SET @new_sum = 0 BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION mysqltest_inv@localhost latin1 latin1_swedish_ci latin1_swedish_ci +trg2 INSERT t1 SET @new_sum = 0 AFTER NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION mysqltest_nonexs@localhost latin1 latin1_swedish_ci latin1_swedish_ci DROP TRIGGER trg1; DROP TRIGGER trg2; CREATE TRIGGER trg1 BEFORE INSERT ON t1 @@ -168,11 +168,11 @@ trg5 @abcdef@@@hostname SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name; TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION -def mysqltest_db1 trg1 INSERT def mysqltest_db1 t1 0 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW NULL latin1 latin1_swedish_ci latin1_swedish_ci -def mysqltest_db1 trg2 INSERT def mysqltest_db1 t1 0 NULL SET @a = 2 ROW AFTER NULL NULL OLD NEW NULL @ latin1 latin1_swedish_ci latin1_swedish_ci -def mysqltest_db1 trg3 UPDATE def mysqltest_db1 t1 0 NULL SET @a = 3 ROW BEFORE NULL NULL OLD NEW NULL @abc@def@@% latin1 latin1_swedish_ci latin1_swedish_ci -def mysqltest_db1 trg4 UPDATE def mysqltest_db1 t1 0 NULL SET @a = 4 ROW AFTER NULL NULL OLD NEW NULL @hostname latin1 latin1_swedish_ci latin1_swedish_ci -def mysqltest_db1 trg5 DELETE def mysqltest_db1 t1 0 NULL SET @a = 5 ROW BEFORE NULL NULL OLD NEW NULL @abcdef@@@hostname latin1 latin1_swedish_ci latin1_swedish_ci +def mysqltest_db1 trg1 INSERT def mysqltest_db1 t1 0 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION latin1 latin1_swedish_ci latin1_swedish_ci +def mysqltest_db1 trg2 INSERT def mysqltest_db1 t1 0 NULL SET @a = 2 ROW AFTER NULL NULL OLD NEW NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION @ latin1 latin1_swedish_ci latin1_swedish_ci +def mysqltest_db1 trg3 UPDATE def mysqltest_db1 t1 0 NULL SET @a = 3 ROW BEFORE NULL NULL OLD NEW NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION @abc@def@@% latin1 latin1_swedish_ci latin1_swedish_ci +def mysqltest_db1 trg4 UPDATE def mysqltest_db1 t1 0 NULL SET @a = 4 ROW AFTER NULL NULL OLD NEW NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION @hostname latin1 latin1_swedish_ci latin1_swedish_ci +def mysqltest_db1 trg5 DELETE def mysqltest_db1 t1 0 NULL SET @a = 5 ROW BEFORE NULL NULL OLD NEW NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION @abcdef@@@hostname latin1 latin1_swedish_ci latin1_swedish_ci ---> connection: default DROP USER mysqltest_dfn@localhost; @@ -502,6 +502,7 @@ DROP DATABASE db1; DROP DATABASE IF EXISTS mysqltest_db1; CREATE DATABASE mysqltest_db1; USE mysqltest_db1; +CREATE USER mysqltest_u1@localhost; GRANT ALL ON mysqltest_db1.* TO mysqltest_u1@localhost; CREATE TABLE t1 ( a1 int, diff --git a/mysql-test/r/trigger_null-8605.result b/mysql-test/r/trigger_null-8605.result new file mode 100644 index 00000000000..e024bc6b7d2 --- /dev/null +++ b/mysql-test/r/trigger_null-8605.result @@ -0,0 +1,357 @@ +set sql_mode=strict_all_tables; +set time_zone="+02:00"; +create table t1 (a int not null, b int, c int); +create trigger trgi before insert on t1 for each row set new.a=if(new.a is null,new.b,new.c); +insert t1 values (10, NULL, 1); +insert t1 values (NULL, 2, NULL); +insert t1 values (NULL, NULL, 20); +ERROR 23000: Column 'a' cannot be null +insert t1 values (1, 2, NULL); +ERROR 23000: Column 'a' cannot be null +select * from t1; +a b c +1 NULL 1 +2 2 NULL +insert ignore t1 values (NULL, NULL, 30); +Warnings: +Warning 1048 Column 'a' cannot be null +insert ignore t1 values (1, 3, NULL); +Warnings: +Warning 1048 Column 'a' cannot be null +select * from t1; +a b c +1 NULL 1 +2 2 NULL +0 NULL 30 +0 3 NULL +insert t1 set a=NULL, b=4, c=a; +select * from t1; +a b c +1 NULL 1 +2 2 NULL +0 NULL 30 +0 3 NULL +4 4 NULL +delete from t1; +insert t1 (a,c) values (10, 1); +insert t1 (a,b) values (NULL, 2); +insert t1 (a,c) values (NULL, 20); +ERROR 23000: Column 'a' cannot be null +insert t1 (a,b) values (1, 2); +ERROR 23000: Column 'a' cannot be null +select * from t1; +a b c +1 NULL 1 +2 2 NULL +delete from t1; +insert t1 select 10, NULL, 1; +insert t1 select NULL, 2, NULL; +insert t1 select NULL, NULL, 20; +ERROR 23000: Column 'a' cannot be null +insert t1 select 1, 2, NULL; +ERROR 23000: Column 'a' cannot be null +insert ignore t1 select NULL, NULL, 30; +Warnings: +Warning 1048 Column 'a' cannot be null +insert ignore t1 select 1, 3, NULL; +Warnings: +Warning 1048 Column 'a' cannot be null +select * from t1; +a b c +1 NULL 1 +2 2 NULL +0 NULL 30 +0 3 NULL +delete from t1; +insert delayed t1 values (10, NULL, 1); +insert delayed t1 values (NULL, 2, NULL); +insert delayed t1 values (NULL, NULL, 20); +ERROR 23000: Column 'a' cannot be null +insert delayed t1 values (1, 2, NULL); +ERROR 23000: Column 'a' cannot be null +select * from t1; +a b c +1 NULL 1 +2 2 NULL +insert delayed ignore t1 values (NULL, NULL, 30); +Warnings: +Warning 1048 Column 'a' cannot be null +insert delayed ignore t1 values (1, 3, NULL); +Warnings: +Warning 1048 Column 'a' cannot be null +flush table t1; +select * from t1; +a b c +1 NULL 1 +2 2 NULL +0 NULL 30 +0 3 NULL +delete from t1; +alter table t1 add primary key (a); +create trigger trgu before update on t1 for each row set new.a=if(new.a is null,new.b,new.c); +insert t1 values (100,100,100), (200,200,200), (300,300,300); +insert t1 values (100,100,100) on duplicate key update a=10, b=NULL, c=1; +insert t1 values (200,200,200) on duplicate key update a=NULL, b=2, c=NULL; +insert t1 values (300,300,300) on duplicate key update a=NULL, b=NULL, c=20; +ERROR 23000: Column 'a' cannot be null +insert t1 values (300,300,300) on duplicate key update a=1, b=2, c=NULL; +ERROR 23000: Column 'a' cannot be null +select * from t1; +a b c +1 NULL 1 +2 2 NULL +300 300 300 +delete from t1; +insert t1 values (1,100,1), (2,200,2); +replace t1 values (10, NULL, 1); +replace t1 values (NULL, 2, NULL); +replace t1 values (NULL, NULL, 30); +ERROR 23000: Column 'a' cannot be null +replace t1 values (1, 3, NULL); +ERROR 23000: Column 'a' cannot be null +select * from t1; +a b c +1 NULL 1 +2 2 NULL +delete from t1; +insert t1 values (100,100,100), (200,200,200), (300,300,300); +update t1 set a=10, b=NULL, c=1 where a=100; +update t1 set a=NULL, b=2, c=NULL where a=200; +update t1 set a=NULL, b=NULL, c=20 where a=300; +ERROR 23000: Column 'a' cannot be null +update t1 set a=1, b=2, c=NULL where a=300; +ERROR 23000: Column 'a' cannot be null +select * from t1; +a b c +1 NULL 1 +2 2 NULL +300 300 300 +set statement sql_mode='' for update t1 set a=1, b=2, c=NULL where a > 1; +ERROR 23000: Duplicate entry '0' for key 'PRIMARY' +select * from t1; +a b c +1 NULL 1 +0 2 NULL +300 300 300 +update t1 set a=NULL, b=4, c=a where a=300; +select * from t1; +a b c +1 NULL 1 +0 2 NULL +4 4 NULL +delete from t1; +create table t2 (d int, e int); +insert t1 values (100,100,100), (200,200,200), (300,300,300); +insert t2 select a,b from t1; +update t1,t2 set a=10, b=NULL, c=1 where b=d and e=100; +update t1,t2 set a=NULL, b=2, c=NULL where b=d and e=200; +update t1,t2 set a=NULL, b=NULL, c=20 where b=d and e=300; +ERROR 23000: Column 'a' cannot be null +update t1,t2 set a=1, b=2, c=NULL where b=d and e=300; +ERROR 23000: Column 'a' cannot be null +select * from t1; +a b c +1 NULL 1 +2 2 NULL +300 300 300 +update t1,t2 set a=NULL, b=4, c=a where b=d and e=300; +select * from t1; +a b c +1 NULL 1 +2 2 NULL +4 4 300 +delete from t1; +insert t2 values (2,2); +create view v1 as select * from t1, t2 where d=2; +insert v1 (a,c) values (10, 1); +insert v1 (a,b) values (NULL, 2); +insert v1 (a,c) values (NULL, 20); +ERROR 23000: Column 'a' cannot be null +insert v1 (a,b) values (1, 2); +ERROR 23000: Column 'a' cannot be null +select * from v1; +a b c d e +1 NULL 1 2 2 +2 2 NULL 2 2 +delete from t1; +drop view v1; +drop table t2; +load data infile 'mdev8605.txt' into table t1 fields terminated by ','; +ERROR 23000: Column 'a' cannot be null +select * from t1; +a b c +1 NULL 1 +2 2 NULL +drop table t1; +create table t1 (a timestamp, b int auto_increment primary key); +create trigger trgi before insert on t1 for each row set new.a=if(new.a is null, '2000-10-20 10:20:30', NULL); +set statement timestamp=777777777 for insert t1 (a) values (NULL); +set statement timestamp=888888888 for insert t1 (a) values ('1999-12-11 10:9:8'); +select b, a, unix_timestamp(a) from t1; +b a unix_timestamp(a) +1 2000-10-20 10:20:30 972030030 +2 1998-03-03 03:34:48 888888888 +set statement timestamp=999999999 for update t1 set b=3 where b=2; +select b, a, unix_timestamp(a) from t1; +b a unix_timestamp(a) +1 2000-10-20 10:20:30 972030030 +3 2001-09-09 03:46:39 999999999 +create trigger trgu before update on t1 for each row set new.a='2011-11-11 11:11:11'; +update t1 set b=4 where b=3; +select b, a, unix_timestamp(a) from t1; +b a unix_timestamp(a) +1 2000-10-20 10:20:30 972030030 +4 2011-11-11 11:11:11 1321002671 +drop table t1; +create table t1 (a int auto_increment primary key); +create trigger trgi before insert on t1 for each row set new.a=if(new.a is null, 5, NULL); +insert t1 values (NULL); +insert t1 values (10); +select a from t1; +a +5 +6 +drop table t1; +create table t1 (a int, b int, c int); +create trigger trgi before insert on t1 for each row set new.a=if(new.a is null,new.b,new.c); +insert t1 values (10, NULL, 1); +insert t1 values (NULL, 2, NULL); +insert t1 values (NULL, NULL, 20); +insert t1 values (1, 2, NULL); +select * from t1; +a b c +1 NULL 1 +2 2 NULL +NULL NULL 20 +NULL 2 NULL +drop table t1; +create table t1 (a1 tinyint not null, a2 timestamp not null, +a3 tinyint not null auto_increment primary key, +b tinyint, c int not null); +create trigger trgi before insert on t1 for each row +begin +if new.b=1 then set new.a1=if(new.c,new.c,null); end if; +if new.b=2 then set new.a2=if(new.c,new.c,null); end if; +if new.b=3 then set new.a3=if(new.c,new.c,null); end if; +end| +set statement timestamp=777777777 for +load data infile 'sep8605.txt' into table t1 fields terminated by ','; +ERROR 23000: Column 'a1' cannot be null +select * from t1; +a1 a2 a3 b c +1 2010-11-12 01:02:03 10 0 0 +2 2010-11-12 01:02:03 11 1 2 +3 1994-08-25 03:22:57 12 0 0 +4 2000-09-08 07:06:05 13 2 908070605 +5 1994-08-25 03:22:57 14 2 0 +6 2010-11-12 01:02:03 15 0 0 +7 2010-11-12 01:02:03 20 3 20 +8 2010-11-12 01:02:03 21 3 0 +delete from t1; +set statement timestamp=777777777 for +load data infile 'sep8605.txt' into table t1 fields terminated by ',' + (@a,a2,a3,b,c) set a1=100-@a; +ERROR 23000: Column 'a1' cannot be null +select 100-a1,a2,a3,b,c from t1; +100-a1 a2 a3 b c +1 2010-11-12 01:02:03 10 0 0 +98 2010-11-12 01:02:03 11 1 2 +3 1994-08-25 03:22:57 12 0 0 +4 2000-09-08 07:06:05 13 2 908070605 +5 1994-08-25 03:22:57 14 2 0 +6 2010-11-12 01:02:03 22 0 0 +7 2010-11-12 01:02:03 20 3 20 +8 2010-11-12 01:02:03 23 3 0 +delete from t1; +set statement timestamp=777777777 for +load data infile 'fix8605.txt' into table t1 fields terminated by ''; +ERROR 23000: Column 'a1' cannot be null +select * from t1; +a1 a2 a3 b c +1 2010-11-12 01:02:03 10 0 0 +5 1994-08-25 03:22:57 14 2 0 +8 2010-11-12 01:02:03 24 3 0 +delete from t1; +set statement timestamp=777777777 for +load xml infile 'xml8605.txt' into table t1 rows identified by '<row>'; +ERROR 23000: Column 'a1' cannot be null +select * from t1; +a1 a2 a3 b c +1 2010-11-12 01:02:03 10 0 0 +2 2010-11-12 01:02:03 11 1 2 +3 1994-08-25 03:22:57 12 0 0 +4 2000-09-08 07:06:05 13 2 908070605 +5 1994-08-25 03:22:57 14 2 0 +6 2010-11-12 01:02:03 25 0 0 +7 2010-11-12 01:02:03 20 3 20 +8 2010-11-12 01:02:03 26 3 0 +drop table t1; +create table t1 (a int not null default 5, b int, c int); +create trigger trgi before insert on t1 for each row set new.b=new.c; +insert t1 values (DEFAULT,2,1); +select * from t1; +a b c +5 1 1 +drop table t1; +create table t1 (a int not null, b int not null default 5, c int); +create trigger trgi before insert on t1 for each row +begin +if new.c=1 then set new.a=1, new.b=1; end if; +if new.c=2 then set new.a=NULL, new.b=NULL; end if; +if new.c=3 then set new.a=2; end if; +end| +insert t1 values (9, 9, 1); +insert t1 values (9, 9, 2); +ERROR 23000: Column 'a' cannot be null +insert t1 (a,c) values (9, 3); +select * from t1; +a b c +1 1 1 +2 5 3 +drop table t1; +set session sql_mode ='no_auto_value_on_zero'; +create table t1 (id int unsigned auto_increment primary key); +insert t1 values (0); +select * from t1; +id +0 +delete from t1; +create trigger t1_bi before insert on t1 for each row begin end; +insert t1 values (0); +select * from t1; +id +0 +drop table t1; +create table t1 (a int not null, b int); +create trigger trgi before update on t1 for each row do 1; +insert t1 values (1,1),(2,2),(3,3),(1,4); +create table t2 select a as c, b as d from t1; +update t1 set a=(select count(c) from t2 where c+1=a+1 group by a); +select * from t1; +a b +2 1 +1 2 +1 3 +2 4 +drop table t1, t2; +create table t1 (a int not null); +create table t2 (f1 int unsigned not null, f2 int); +insert into t2 values (1, null); +create trigger tr1 before update on t1 for each row do 1; +create trigger tr2 after update on t2 for each row update t1 set a=new.f2; +update t2 set f2=1 where f1=1; +drop table t1, t2; +create table t1 (a int not null, primary key (a)); +insert into t1 (a) values (1); +show columns from t1; +Field Type Null Key Default Extra +a int(11) NO PRI NULL +create trigger t1bu before update on t1 for each row begin end; +show columns from t1; +Field Type Null Key Default Extra +a int(11) NO PRI NULL +insert into t1 (a) values (3); +show columns from t1; +Field Type Null Key Default Extra +a int(11) NO PRI NULL +drop table t1; diff --git a/mysql-test/r/truncate.result b/mysql-test/r/truncate.result index 773075f9dae..9b4cb4a36d9 100644 --- a/mysql-test/r/truncate.result +++ b/mysql-test/r/truncate.result @@ -142,7 +142,7 @@ TRUNCATE p1; ERROR 42S02: Table 'test.p1' doesn't exist SHOW CREATE PROCEDURE p1; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() +p1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() SET @a = 5 latin1 latin1_swedish_ci latin1_swedish_ci DROP PROCEDURE p1; # diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index f7816208887..132de86e27b 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -506,6 +506,8 @@ create table t1 (id integer auto_increment unique,imagem LONGBLOB not null defau Warnings: Warning 1101 BLOB/TEXT column 'imagem' can't have a default value insert into t1 (id) values (1); +Warnings: +Warning 1364 Field 'imagem' doesn't have a default value select charset(load_file('../../std_data/words.dat')), collation(load_file('../../std_data/words.dat')), @@ -711,10 +713,10 @@ alter table t1 add key (a,b,d,e); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL DEFAULT '0', - `b` int(11) NOT NULL DEFAULT '0', + `a` int(11) NOT NULL, + `b` int(11) NOT NULL, `c` tinyblob NOT NULL, - `d` int(11) NOT NULL DEFAULT '0', + `d` int(11) NOT NULL, `e` int(11) DEFAULT NULL, PRIMARY KEY (`a`,`b`,`c`(255),`d`), KEY `a` (`a`,`b`,`d`,`e`) diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 95b82bdef82..55de3b39f2d 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -463,9 +463,9 @@ LEAST(IFNULL(t2.date_fin, IFNULL(t1.date_fin, NULL)), IFNULL(t1.date_fin, IFNULL(t2.date_fin, NULL))) AS date_fin FROM t1 LEFT JOIN t2 ON (t1.id=t2.id); id date_debut date_fin -1 2016-01-01 2016-01-31 00:00:00 -2 2016-02-01 2016-01-28 00:00:00 -3 2016-03-01 2016-03-31 00:00:00 +1 2016-01-01 2016-01-31 +2 2016-02-01 2016-01-28 +3 2016-03-01 2016-03-31 4 2016-04-01 NULL DROP TABLE t1,t2; SELECT @@ -482,3 +482,363 @@ SELECT GROUP_CONCAT(f2, IF(f1, f2, f1), f1 ORDER BY 2,1,3) FROM t1; GROUP_CONCAT(f2, IF(f1, f2, f1), f1 ORDER BY 2,1,3) aa1900-01-01,aa2003-04-27 DROP TABLE t1; +# +# Start of 10.1 tests +# +# +# MDEV-7824 [Bug #68041] Zero date can be inserted in strict no-zero mode through a default value +# +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a DATE DEFAULT '0000-00-00'); +SET sql_mode=TRADITIONAL; +INSERT INTO t1 VALUES ('0000-00-00'); +ERROR 22007: Incorrect date value: '0000-00-00' for column 'a' at row 1 +INSERT INTO t1 VALUES (); +ERROR 22007: Incorrect default value '0000-00-00' for column 'a' +INSERT INTO t1 VALUES (DEFAULT); +ERROR 22007: Incorrect default value '0000-00-00' for column 'a' +DROP TABLE t1; +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a DATE NOT NULL DEFAULT '0000-00-00', b DATE NOT NULL DEFAULT '0000-00-00'); +CREATE TABLE t2 (a DATE NOT NULL DEFAULT '0000-00-00'); +INSERT INTO t2 VALUES ('0000-00-00'); +SET sql_mode=TRADITIONAL; +INSERT INTO t1 (a) SELECT a FROM t2; +ERROR 22007: Incorrect default value '0000-00-00' for column 'b' +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a DATE DEFAULT '0000-00-00', b DATE DEFAULT '0000-00-00'); +INSERT INTO t1 VALUES (DEFAULT,DEFAULT);; +SELECT a INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/mdev-7824.txt' FROM t1; +DELETE FROM t1; +SET sql_mode=TRADITIONAL; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/mdev-7824.txt' INTO TABLE t1 (a); +ERROR 22007: Incorrect default value '0000-00-00' for column 'b' +DROP TABLE t1; +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a DATE DEFAULT '0000-00-00');; +SET sql_mode='NO_ZERO_DATE'; +ALTER TABLE t1 ADD b INT NOT NULL; +ERROR 42000: Invalid default value for 'a' +DROP TABLE t1; +SET sql_mode=DEFAULT; +# +# End of MDEV-7824 [Bug #68041] Zero date can be inserted in strict no-zero mode through a default value +# +# +# MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field +# +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a DATE);; +INSERT INTO t1 VALUES (0); +SET sql_mode='TRADITIONAL'; +CREATE TABLE t2 AS SELECT * FROM t1; +ERROR 22007: Incorrect date value: '0000-00-00' for column 'a' at row 1 +DROP TABLE t1; +# +# End of MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field +# +# +# MDEV-8722 The patch for MDEV-8688 disabled equal field propagation for temporal column and BETWEEN and IN +# +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02'); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a BETWEEN '2001-01-01' AND '2001-01-02'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2001-01-01') +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a IN ('2001-01-01','2001-01-02'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2001-01-01') +DROP TABLE t1; +# +# MDEV-8699 Wrong result for SELECT..WHERE HEX(date_column)!='323030312D30312D3031' AND date_column='2001-01-01x' +# +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02'); +SELECT * FROM t1 WHERE a='2001-01-01x'; +a +2001-01-01 +Warnings: +Warning 1292 Truncated incorrect date value: '2001-01-01x' +SELECT * FROM t1 WHERE HEX(a)!='323030312D30312D3031'; +a +2001-01-02 +SELECT * FROM t1 WHERE HEX(a)!='323030312D30312D3031' AND a='2001-01-01x'; +a +Warnings: +Warning 1292 Truncated incorrect date value: '2001-01-01x' +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE HEX(a)!='323030312D30312D3031' AND a='2001-01-01x'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +Warnings: +Warning 1292 Truncated incorrect date value: '2001-01-01x' +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE HEX(a)!=CONCAT('xx',RAND()) AND a='2001-01-01x'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Warning 1292 Truncated incorrect date value: '2001-01-01x' +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2001-01-01') and (<cache>(hex(DATE'2001-01-01')) <> concat('xx',rand()))) +DROP TABLE t1; +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02'); +SELECT * FROM t1 WHERE LENGTH(a)=11; +a +SELECT * FROM t1 WHERE LENGTH(a)=11 AND a=' 2001-01-01'; +a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=11 AND a=' 2001-01-01'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=11+RAND() AND a=' 2001-01-01'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2001-01-01') and (<cache>(length(DATE'2001-01-01')) = (11 + rand()))) +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=11+RAND() AND a=' garbage '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Warning 1292 Incorrect datetime value: ' garbage ' +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'0000-00-00') and (<cache>(length(DATE'0000-00-00')) = (11 + rand()))) +DROP TABLE t1; +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-01'); +SELECT * FROM t1 WHERE LENGTH(a)=8; +a +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='20010101'; +a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='20010101'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=8+RAND() AND a='20010101'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2001-01-01') and (<cache>(length(DATE'2001-01-01')) = (8 + rand()))) +DROP TABLE t1; +# +# MDEV-8706 Wrong result for SELECT..WHERE time_column=TIMESTAMP'2015-08-30 00:00:00' AND time_column='00:00:00' +# +SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30'); +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31'); +SELECT * FROM t1 WHERE a=TIME'00:00:00'; +a +2015-08-30 +SELECT * FROM t1 WHERE LENGTH(a)=10; +a +2015-08-30 +2015-08-31 +SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'00:00:00'; +a +2015-08-30 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2015-08-30') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2015-08-30') and (<cache>(length(DATE'2015-08-30')) = (30 + rand()))) +DROP TABLE t1; +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31'); +SELECT * FROM t1 WHERE a=TIME'24:00:00'; +a +2015-08-31 +SELECT * FROM t1 WHERE LENGTH(a)=10; +a +2015-08-30 +2015-08-31 +SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'24:00:00'; +a +2015-08-31 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'24:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2015-08-31') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'24:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2015-08-31') and (<cache>(length(DATE'2015-08-31')) = (30 + rand()))) +DROP TABLE t1; +# In this example '00:00:00' is not recognized as TIME'00:00:00' +# and is treated as DATE'0000-00-00'. +# This may change after MDEV-8322 Distinguish between time and date strings more carefully +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31'); +SELECT * FROM t1 WHERE a='00:00:00'; +a +SELECT * FROM t1 WHERE LENGTH(a)=10; +a +2015-08-30 +2015-08-31 +SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='00:00:00'; +a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'0000-00-00') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'0000-00-00') and (<cache>(length(DATE'0000-00-00')) = (30 + rand()))) +DROP TABLE t1; +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31'); +SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00'; +a +2015-08-30 +SELECT * FROM t1 WHERE LENGTH(a)=10; +a +2015-08-30 +2015-08-31 +SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00'; +a +2015-08-30 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2015-08-30 00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00') and (<cache>(length(DATE'2015-08-30')) = (30 + rand()))) +DROP TABLE t1; +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31'); +SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00.1'; +a +SELECT * FROM t1 WHERE LENGTH(a)=10; +a +2015-08-30 +2015-08-31 +SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00.1'; +a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00.1'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00.1') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2015-08-30 00:00:00.1'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00.1') and (<cache>(length(DATE'2015-08-30')) = (30 + rand()))) +DROP TABLE t1; +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31'); +SELECT * FROM t1 WHERE a='2015-08-30 00:00:00'; +a +2015-08-30 +SELECT * FROM t1 WHERE LENGTH(a)=10; +a +2015-08-30 +2015-08-31 +SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='2015-08-30 00:00:00'; +a +2015-08-30 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='2015-08-30 00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2015-08-30') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='2015-08-30 00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2015-08-30') and (<cache>(length(DATE'2015-08-30')) = (30 + rand()))) +DROP TABLE t1; +SET timestamp=DEFAULT; +# +# MDEV-8795 Equal expression propagation does not work for temporal literals +# +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02'); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=DATE'2001-01-01' AND COALESCE(a)>=DATE'2001-01-01'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = DATE'2001-01-01') +DROP TABLE t1; +# +# MDEV-8658 DATE(zerofill_column) and DATE(COALESCE(zerofill_column)) return different results +# +CREATE TABLE t1 (a INT(6) ZEROFILL, b DECIMAL(6) ZEROFILL, c DOUBLE(6,0) ZEROFILL); +INSERT INTO t1 VALUES (1,1,1); +INSERT INTO t1 VALUES (10101,10101,10101); +SELECT DATE(a), DATE(b), DATE(c) FROM t1; +DATE(a) DATE(b) DATE(c) +NULL NULL NULL +2001-01-01 2001-01-01 2001-01-01 +Warnings: +Warning 1292 Incorrect datetime value: '1' for column 'a' at row 1 +Warning 1292 Incorrect datetime value: '1' for column 'b' at row 1 +Warning 1292 Incorrect datetime value: '1' for column 'c' at row 1 +SELECT DATE(COALESCE(a)), DATE(COALESCE(b)), DATE(COALESCE(c)) FROM t1; +DATE(COALESCE(a)) DATE(COALESCE(b)) DATE(COALESCE(c)) +NULL NULL NULL +2001-01-01 2001-01-01 2001-01-01 +Warnings: +Warning 1292 Incorrect datetime value: '1' +Warning 1292 Incorrect datetime value: '1' +Warning 1292 Incorrect datetime value: '1' +DROP TABLE t1; +CREATE TABLE t1 (a INT(6), b DECIMAL(6), c DOUBLE(6,0)); +INSERT INTO t1 VALUES (1,1,1); +INSERT INTO t1 VALUES (10101,10101,10101); +SELECT DATE(a), DATE(b), DATE(c) FROM t1; +DATE(a) DATE(b) DATE(c) +NULL NULL NULL +2001-01-01 2001-01-01 2001-01-01 +Warnings: +Warning 1292 Incorrect datetime value: '1' for column 'a' at row 1 +Warning 1292 Incorrect datetime value: '1' for column 'b' at row 1 +Warning 1292 Incorrect datetime value: '1' for column 'c' at row 1 +SELECT DATE(COALESCE(a)), DATE(COALESCE(b)), DATE(COALESCE(c)) FROM t1; +DATE(COALESCE(a)) DATE(COALESCE(b)) DATE(COALESCE(c)) +NULL NULL NULL +2001-01-01 2001-01-01 2001-01-01 +Warnings: +Warning 1292 Incorrect datetime value: '1' +Warning 1292 Incorrect datetime value: '1' +Warning 1292 Incorrect datetime value: '1' +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index 82b64d30d96..16990c2414d 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -57,7 +57,7 @@ select * from t1; t 0000-00-00 00:00:00 drop table t1; -CREATE TABLE t1 (a timestamp, b date, c time, d datetime); +CREATE TABLE t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b date, c time, d datetime); insert into t1 (b,c,d) values(now(),curtime(),now()); Warnings: Note 1265 Data truncated for column 'b' at row 1 @@ -103,7 +103,7 @@ date numfacture expedition 0000-00-00 00:00:00 1212 0001-00-00 00:00:00 EXPLAIN SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref expedition expedition 8 const 1 +1 SIMPLE t1 ref expedition expedition 5 const 1 drop table t1; create table t1 (a datetime not null, b datetime not null); insert into t1 values (now(), now()); @@ -229,7 +229,7 @@ ERROR 42000: Invalid default value for 'da' create table t1 (t time default '916:00:00 a'); ERROR 42000: Invalid default value for 't' set @@sql_mode= @org_mode; -create table t1 (f1 date, f2 datetime, f3 timestamp); +create table t1 (f1 date, f2 datetime, f3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1(f1) values(curdate()); select curdate() < now(), f1 < now(), cast(f1 as date) < now() from t1; curdate() < now() f1 < now() cast(f1 as date) < now() @@ -266,7 +266,7 @@ f1 f2 f1 > f2 f1 = f2 f1 < f2 2001-04-15 2001-04-15 00:00:00 0 1 0 2001-05-20 2001-05-20 01:01:01 0 0 1 drop table t1; -create table t1 (f1 date, f2 datetime, f3 timestamp); +create table t1 (f1 date, f2 datetime, f3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values('2001-01-01','2001-01-01 01:01:01','2001-01-01 01:01:01'); insert into t1 values('2001-02-05','2001-02-05 00:00:00','2001-02-05 01:01:01'); insert into t1 values('2001-03-10','2001-03-09 01:01:01','2001-03-10 01:01:01'); @@ -745,9 +745,9 @@ SET NAMES CP850; INSERT INTO t1 VALUES (1,'2010-04-12 22:30:12'), (2,'2010-04-12 22:30:12'), (3,'2010-04-12 22:30:12'); EXPLAIN EXTENDED SELECT * FROM t1 FORCE INDEX(attime) WHERE AtTime = '2010-02-22 18:40:07'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref AtTime AtTime 9 const 1 100.00 +1 SIMPLE t1 ref AtTime AtTime 6 const 1 100.00 Warnings: -Note 1003 select `test`.`t1`.`Id` AS `Id`,`test`.`t1`.`AtTime` AS `AtTime` from `test`.`t1` FORCE INDEX (`attime`) where (`test`.`t1`.`AtTime` = '2010-02-22 18:40:07') +Note 1003 select `test`.`t1`.`Id` AS `Id`,`test`.`t1`.`AtTime` AS `AtTime` from `test`.`t1` FORCE INDEX (`attime`) where (`test`.`t1`.`AtTime` = TIMESTAMP'2010-02-22 18:40:07') DROP TABLE t1; SET NAMES latin1; # @@ -773,7 +773,7 @@ f1 t2 should be const explain select * from t2 where f1=STR_TO_DATE('4/1/2010', '%m/%d/%Y'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 const PRIMARY PRIMARY 8 const 1 Using index +1 SIMPLE t2 const PRIMARY PRIMARY 5 const 1 Using index DROP TABLE t1,t2; # # Bug#57095: Wrongly chosen expression cache type led to a wrong @@ -836,3 +836,307 @@ DROP TABLE t1,t2; # # End of 5.5 tests # +# +# Start of 10.1 tests +# +# +# MDEV-7824 [Bug #68041] Zero date can be inserted in strict no-zero mode through a default value +# +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a DATETIME DEFAULT '0000-00-00 00:00:00'); +SET sql_mode=TRADITIONAL; +INSERT INTO t1 VALUES ('0000-00-00 00:00:00'); +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'a' at row 1 +INSERT INTO t1 VALUES (); +ERROR 22007: Incorrect default value '0000-00-00 00:00:00' for column 'a' +INSERT INTO t1 VALUES (DEFAULT); +ERROR 22007: Incorrect default value '0000-00-00 00:00:00' for column 'a' +DROP TABLE t1; +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', b DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'); +CREATE TABLE t2 (a DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'); +INSERT INTO t2 VALUES ('0000-00-00 00:00:00'); +SET sql_mode=TRADITIONAL; +INSERT INTO t1 (a) SELECT a FROM t2; +ERROR 22007: Incorrect default value '0000-00-00 00:00:00' for column 'b' +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a DATETIME DEFAULT '0000-00-00 00:00:00', b DATETIME DEFAULT '0000-00-00 00:00:00'); +INSERT INTO t1 VALUES (DEFAULT,DEFAULT);; +SELECT a INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/mdev-7824.txt' FROM t1; +DELETE FROM t1; +SET sql_mode=TRADITIONAL; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/mdev-7824.txt' INTO TABLE t1 (a); +ERROR 22007: Incorrect default value '0000-00-00 00:00:00' for column 'b' +DROP TABLE t1; +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a DATETIME DEFAULT '0000-00-00 00:00:00');; +SET sql_mode='NO_ZERO_DATE'; +ALTER TABLE t1 ADD b INT NOT NULL; +ERROR 42000: Invalid default value for 'a' +DROP TABLE t1; +SET sql_mode=DEFAULT; +# +# End of MDEV-7824 [Bug #68041] Zero date can be inserted in strict no-zero mode through a default value +# +# +# MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field +# +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a DATETIME);; +INSERT INTO t1 VALUES (0); +SET sql_mode='TRADITIONAL'; +CREATE TABLE t2 AS SELECT * FROM t1; +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'a' at row 1 +DROP TABLE t1; +# +# End of MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field +# +# +# MDEV-8336 The meaning of NO_ZERO_DATE is not clear for DATETIME +# +SET sql_mode='NO_ZERO_DATE'; +SELECT TIMESTAMP'0000-00-01 10:20:30'; +TIMESTAMP'0000-00-01 10:20:30' +0000-00-01 10:20:30 +SELECT TIMESTAMP'0000-00-00 10:20:30'; +TIMESTAMP'0000-00-00 10:20:30' +0000-00-00 10:20:30 +SELECT TIMESTAMP'0000-00-00 00:00:00.000001'; +TIMESTAMP'0000-00-00 00:00:00.000001' +0000-00-00 00:00:00.000001 +CREATE TABLE t1 (a DATETIME); +INSERT INTO t1 VALUES ('0000-00-00 10:20:30'); +SELECT a, LEAST(a,'2001-01-01 10:20:30') FROM t1; +a LEAST(a,'2001-01-01 10:20:30') +0000-00-00 10:20:30 0000-00-00 10:20:30.000000 +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME(6)); +INSERT INTO t1 VALUES ('0000-00-00 00:00:00.000001'); +SELECT a, LEAST(a,'2001-01-01 10:20:30') FROM t1; +a LEAST(a,'2001-01-01 10:20:30') +0000-00-00 00:00:00.000001 0000-00-00 00:00:00.000001 +DROP TABLE t1; +SELECT STR_TO_DATE('0000-00-00 10:20:30','%Y-%m-%d %h:%i:%s'); +STR_TO_DATE('0000-00-00 10:20:30','%Y-%m-%d %h:%i:%s') +0000-00-00 10:20:30 +SELECT STR_TO_DATE('0000-00-00 00:00:00.000001','%Y-%m-%d %H:%i:%s.%f'); +STR_TO_DATE('0000-00-00 00:00:00.000001','%Y-%m-%d %H:%i:%s.%f') +0000-00-00 00:00:00.000001 +SET old_mode=zero_date_time_cast; +SELECT CAST(TIME'10:20:30' AS DATETIME); +CAST(TIME'10:20:30' AS DATETIME) +0000-00-00 10:20:30 +SELECT CAST(TIME'00:00:00.000001' AS DATETIME(6)); +CAST(TIME'00:00:00.000001' AS DATETIME(6)) +0000-00-00 00:00:00.000001 +SELECT CAST(CAST('10:20:30' AS TIME) AS DATETIME); +CAST(CAST('10:20:30' AS TIME) AS DATETIME) +0000-00-00 10:20:30 +SELECT CAST(CAST('00:00:00.000001' AS TIME(6)) AS DATETIME(6)); +CAST(CAST('00:00:00.000001' AS TIME(6)) AS DATETIME(6)) +0000-00-00 00:00:00.000001 +SELECT CAST(CAST(TIMESTAMP'0000-00-00 10:20:30' AS TIME) AS DATETIME); +CAST(CAST(TIMESTAMP'0000-00-00 10:20:30' AS TIME) AS DATETIME) +0000-00-00 10:20:30 +SELECT CAST(CAST(TIMESTAMP'0000-00-00 00:00:00.000001' AS TIME(6)) AS DATETIME(6)); +CAST(CAST(TIMESTAMP'0000-00-00 00:00:00.000001' AS TIME(6)) AS DATETIME(6)) +0000-00-00 00:00:00.000001 +SET old_mode=DEFAULT; +SET sql_mode=DEFAULT; +# +# MDEV-8699 Wrong result for SELECT..WHERE HEX(date_column)!='323030312D30312D3031' AND date_column='2001-01-01x' +# +CREATE TABLE t1 (a DATETIME);; +INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01'); +SELECT * FROM t1 WHERE a='2001-01-01 00:00:00x'; +a +2001-01-01 00:00:00 +Warnings: +Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' +SELECT * FROM t1 WHERE LENGTH(a) != 20; +a +2001-01-01 00:00:00 +2001-01-01 00:00:01 +SELECT * FROM t1 WHERE LENGTH(a) != 20 AND a='2001-01-01 00:00:00x'; +a +2001-01-01 00:00:00 +Warnings: +Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a) != 20 AND a='2001-01-01 00:00:00x'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)!=30+RAND() AND a='2001-01-01 00:00:00x'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00')) <> (30 + rand()))) +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME);; +INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01'); +SELECT * FROM t1 WHERE LENGTH(a)=19; +a +2001-01-01 00:00:00 +2001-01-01 00:00:01 +SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=' 2001-01-01 00:00:00'; +a +2001-01-01 00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=' 2001-01-01 00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=19+RAND() AND a=' 2001-01-01 00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00')) = (19 + rand()))) +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' garbage '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Warning 1292 Incorrect datetime value: ' garbage ' +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'0000-00-00 00:00:00') and (<cache>(length(TIMESTAMP'0000-00-00 00:00:00')) = (30 + rand()))) +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME);; +INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01'); +SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 00:00:00.000000'; +a +2001-01-01 00:00:00 +SELECT * FROM t1 WHERE LENGTH(a)=19; +a +2001-01-01 00:00:00 +2001-01-01 00:00:01 +SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; +a +2001-01-01 00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00')) = (30 + rand()))) +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME(6));; +INSERT INTO t1 VALUES ('2001-01-01 00:00:00.000000'),('2001-01-01 00:00:01.000000'); +SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 00:00:00.000000'; +a +2001-01-01 00:00:00.000000 +SELECT * FROM t1 WHERE LENGTH(a)=26; +a +2001-01-01 00:00:00.000000 +2001-01-01 00:00:01.000000 +SELECT * FROM t1 WHERE LENGTH(a)=26 AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; +a +2001-01-01 00:00:00.000000 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=26 AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=40+RAND() AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00.000000')) = (40 + rand()))) +DROP TABLE t1; +SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30'); +CREATE TABLE t1 (a DATETIME);; +INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01'); +SELECT * FROM t1 WHERE a=TIME'00:00:00'; +a +2001-01-01 00:00:00 +SELECT * FROM t1 WHERE LENGTH(a)=19; +a +2001-01-01 00:00:00 +2001-01-01 00:00:01 +SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIME'00:00:00'; +a +2001-01-01 00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIME'00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=40+RAND() AND a=TIME'00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00')) = (40 + rand()))) +DROP TABLE t1; +# +# MDEV-8795 Equal expression propagation does not work for temporal literals +# +CREATE TABLE t1 (a DATETIME); +INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-02 00:00:00'); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=TIMESTAMP'2001-01-01 00:00:00' AND COALESCE(a)>=TIMESTAMP'2001-01-01 00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = TIMESTAMP'2001-01-01 00:00:00') +DROP TABLE t1; +# +# MDEV-8875 Wrong metadata for MAX(CAST(time_column AS DATETIME)) +# +SET timestamp=UNIX_TIMESTAMP('2015-01-01 00:00:00'); +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES ('00:00:00'),('00:01:00'); +SELECT MAX(CAST(a AS DATETIME)) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def MAX(CAST(a AS DATETIME)) 12 19 19 Y 128 0 63 +MAX(CAST(a AS DATETIME)) +2015-01-01 00:01:00 +CREATE TABLE t2 AS SELECT MAX(CAST(a AS DATETIME)) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `MAX(CAST(a AS DATETIME))` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +SET timestamp=DEFAULT; +# +# MDEV-8860 Wrong result for WHERE 2016 < SOME (SELECT CAST(time_column AS DATETIME) FROM t1) +# +SET timestamp=UNIX_TIMESTAMP('2015-01-01 00:00:00'); +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES ('00:00:00'),('00:01:00'); +SELECT 1 FROM t1 WHERE 2016 > SOME (SELECT CAST(a AS DATETIME) FROM t1); +1 +Warnings: +Warning 1292 Incorrect datetime value: '2016' +SELECT * FROM t1 WHERE 2016 > CAST(a AS DATETIME); +a +Warnings: +Warning 1292 Incorrect datetime value: '2016' +SELECT 1 FROM t1 WHERE 20160101 > SOME (SELECT CAST(a AS DATETIME) FROM t1); +1 +1 +1 +SELECT * FROM t1 WHERE 20160101 > CAST(a AS DATETIME); +a +00:00:00 +00:01:00 +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result index cde8816dee4..85ea43752a5 100644 --- a/mysql-test/r/type_decimal.result +++ b/mysql-test/r/type_decimal.result @@ -181,7 +181,7 @@ Note 1265 Data truncated for column 'a' at row 3 Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column 'a' at row 4 insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0"); Warnings: -Note 1265 Data truncated for column 'a' at row 1 +Warning 1265 Data truncated for column 'a' at row 1 Note 1265 Data truncated for column 'a' at row 3 select * from t1; a @@ -246,7 +246,7 @@ Note 1265 Data truncated for column 'a' at row 2 Warning 1264 Out of range value for column 'a' at row 3 insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0"); Warnings: -Note 1265 Data truncated for column 'a' at row 1 +Warning 1265 Data truncated for column 'a' at row 1 Note 1265 Data truncated for column 'a' at row 3 select * from t1; a @@ -305,7 +305,7 @@ Note 1265 Data truncated for column 'a' at row 2 Warning 1264 Out of range value for column 'a' at row 3 insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0"); Warnings: -Note 1265 Data truncated for column 'a' at row 1 +Warning 1265 Data truncated for column 'a' at row 1 Note 1265 Data truncated for column 'a' at row 3 select * from t1; a @@ -358,6 +358,9 @@ insert into t1 values (123.4e0),(123.4e+2),(123.4e-2),(123e1),(123e+0); Warnings: Note 1265 Data truncated for column 'a' at row 3 insert into t1 values (MID("987",1,2)),("987 "),("987.6e+2 "); +Warnings: +Note 1265 Data truncated for column 'a' at row 2 +Note 1265 Data truncated for column 'a' at row 3 select * from t1; a 0.00 diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result index dd9277517d8..d901434fd6e 100644 --- a/mysql-test/r/type_enum.result +++ b/mysql-test/r/type_enum.result @@ -2082,3 +2082,55 @@ DROP TABLE t1; # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-8729 Wrong result for SELECT..WHERE HEX(enum_column)='61' AND enum_column='a ' +# +CREATE TABLE t1 (a ENUM('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t1 VALUES ('a'),('A'); +SELECT * FROM t1 WHERE a='a '; +a +a +SELECT * FROM t1 WHERE HEX(a)='61'; +a +a +SELECT * FROM t1 WHERE HEX(a)='61' AND a='a '; +a +a +# Can't propagate the equality into HEX(a), because binary collations still ignore trailing spaces +EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a ') and (hex(`test`.`t1`.`a`) = '61')) +DROP TABLE t1; +CREATE TABLE t1 (a ENUM('a','a ') CHARACTER SET BINARY); +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE a='a '; +a +a +SELECT * FROM t1 WHERE HEX(a)='61'; +a +a +SELECT * FROM t1 WHERE HEX(a)='61' AND a='a'; +a +a +SELECT * FROM t1 WHERE HEX(a)='61' AND a='a '; +a +# Ok to propagate the equality into HEX(a), because "CHARACTER SET BINARY" does not ignore trailing spaces +EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a') +EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index 57e2660750b..e7267f012ae 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -245,22 +245,22 @@ show warnings; Level Code Message desc t1; Field Type Null Key Default Extra -x decimal(21,2) NO 0.00 +x decimal(21,2) NO NULL drop table t1; create table t1 select 0.0 x; desc t1; Field Type Null Key Default Extra -x decimal(2,1) NO 0.0 +x decimal(2,1) NO NULL create table t2 select 105213674794682365.00 y; desc t2; Field Type Null Key Default Extra -y decimal(20,2) NO 0.00 +y decimal(20,2) NO NULL create table t3 select x+y a from t1,t2; show warnings; Level Code Message desc t3; Field Type Null Key Default Extra -a decimal(21,2) NO 0.00 +a decimal(21,2) NO NULL drop table t1,t2,t3; select 1e-308, 1.00000001e-300, 100000000e-300; 1e-308 1.00000001e-300 100000000e-300 @@ -458,7 +458,7 @@ Warnings: Warning 1265 Data truncated for column 'f' at row 1 INSERT INTO t1 VALUES ('.'); Warnings: -Warning 1265 Data truncated for column 'f' at row 1 +Warning 1366 Incorrect double value: '.' for column 'f' at row 1 SELECT * FROM t1 ORDER BY f; f 0 @@ -532,3 +532,109 @@ DROP TABLE t1,t2; # # End of 10.0 tests # +# +# MDEV-8704 Wrong result for SELECT..WHERE LENGTH(double_column)!=6 AND double_column=100e0 +# +CREATE TABLE t1 (a DOUBLE(9,2)); +INSERT INTO t1 VALUES (100),(110); +SELECT * FROM t1 WHERE LENGTH(a)!=6; +a +SELECT * FROM t1 WHERE LENGTH(a)!=6 AND a=100e0; +a +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES (100),(110); +SELECT * FROM t1 WHERE LENGTH(a)!=6; +a +100 +110 +SELECT * FROM t1 WHERE LENGTH(a)!=6 AND a=100e0; +a +100 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)!=6 AND a=100e0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 100e0) +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=100e0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 100e0) and (<cache>(length(100)) <> rand())) +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE(10,1)); +INSERT INTO t1 VALUES (1.1),(1.2),(1.3); +SELECT * FROM t1 WHERE LENGTH(a)!=3; +a +SELECT * FROM t1 WHERE LENGTH(a)!=3 AND a=1.10e0; +a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)!=3 AND a=1.10e0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 +# Notice 1.1 instead of 1.10 in the final WHERE condition +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=1.10e0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1.10e0) and (<cache>(length(1.1)) <> rand())) +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE(10,2)); +INSERT INTO t1 VALUES (1.1),(1.2),(1.3); +SELECT * FROM t1 WHERE LENGTH(a)!=4; +a +SELECT * FROM t1 WHERE LENGTH(a)!=4 AND a=1.10e0; +a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)!=4 AND a=1.10e0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 +# Notice 1.10 in the final WHERE condition +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=1.10e0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1.10e0) and (<cache>(length(1.10)) <> rand())) +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE(10,3)); +INSERT INTO t1 VALUES (1.1),(1.2),(1.3); +SELECT * FROM t1 WHERE LENGTH(a)!=5; +a +SELECT * FROM t1 WHERE LENGTH(a)!=5 AND a=1.10e0; +a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)!=5 AND a=1.10e0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 +# Notice 1.100 rather than 1.10 in the final WHERE condition +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=1.10e0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1.10e0) and (<cache>(length(1.100)) <> rand())) +DROP TABLE t1; +# +# MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010 +# +CREATE TABLE t1 (a DOUBLE ZEROFILL); +INSERT INTO t1 VALUES (2010),(2020); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010e0 AND a>=2010e0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010e0) +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/type_int.result b/mysql-test/r/type_int.result new file mode 100644 index 00000000000..4e7b928ac07 --- /dev/null +++ b/mysql-test/r/type_int.result @@ -0,0 +1,38 @@ +# +# Start of 10.1 tests +# +# +# MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010 +# +CREATE TABLE t1 (a INT ZEROFILL); +INSERT INTO t1 VALUES (2010),(2020); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND a>=2010; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010) +DROP TABLE t1; +# +# MDEV-8369 Unexpected impossible WHERE for a condition on a ZEROFILL field +# +CREATE TABLE t1 (a INT ZEROFILL); +INSERT INTO t1 VALUES (128),(129); +SELECT * FROM t1 WHERE a=128; +a +0000000128 +SELECT * FROM t1 WHERE hex(a)='80'; +a +0000000128 +SELECT * FROM t1 WHERE a=128 AND hex(a)='80'; +a +0000000128 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a=128 AND hex(a)='80'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 128) and (hex(`test`.`t1`.`a`) = '80')) +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index ab075d29e22..1942d07c9ab 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -52,13 +52,13 @@ if(1, 1.1, 1.2) if(0, 1.1, 1.2) if(0.1, 1.1, 1.2) if(0, 1, 1.1) if(0, NULL, 1.2) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `if(1, 1.1, 1.2)` decimal(2,1) NOT NULL DEFAULT '0.0', - `if(0, 1.1, 1.2)` decimal(2,1) NOT NULL DEFAULT '0.0', - `if(0.1, 1.1, 1.2)` decimal(2,1) NOT NULL DEFAULT '0.0', - `if(0, 1, 1.1)` decimal(2,1) NOT NULL DEFAULT '0.0', + `if(1, 1.1, 1.2)` decimal(2,1) NOT NULL, + `if(0, 1.1, 1.2)` decimal(2,1) NOT NULL, + `if(0.1, 1.1, 1.2)` decimal(2,1) NOT NULL, + `if(0, 1, 1.1)` decimal(2,1) NOT NULL, `if(0, NULL, 1.2)` decimal(2,1) DEFAULT NULL, - `if(1, 0.22e1, 1.1)` double NOT NULL DEFAULT '0', - `if(1E0, 1.1, 1.2)` decimal(2,1) NOT NULL DEFAULT '0.0' + `if(1, 0.22e1, 1.1)` double NOT NULL, + `if(1E0, 1.1, 1.2)` decimal(2,1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 select nullif(1.1, 1.1), nullif(1.1, 1.2), nullif(1.1, 0.11e1), nullif(1.0, 1), nullif(1, 1.0), nullif(1, 1.1); @@ -174,10 +174,10 @@ create table t1 select round(15.4,-1), truncate(-5678.123451,-3), abs(-1.1), -(- show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `round(15.4,-1)` decimal(3,0) NOT NULL DEFAULT '0', - `truncate(-5678.123451,-3)` decimal(4,0) NOT NULL DEFAULT '0', - `abs(-1.1)` decimal(3,1) NOT NULL DEFAULT '0.0', - `-(-1.1)` decimal(2,1) NOT NULL DEFAULT '0.0' + `round(15.4,-1)` decimal(3,0) NOT NULL, + `truncate(-5678.123451,-3)` decimal(4,0) NOT NULL, + `abs(-1.1)` decimal(3,1) NOT NULL, + `-(-1.1)` decimal(2,1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; set session sql_mode='traditional'; @@ -771,7 +771,7 @@ create table t1 as select 0.5; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `0.5` decimal(2,1) NOT NULL DEFAULT '0.0' + `0.5` decimal(2,1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select round(1.5),round(2.5); @@ -1509,7 +1509,7 @@ Warnings: Note 1265 Data truncated for column 'f1' at row 1 DESC t1; Field Type Null Key Default Extra -f1 decimal(31,30) NO 0.000000000000000000000000000000 +f1 decimal(31,30) NO NULL SELECT f1 FROM t1; f1 0.123456789012345678901234567890 @@ -1519,7 +1519,7 @@ Warnings: Warning 1264 Out of range value for column 'f1' at row 1 DESC t1; Field Type Null Key Default Extra -f1 decimal(65,30) NO 0.000000000000000000000000000000 +f1 decimal(65,30) NO NULL SELECT f1 FROM t1; f1 99999999999999999999999999999999999.999999999999999999999999999999 @@ -1623,7 +1623,7 @@ Warnings: Note 1265 Data truncated for column 'my_col' at row 1 DESCRIBE t1; Field Type Null Key Default Extra -my_col decimal(30,30) NO 0.000000000000000000000000000000 +my_col decimal(30,30) NO NULL SELECT my_col FROM t1; my_col 0.123456789123456789123456789123 @@ -1633,7 +1633,7 @@ Warnings: Note 1265 Data truncated for column 'my_col' at row 1 DESCRIBE t1; Field Type Null Key Default Extra -my_col decimal(65,30) NO 0.000000000000000000000000000000 +my_col decimal(65,30) NO NULL SELECT my_col FROM t1; my_col 1.123456789123456789123456789123 @@ -1643,7 +1643,7 @@ Warnings: Note 1265 Data truncated for column 'my_col' at row 1 DESCRIBE t1; Field Type Null Key Default Extra -my_col decimal(65,30) NO 0.000000000000000000000000000000 +my_col decimal(65,30) NO NULL SELECT my_col FROM t1; my_col 0.123456789123456789123456789123 @@ -1679,7 +1679,7 @@ Warnings: Warning 1264 Out of range value for column 'c1' at row 1 DESC t1; Field Type Null Key Default Extra -c1 decimal(65,0) NO 0 +c1 decimal(65,0) NO NULL SELECT * FROM t1; c1 99999999999999999999999999999999999999999999999999999999999999999 @@ -1691,7 +1691,7 @@ Warnings: Warning 1264 Out of range value for column 'c1' at row 1 DESC t1; Field Type Null Key Default Extra -c1 decimal(65,0) NO 0 +c1 decimal(65,0) NO NULL SELECT * FROM t1; c1 99999999999999999999999999999999999999999999999999999999999999999 @@ -1703,7 +1703,7 @@ Warnings: Warning 1264 Out of range value for column 'c1' at row 1 DESC t1; Field Type Null Key Default Extra -c1 decimal(65,0) NO 0 +c1 decimal(65,0) NO NULL SELECT * FROM t1; c1 99999999999999999999999999999999999999999999999999999999999999999 @@ -1715,7 +1715,7 @@ Warnings: Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated. DESC t1; Field Type Null Key Default Extra -c1 decimal(65,0) NO 0 +c1 decimal(65,0) NO NULL SELECT * FROM t1; c1 99999999999999999999999999999999999999999999999999999999999999999 @@ -1727,7 +1727,7 @@ Warnings: Warning 1264 Out of range value for column 'c1' at row 1 DESC t1; Field Type Null Key Default Extra -c1 decimal(65,30) NO 0.000000000000000000000000000000 +c1 decimal(65,30) NO NULL SELECT * FROM t1; c1 99999999999999999999999999999999999.999999999999999999999999999999 @@ -1737,7 +1737,7 @@ CREATE TABLE t1 SELECT AS c1; DESC t1; Field Type Null Key Default Extra -c1 decimal(31,30) NO 0.000000000000000000000000000000 +c1 decimal(31,30) NO NULL SELECT * FROM t1; c1 1.100000000000000000000000000000 @@ -1747,7 +1747,7 @@ CREATE TABLE t1 SELECT AS c1; DESC t1; Field Type Null Key Default Extra -c1 decimal(31,30) NO 0.000000000000000000000000000000 +c1 decimal(31,30) NO NULL SELECT * FROM t1; c1 1.100000000000000000000000000000 @@ -1759,7 +1759,7 @@ Warnings: Note 1265 Data truncated for column 'c1' at row 1 DESC t1; Field Type Null Key Default Extra -c1 decimal(30,30) NO 0.000000000000000000000000000000 +c1 decimal(30,30) NO NULL SELECT * FROM t1; c1 0.100000000000000000000000000000 @@ -1771,7 +1771,7 @@ Warnings: Warning 1264 Out of range value for column 'c1' at row 1 DESC t1; Field Type Null Key Default Extra -c1 decimal(65,30) NO 0.000000000000000000000000000000 +c1 decimal(65,30) NO NULL SELECT * FROM t1; c1 99999999999999999999999999999999999.999999999999999999999999999999 @@ -1783,7 +1783,7 @@ Warnings: Warning 1264 Out of range value for column 'c1' at row 1 DESC t1; Field Type Null Key Default Extra -c1 decimal(65,1) NO 0.0 +c1 decimal(65,1) NO NULL SELECT * FROM t1; c1 9999999999999999999999999999999999999999999999999999999999999999.9 @@ -1795,7 +1795,7 @@ Warnings: Warning 1264 Out of range value for column 'c1' at row 1 DESC t1; Field Type Null Key Default Extra -c1 decimal(65,1) NO 0.0 +c1 decimal(65,1) NO NULL SELECT * FROM t1; c1 9999999999999999999999999999999999999999999999999999999999999999.9 @@ -1807,7 +1807,7 @@ Warnings: Note 1265 Data truncated for column 'c1' at row 1 DESC t1; Field Type Null Key Default Extra -c1 decimal(30,30) NO 0.000000000000000000000000000000 +c1 decimal(30,30) NO NULL SELECT * FROM t1; c1 0.123456789012345678901234567890 @@ -1817,7 +1817,7 @@ Warnings: Note 1265 Data truncated for column 'c1' at row 1 DESC t1; Field Type Null Key Default Extra -c1 decimal(33,30) NO 0.000000000000000000000000000000 +c1 decimal(33,30) NO NULL SELECT * FROM t1; c1 123.123456789012345678901234567890 @@ -1825,7 +1825,7 @@ DROP TABLE t1; CREATE TABLE t1 SELECT 1.1 + CAST(1 AS DECIMAL(65,30)) AS c1; DESC t1; Field Type Null Key Default Extra -c1 decimal(65,30) NO 0.000000000000000000000000000000 +c1 decimal(65,30) NO NULL SELECT * FROM t1; c1 2.100000000000000000000000000000 @@ -2042,33 +2042,19 @@ SELECT t1.* FROM t1 JOIN t2 USING(a); a 10:20:30.000000 10:20:30.000000 -Warnings: -Note 1292 Truncated incorrect time value: '102030.0000000000' -Note 1292 Truncated incorrect time value: '102030.0000000010' SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); a 10:20:30.000000 10:20:30.000000 -Warnings: -Note 1292 Truncated incorrect time value: '102030.0000000000' -Note 1292 Truncated incorrect time value: '102030.0000000000' -Note 1292 Truncated incorrect time value: '102030.0000000010' ALTER TABLE t2 ADD PRIMARY KEY(a); SELECT t1.* FROM t1 JOIN t2 USING(a); a 10:20:30.000000 10:20:30.000000 -Warnings: -Note 1292 Truncated incorrect time value: '102030.0000000000' -Note 1292 Truncated incorrect time value: '102030.0000000010' SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); a 10:20:30.000000 10:20:30.000000 -Warnings: -Note 1292 Truncated incorrect time value: '102030.0000000000' -Note 1292 Truncated incorrect time value: '102030.0000000000' -Note 1292 Truncated incorrect time value: '102030.0000000010' # t2 should NOT be eliminated EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); id select_type table type possible_keys key key_len ref rows Extra @@ -2078,3 +2064,92 @@ DROP TABLE t1,t2; # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-8703 Wrong result for SELECT..WHERE LENGTH(decimal_10_1_column)!=3 AND decimal_10_1_column=1.10 +# +CREATE TABLE t1 (a DECIMAL(10,1)); +INSERT INTO t1 VALUES (1.1),(1.2),(1.3); +SELECT * FROM t1 WHERE LENGTH(a)!=3; +a +SELECT * FROM t1 WHERE LENGTH(a)!=3 AND a=1.10; +a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)!=3 AND a=1.10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 +# Notice 1.1 instead of 1.10 in the final WHERE condition +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)!=rand() AND a=1.10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1.10) and (<cache>(length(1.1)) <> rand())) +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(10,2)); +INSERT INTO t1 VALUES (1.1),(1.2),(1.3); +SELECT * FROM t1 WHERE LENGTH(a)!=4; +a +SELECT * FROM t1 WHERE LENGTH(a)!=4 AND a=1.10; +a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)!=4 AND a=1.10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 +# Notice 1.10 in the final WHERE condition +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)!=rand() AND a=1.10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1.10) and (<cache>(length(1.10)) <> rand())) +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(10,3)); +INSERT INTO t1 VALUES (1.1),(1.2),(1.3); +SELECT * FROM t1 WHERE LENGTH(a)!=5; +a +SELECT * FROM t1 WHERE LENGTH(a)!=5 AND a=1.10; +a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)!=5 AND a=1.10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 +# Notice 1.100 rather than 1.10 in the final WHERE condition +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)!=rand() AND a=1.10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1.10) and (<cache>(length(1.100)) <> rand())) +DROP TABLE t1; +# +# MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010 +# +CREATE TABLE t1 (a DECIMAL(10,1) ZEROFILL); +INSERT INTO t1 VALUES (2010),(2020); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010.0 AND a>=2010.0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010.0) +DROP TABLE t1; +# +# MDEV-8635 Redundant warnings on WHERE decimal_column='ax' +# +CREATE TABLE t1 (a DECIMAL, KEY(a)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2),(3),(4),(5); +EXPLAIN SELECT * FROM t1 WHERE a='ax' ORDER BY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 6 const 1 Using where; Using index; Using filesort +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/type_num.result b/mysql-test/r/type_num.result new file mode 100644 index 00000000000..9ee67ac8f33 --- /dev/null +++ b/mysql-test/r/type_num.result @@ -0,0 +1,1250 @@ +# +# Start of 10.0 tests +# +# +# MDEV-8468 CAST and INSERT work differently for DECIMAL/INT vs DOUBLE for a string with trailing spaces +# +SET sql_mode='STRICT_ALL_TABLES'; +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES ('1 '); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES ('1 '); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYINT); +INSERT INTO t1 VALUES ('1 '); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a SMALLINT); +INSERT INTO t1 VALUES ('1 '); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES ('1 '); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a BIGINT); +INSERT INTO t1 VALUES ('1 '); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL); +INSERT INTO t1 VALUES ('1 '); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES (''); +ERROR 22007: Incorrect double value: '' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES (''); +ERROR 22007: Incorrect double value: '' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYINT); +INSERT INTO t1 VALUES (''); +ERROR 22007: Incorrect integer value: '' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a SMALLINT); +INSERT INTO t1 VALUES (''); +ERROR 22007: Incorrect integer value: '' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (''); +ERROR 22007: Incorrect integer value: '' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a BIGINT); +INSERT INTO t1 VALUES (''); +ERROR 22007: Incorrect integer value: '' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL); +INSERT INTO t1 VALUES (''); +ERROR 22007: Incorrect decimal value: '' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES ('x'); +ERROR 22007: Incorrect double value: 'x' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES ('x'); +ERROR 22007: Incorrect double value: 'x' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYINT); +INSERT INTO t1 VALUES ('x'); +ERROR 22007: Incorrect integer value: 'x' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a SMALLINT); +INSERT INTO t1 VALUES ('x'); +ERROR 22007: Incorrect integer value: 'x' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES ('x'); +ERROR 22007: Incorrect integer value: 'x' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a BIGINT); +INSERT INTO t1 VALUES ('x'); +ERROR 22007: Incorrect integer value: 'x' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL); +INSERT INTO t1 VALUES ('x'); +ERROR 22007: Incorrect decimal value: 'x' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES (' x'); +ERROR 22007: Incorrect double value: ' x' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES (' x'); +ERROR 22007: Incorrect double value: ' x' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYINT); +INSERT INTO t1 VALUES (' x'); +ERROR 22007: Incorrect integer value: ' x' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a SMALLINT); +INSERT INTO t1 VALUES (' x'); +ERROR 22007: Incorrect integer value: ' x' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (' x'); +ERROR 22007: Incorrect integer value: ' x' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a BIGINT); +INSERT INTO t1 VALUES (' x'); +ERROR 22007: Incorrect integer value: ' x' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL); +INSERT INTO t1 VALUES (' x'); +ERROR 22007: Incorrect decimal value: ' x' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES ('.'); +ERROR 22007: Incorrect double value: '.' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES ('.'); +ERROR 22007: Incorrect double value: '.' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYINT); +INSERT INTO t1 VALUES ('.'); +ERROR 22007: Incorrect integer value: '.' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a SMALLINT); +INSERT INTO t1 VALUES ('.'); +ERROR 22007: Incorrect integer value: '.' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES ('.'); +ERROR 22007: Incorrect integer value: '.' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a BIGINT); +INSERT INTO t1 VALUES ('.'); +ERROR 22007: Incorrect integer value: '.' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL); +INSERT INTO t1 VALUES ('.'); +ERROR 22007: Incorrect decimal value: '.' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES ('-'); +ERROR 22007: Incorrect double value: '-' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES ('-'); +ERROR 22007: Incorrect double value: '-' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYINT); +INSERT INTO t1 VALUES ('-'); +ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a SMALLINT); +INSERT INTO t1 VALUES ('-'); +ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES ('-'); +ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a BIGINT); +INSERT INTO t1 VALUES ('-'); +ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL); +INSERT INTO t1 VALUES ('-'); +ERROR 22007: Incorrect decimal value: '-' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES ('+'); +ERROR 22007: Incorrect double value: '+' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES ('+'); +ERROR 22007: Incorrect double value: '+' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYINT); +INSERT INTO t1 VALUES ('+'); +ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a SMALLINT); +INSERT INTO t1 VALUES ('+'); +ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES ('+'); +ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a BIGINT); +INSERT INTO t1 VALUES ('+'); +ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL); +INSERT INTO t1 VALUES ('+'); +ERROR 22007: Incorrect decimal value: '+' for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES ('1x'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES ('1x'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYINT); +INSERT INTO t1 VALUES ('1x'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a SMALLINT); +INSERT INTO t1 VALUES ('1x'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES ('1x'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a BIGINT); +INSERT INTO t1 VALUES ('1x'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL); +INSERT INTO t1 VALUES ('1x'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES ('1e'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES ('1e'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYINT); +INSERT INTO t1 VALUES ('1e'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a SMALLINT); +INSERT INTO t1 VALUES ('1e'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES ('1e'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a BIGINT); +INSERT INTO t1 VALUES ('1e'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL); +INSERT INTO t1 VALUES ('1e'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES ('1e+'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES ('1e+'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYINT); +INSERT INTO t1 VALUES ('1e+'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a SMALLINT); +INSERT INTO t1 VALUES ('1e+'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES ('1e+'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a BIGINT); +INSERT INTO t1 VALUES ('1e+'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL); +INSERT INTO t1 VALUES ('1e+'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES ('1E-'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES ('1E-'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYINT); +INSERT INTO t1 VALUES ('1E-'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a SMALLINT); +INSERT INTO t1 VALUES ('1E-'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES ('1E-'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a BIGINT); +INSERT INTO t1 VALUES ('1E-'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL); +INSERT INTO t1 VALUES ('1E-'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES ('1Ex'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES ('1Ex'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYINT); +INSERT INTO t1 VALUES ('1Ex'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a SMALLINT); +INSERT INTO t1 VALUES ('1Ex'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES ('1Ex'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a BIGINT); +INSERT INTO t1 VALUES ('1Ex'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL); +INSERT INTO t1 VALUES ('1Ex'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES ('1e+x'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES ('1e+x'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYINT); +INSERT INTO t1 VALUES ('1e+x'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a SMALLINT); +INSERT INTO t1 VALUES ('1e+x'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES ('1e+x'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a BIGINT); +INSERT INTO t1 VALUES ('1e+x'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL); +INSERT INTO t1 VALUES ('1e+x'); +ERROR 01000: Data truncated for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES ('1e1000'); +ERROR 22003: Out of range value for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES ('1e1000'); +ERROR 22003: Out of range value for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYINT); +INSERT INTO t1 VALUES ('1e1000'); +ERROR 22003: Out of range value for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a SMALLINT); +INSERT INTO t1 VALUES ('1e1000'); +ERROR 22003: Out of range value for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES ('1e1000'); +ERROR 22003: Out of range value for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a BIGINT); +INSERT INTO t1 VALUES ('1e1000'); +ERROR 22003: Out of range value for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL); +INSERT INTO t1 VALUES ('1e1000'); +ERROR 22003: Out of range value for column 'a' at row 1 +DROP TABLE t1; +SET sql_mode=DEFAULT; +CREATE TABLE t1 ( +f4 FLOAT, +f8 DOUBLE, +i1 TINYINT, +i2 SMALLINT, +i4 INT, +i8 BIGINT, +d DECIMAL +); +INSERT INTO t1 VALUES ('1 ','1 ','1 ','1 ','1 ','1 ','1 '); +Warnings: +Note 1265 Data truncated for column 'f4' at row 1 +Note 1265 Data truncated for column 'f8' at row 1 +Note 1265 Data truncated for column 'i1' at row 1 +Note 1265 Data truncated for column 'i2' at row 1 +Note 1265 Data truncated for column 'i4' at row 1 +Note 1265 Data truncated for column 'i8' at row 1 +Note 1265 Data truncated for column 'd' at row 1 +INSERT INTO t1 VALUES ('','','','','','',''); +Warnings: +Warning 1366 Incorrect double value: '' for column 'f4' at row 1 +Warning 1366 Incorrect double value: '' for column 'f8' at row 1 +Warning 1366 Incorrect integer value: '' for column 'i1' at row 1 +Warning 1366 Incorrect integer value: '' for column 'i2' at row 1 +Warning 1366 Incorrect integer value: '' for column 'i4' at row 1 +Warning 1366 Incorrect integer value: '' for column 'i8' at row 1 +Warning 1366 Incorrect decimal value: '' for column 'd' at row 1 +INSERT INTO t1 VALUES ('x','x','x','x','x','x','x'); +Warnings: +Warning 1366 Incorrect double value: 'x' for column 'f4' at row 1 +Warning 1366 Incorrect double value: 'x' for column 'f8' at row 1 +Warning 1366 Incorrect integer value: 'x' for column 'i1' at row 1 +Warning 1366 Incorrect integer value: 'x' for column 'i2' at row 1 +Warning 1366 Incorrect integer value: 'x' for column 'i4' at row 1 +Warning 1366 Incorrect integer value: 'x' for column 'i8' at row 1 +Warning 1366 Incorrect decimal value: 'x' for column 'd' at row 1 +INSERT INTO t1 VALUES (' x',' x',' x',' x',' x',' x',' x'); +Warnings: +Warning 1366 Incorrect double value: ' x' for column 'f4' at row 1 +Warning 1366 Incorrect double value: ' x' for column 'f8' at row 1 +Warning 1366 Incorrect integer value: ' x' for column 'i1' at row 1 +Warning 1366 Incorrect integer value: ' x' for column 'i2' at row 1 +Warning 1366 Incorrect integer value: ' x' for column 'i4' at row 1 +Warning 1366 Incorrect integer value: ' x' for column 'i8' at row 1 +Warning 1366 Incorrect decimal value: ' x' for column 'd' at row 1 +INSERT INTO t1 VALUES ('.','.','.','.','.','.','.'); +Warnings: +Warning 1366 Incorrect double value: '.' for column 'f4' at row 1 +Warning 1366 Incorrect double value: '.' for column 'f8' at row 1 +Warning 1366 Incorrect integer value: '.' for column 'i1' at row 1 +Warning 1366 Incorrect integer value: '.' for column 'i2' at row 1 +Warning 1366 Incorrect integer value: '.' for column 'i4' at row 1 +Warning 1366 Incorrect integer value: '.' for column 'i8' at row 1 +Warning 1366 Incorrect decimal value: '.' for column 'd' at row 1 +INSERT INTO t1 VALUES ('-','-','-','-','-','-','-'); +Warnings: +Warning 1366 Incorrect double value: '-' for column 'f4' at row 1 +Warning 1366 Incorrect double value: '-' for column 'f8' at row 1 +Warning 1366 Incorrect integer value: '-' for column 'i1' at row 1 +Warning 1366 Incorrect integer value: '-' for column 'i2' at row 1 +Warning 1366 Incorrect integer value: '-' for column 'i4' at row 1 +Warning 1366 Incorrect integer value: '-' for column 'i8' at row 1 +Warning 1366 Incorrect decimal value: '-' for column 'd' at row 1 +INSERT INTO t1 VALUES ('+','+','+','+','+','+','+'); +Warnings: +Warning 1366 Incorrect double value: '+' for column 'f4' at row 1 +Warning 1366 Incorrect double value: '+' for column 'f8' at row 1 +Warning 1366 Incorrect integer value: '+' for column 'i1' at row 1 +Warning 1366 Incorrect integer value: '+' for column 'i2' at row 1 +Warning 1366 Incorrect integer value: '+' for column 'i4' at row 1 +Warning 1366 Incorrect integer value: '+' for column 'i8' at row 1 +Warning 1366 Incorrect decimal value: '+' for column 'd' at row 1 +INSERT INTO t1 VALUES ('1x','1x','1x','1x','1x','1x','1x'); +Warnings: +Warning 1265 Data truncated for column 'f4' at row 1 +Warning 1265 Data truncated for column 'f8' at row 1 +Warning 1265 Data truncated for column 'i1' at row 1 +Warning 1265 Data truncated for column 'i2' at row 1 +Warning 1265 Data truncated for column 'i4' at row 1 +Warning 1265 Data truncated for column 'i8' at row 1 +Warning 1265 Data truncated for column 'd' at row 1 +INSERT INTO t1 VALUES ('1e','1e','1e','1e','1e','1e','1e'); +Warnings: +Warning 1265 Data truncated for column 'f4' at row 1 +Warning 1265 Data truncated for column 'f8' at row 1 +Warning 1265 Data truncated for column 'i1' at row 1 +Warning 1265 Data truncated for column 'i2' at row 1 +Warning 1265 Data truncated for column 'i4' at row 1 +Warning 1265 Data truncated for column 'i8' at row 1 +Warning 1265 Data truncated for column 'd' at row 1 +INSERT INTO t1 VALUES ('1e-','1e-','1e-','1e-','1e-','1e-','1e-'); +Warnings: +Warning 1265 Data truncated for column 'f4' at row 1 +Warning 1265 Data truncated for column 'f8' at row 1 +Warning 1265 Data truncated for column 'i1' at row 1 +Warning 1265 Data truncated for column 'i2' at row 1 +Warning 1265 Data truncated for column 'i4' at row 1 +Warning 1265 Data truncated for column 'i8' at row 1 +Warning 1265 Data truncated for column 'd' at row 1 +INSERT INTO t1 VALUES ('1E+','1E+','1E+','1E+','1E+','1E+','1E+'); +Warnings: +Warning 1265 Data truncated for column 'f4' at row 1 +Warning 1265 Data truncated for column 'f8' at row 1 +Warning 1265 Data truncated for column 'i1' at row 1 +Warning 1265 Data truncated for column 'i2' at row 1 +Warning 1265 Data truncated for column 'i4' at row 1 +Warning 1265 Data truncated for column 'i8' at row 1 +Warning 1265 Data truncated for column 'd' at row 1 +INSERT INTO t1 VALUES ('1e1000','1e1000','1e1000','1e1000','1e1000','1e1000','1e1000'); +Warnings: +Warning 1264 Out of range value for column 'f4' at row 1 +Warning 1264 Out of range value for column 'f4' at row 1 +Warning 1264 Out of range value for column 'f8' at row 1 +Warning 1264 Out of range value for column 'i1' at row 1 +Warning 1264 Out of range value for column 'i2' at row 1 +Warning 1264 Out of range value for column 'i4' at row 1 +Warning 1264 Out of range value for column 'i8' at row 1 +Warning 1264 Out of range value for column 'd' at row 1 +DELETE FROM t1; +INSERT INTO t1 VALUES (0,0,0,0,0,0,0); +INSERT INTO t1 VALUES (0,0,0,0,0,0,0); +INSERT INTO t1 VALUES (1,1,1,1,1,1,1); +INSERT INTO t1 VALUES (1,1,1,1,1,1,1); +INSERT INTO t1 VALUES (2,2,2,2,2,2,2); +INSERT INTO t1 VALUES (2,2,2,2,2,2,2); +INSERT INTO t1 VALUES (3,3,3,3,3,3,3); +INSERT INTO t1 VALUES (3,3,3,3,3,3,3); +INSERT INTO t1 VALUES (4,4,4,4,4,4,4); +INSERT INTO t1 VALUES (4,4,4,4,4,4,4); +INSERT INTO t1 VALUES (5,5,5,5,5,5,5); +INSERT INTO t1 VALUES (5,5,5,5,5,5,5); +SELECT COUNT(*) FROM t1 WHERE f4='1 '; +COUNT(*) +2 +Warnings: +Note 1292 Truncated incorrect DOUBLE value: '1 ' +SELECT COUNT(*) FROM t1 WHERE f8='1 '; +COUNT(*) +2 +Warnings: +Note 1292 Truncated incorrect DOUBLE value: '1 ' +SELECT COUNT(*) FROM t1 WHERE i1='1 '; +COUNT(*) +2 +Warnings: +Note 1292 Truncated incorrect DOUBLE value: '1 ' +SELECT COUNT(*) FROM t1 WHERE i2='1 '; +COUNT(*) +2 +Warnings: +Note 1292 Truncated incorrect DOUBLE value: '1 ' +SELECT COUNT(*) FROM t1 WHERE i4='1 '; +COUNT(*) +2 +Warnings: +Note 1292 Truncated incorrect DOUBLE value: '1 ' +SELECT COUNT(*) FROM t1 WHERE i8='1 '; +COUNT(*) +2 +Warnings: +Note 1292 Truncated incorrect DOUBLE value: '1 ' +SELECT COUNT(*) FROM t1 WHERE d='1 '; +COUNT(*) +2 +Warnings: +Note 1292 Truncated incorrect DOUBLE value: '1 ' +SELECT COUNT(*) FROM t1 WHERE f4=''; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' +SELECT COUNT(*) FROM t1 WHERE f8=''; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' +SELECT COUNT(*) FROM t1 WHERE i1=''; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' +SELECT COUNT(*) FROM t1 WHERE i2=''; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' +SELECT COUNT(*) FROM t1 WHERE i4=''; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' +SELECT COUNT(*) FROM t1 WHERE i8=''; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' +SELECT COUNT(*) FROM t1 WHERE d=''; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' +SELECT COUNT(*) FROM t1 WHERE f4='x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'x' +SELECT COUNT(*) FROM t1 WHERE f8='x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'x' +SELECT COUNT(*) FROM t1 WHERE i1='x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'x' +SELECT COUNT(*) FROM t1 WHERE i2='x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'x' +SELECT COUNT(*) FROM t1 WHERE i4='x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'x' +SELECT COUNT(*) FROM t1 WHERE i8='x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'x' +SELECT COUNT(*) FROM t1 WHERE d='x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'x' +SELECT COUNT(*) FROM t1 WHERE f4=' x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: ' x' +SELECT COUNT(*) FROM t1 WHERE f8=' x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: ' x' +SELECT COUNT(*) FROM t1 WHERE i1=' x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: ' x' +SELECT COUNT(*) FROM t1 WHERE i2=' x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: ' x' +SELECT COUNT(*) FROM t1 WHERE i4=' x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: ' x' +SELECT COUNT(*) FROM t1 WHERE i8=' x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: ' x' +SELECT COUNT(*) FROM t1 WHERE d=' x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: ' x' +SELECT COUNT(*) FROM t1 WHERE f4='.'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '.' +SELECT COUNT(*) FROM t1 WHERE f8='.'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '.' +SELECT COUNT(*) FROM t1 WHERE i1='.'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '.' +SELECT COUNT(*) FROM t1 WHERE i2='.'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '.' +SELECT COUNT(*) FROM t1 WHERE i4='.'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '.' +SELECT COUNT(*) FROM t1 WHERE i8='.'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '.' +SELECT COUNT(*) FROM t1 WHERE d='.'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '.' +SELECT COUNT(*) FROM t1 WHERE f4='-'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '-' +SELECT COUNT(*) FROM t1 WHERE f8='-'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '-' +SELECT COUNT(*) FROM t1 WHERE i1='-'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '-' +SELECT COUNT(*) FROM t1 WHERE i2='-'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '-' +SELECT COUNT(*) FROM t1 WHERE i4='-'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '-' +SELECT COUNT(*) FROM t1 WHERE i8='-'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '-' +SELECT COUNT(*) FROM t1 WHERE d='-'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '-' +SELECT COUNT(*) FROM t1 WHERE f4='+'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '+' +SELECT COUNT(*) FROM t1 WHERE f8='+'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '+' +SELECT COUNT(*) FROM t1 WHERE i1='+'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '+' +SELECT COUNT(*) FROM t1 WHERE i2='+'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '+' +SELECT COUNT(*) FROM t1 WHERE i4='+'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '+' +SELECT COUNT(*) FROM t1 WHERE i8='+'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '+' +SELECT COUNT(*) FROM t1 WHERE d='+'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '+' +SELECT COUNT(*) FROM t1 WHERE f4='1x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1x' +SELECT COUNT(*) FROM t1 WHERE f8='1x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1x' +SELECT COUNT(*) FROM t1 WHERE i1='1x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1x' +SELECT COUNT(*) FROM t1 WHERE i2='1x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1x' +SELECT COUNT(*) FROM t1 WHERE i4='1x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1x' +SELECT COUNT(*) FROM t1 WHERE i8='1x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1x' +SELECT COUNT(*) FROM t1 WHERE d='1x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1x' +SELECT COUNT(*) FROM t1 WHERE f4='1e'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e' +SELECT COUNT(*) FROM t1 WHERE f8='1e'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e' +SELECT COUNT(*) FROM t1 WHERE i1='1e'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e' +SELECT COUNT(*) FROM t1 WHERE i2='1e'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e' +SELECT COUNT(*) FROM t1 WHERE i4='1e'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e' +SELECT COUNT(*) FROM t1 WHERE i8='1e'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e' +SELECT COUNT(*) FROM t1 WHERE d='1e'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e' +SELECT COUNT(*) FROM t1 WHERE f4='1e+'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e+' +SELECT COUNT(*) FROM t1 WHERE f8='1e+'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e+' +SELECT COUNT(*) FROM t1 WHERE i1='1e+'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e+' +SELECT COUNT(*) FROM t1 WHERE i2='1e+'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e+' +SELECT COUNT(*) FROM t1 WHERE i4='1e+'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e+' +SELECT COUNT(*) FROM t1 WHERE i8='1e+'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e+' +SELECT COUNT(*) FROM t1 WHERE d='1e+'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e+' +SELECT COUNT(*) FROM t1 WHERE f4='1E-'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1E-' +SELECT COUNT(*) FROM t1 WHERE f8='1E-'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1E-' +SELECT COUNT(*) FROM t1 WHERE i1='1E-'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1E-' +SELECT COUNT(*) FROM t1 WHERE i2='1E-'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1E-' +SELECT COUNT(*) FROM t1 WHERE i4='1E-'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1E-' +SELECT COUNT(*) FROM t1 WHERE i8='1E-'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1E-' +SELECT COUNT(*) FROM t1 WHERE d='1E-'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1E-' +SELECT COUNT(*) FROM t1 WHERE f4='1Ex'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1Ex' +SELECT COUNT(*) FROM t1 WHERE f8='1Ex'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1Ex' +SELECT COUNT(*) FROM t1 WHERE i1='1Ex'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1Ex' +SELECT COUNT(*) FROM t1 WHERE i2='1Ex'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1Ex' +SELECT COUNT(*) FROM t1 WHERE i4='1Ex'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1Ex' +SELECT COUNT(*) FROM t1 WHERE i8='1Ex'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1Ex' +SELECT COUNT(*) FROM t1 WHERE d='1Ex'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1Ex' +SELECT COUNT(*) FROM t1 WHERE f4='1e+x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e+x' +SELECT COUNT(*) FROM t1 WHERE f8='1e+x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e+x' +SELECT COUNT(*) FROM t1 WHERE i1='1e+x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e+x' +SELECT COUNT(*) FROM t1 WHERE i2='1e+x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e+x' +SELECT COUNT(*) FROM t1 WHERE i4='1e+x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e+x' +SELECT COUNT(*) FROM t1 WHERE i8='1e+x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e+x' +SELECT COUNT(*) FROM t1 WHERE d='1e+x'; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e+x' +SELECT COUNT(*) FROM t1 WHERE f4='1e1000'; +COUNT(*) +0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e1000' +SELECT COUNT(*) FROM t1 WHERE f8='1e1000'; +COUNT(*) +0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e1000' +SELECT COUNT(*) FROM t1 WHERE i1='1e1000'; +COUNT(*) +0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e1000' +SELECT COUNT(*) FROM t1 WHERE i2='1e1000'; +COUNT(*) +0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e1000' +SELECT COUNT(*) FROM t1 WHERE i4='1e1000'; +COUNT(*) +0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e1000' +SELECT COUNT(*) FROM t1 WHERE i8='1e1000'; +COUNT(*) +0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e1000' +SELECT COUNT(*) FROM t1 WHERE d='1e1000'; +COUNT(*) +0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e1000' +ALTER TABLE t1 +ADD KEY f4(f4), +ADD KEY f8(f8), +ADD KEY i1(i1), +ADD KEY i2(i2), +ADD KEY i4(i4), +ADD KEY i8(i8), +ADD KEY d(d); +SELECT COUNT(*) FROM t1 FORCE INDEX(f4) WHERE f4='1 '; +COUNT(*) +2 +Warnings: +Note 1292 Truncated incorrect DOUBLE value: '1 ' +SELECT COUNT(*) FROM t1 FORCE INDEX(f8) WHERE f8='1 '; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 FORCE INDEX(i1) WHERE i1='1 '; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 FORCE INDEX(i2) WHERE i2='1 '; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 FORCE INDEX(i4) WHERE i4='1 '; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 FORCE INDEX(i8) WHERE i8='1 '; +COUNT(*) +2 +Warnings: +Note 1292 Truncated incorrect DOUBLE value: '1 ' +SELECT COUNT(*) FROM t1 FORCE INDEX(d) WHERE d='1 '; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 FORCE INDEX(f4) WHERE f4=''; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' +SELECT COUNT(*) FROM t1 FORCE INDEX(f8) WHERE f8=''; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 FORCE INDEX(i1) WHERE i1=''; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 FORCE INDEX(i2) WHERE i2=''; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 FORCE INDEX(i4) WHERE i4=''; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 FORCE INDEX(i8) WHERE i8=''; +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' +SELECT COUNT(*) FROM t1 FORCE INDEX(d) WHERE d=''; +COUNT(*) +2 +DROP TABLE t1; +SELECT +CAST('1 ' AS SIGNED), +CAST('1 ' AS UNSIGNED), +CAST('1 ' AS DECIMAL), +CAST('1 ' AS DOUBLE); +CAST('1 ' AS SIGNED) CAST('1 ' AS UNSIGNED) CAST('1 ' AS DECIMAL) CAST('1 ' AS DOUBLE) +1 1 1 1 +Warnings: +Note 1292 Truncated incorrect INTEGER value: '1 ' +Note 1292 Truncated incorrect INTEGER value: '1 ' +Note 1292 Truncated incorrect DECIMAL value: '1 ' +Note 1292 Truncated incorrect DOUBLE value: '1 ' +SELECT +CAST('' AS SIGNED), +CAST('' AS UNSIGNED), +CAST('' AS DECIMAL), +CAST('' AS DOUBLE); +CAST('' AS SIGNED) CAST('' AS UNSIGNED) CAST('' AS DECIMAL) CAST('' AS DOUBLE) +0 0 0 0 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DOUBLE value: '' +SELECT +CAST('x' AS SIGNED), +CAST('x' AS UNSIGNED), +CAST('x' AS DECIMAL), +CAST('x' AS DOUBLE); +CAST('x' AS SIGNED) CAST('x' AS UNSIGNED) CAST('x' AS DECIMAL) CAST('x' AS DOUBLE) +0 0 0 0 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'x' +Warning 1292 Truncated incorrect INTEGER value: 'x' +Warning 1292 Truncated incorrect DECIMAL value: 'x' +Warning 1292 Truncated incorrect DOUBLE value: 'x' +SELECT +CAST(' x' AS SIGNED), +CAST(' x' AS UNSIGNED), +CAST(' x' AS DECIMAL), +CAST(' x' AS DOUBLE); +CAST(' x' AS SIGNED) CAST(' x' AS UNSIGNED) CAST(' x' AS DECIMAL) CAST(' x' AS DOUBLE) +0 0 0 0 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: ' x' +Warning 1292 Truncated incorrect INTEGER value: ' x' +Warning 1292 Truncated incorrect DECIMAL value: ' x' +Warning 1292 Truncated incorrect DOUBLE value: ' x' +SELECT +CAST('.' AS SIGNED), +CAST('.' AS UNSIGNED), +CAST('.' AS DECIMAL), +CAST('.' AS DOUBLE); +CAST('.' AS SIGNED) CAST('.' AS UNSIGNED) CAST('.' AS DECIMAL) CAST('.' AS DOUBLE) +0 0 0 0 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '.' +Warning 1292 Truncated incorrect INTEGER value: '.' +Warning 1292 Truncated incorrect DECIMAL value: '.' +Warning 1292 Truncated incorrect DOUBLE value: '.' +SELECT +CAST('-' AS SIGNED), +CAST('-' AS UNSIGNED), +CAST('-' AS DECIMAL), +CAST('-' AS DOUBLE); +CAST('-' AS SIGNED) CAST('-' AS UNSIGNED) CAST('-' AS DECIMAL) CAST('-' AS DOUBLE) +0 0 0 0 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '-' +Warning 1292 Truncated incorrect INTEGER value: '-' +Warning 1292 Truncated incorrect DECIMAL value: '-' +Warning 1292 Truncated incorrect DOUBLE value: '-' +SELECT +CAST('+' AS SIGNED), +CAST('+' AS UNSIGNED), +CAST('+' AS DECIMAL), +CAST('+' AS DOUBLE); +CAST('+' AS SIGNED) CAST('+' AS UNSIGNED) CAST('+' AS DECIMAL) CAST('+' AS DOUBLE) +0 0 0 0 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '+' +Warning 1292 Truncated incorrect INTEGER value: '+' +Warning 1292 Truncated incorrect DECIMAL value: '+' +Warning 1292 Truncated incorrect DOUBLE value: '+' +SELECT +CAST('1x' AS SIGNED), +CAST('1x' AS UNSIGNED), +CAST('1x' AS DECIMAL), +CAST('1x' AS DOUBLE); +CAST('1x' AS SIGNED) CAST('1x' AS UNSIGNED) CAST('1x' AS DECIMAL) CAST('1x' AS DOUBLE) +1 1 1 1 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '1x' +Warning 1292 Truncated incorrect INTEGER value: '1x' +Warning 1292 Truncated incorrect DECIMAL value: '1x' +Warning 1292 Truncated incorrect DOUBLE value: '1x' +SELECT +CAST('1e' AS SIGNED), +CAST('1e' AS UNSIGNED), +CAST('1e' AS DECIMAL), +CAST('1e' AS DOUBLE); +CAST('1e' AS SIGNED) CAST('1e' AS UNSIGNED) CAST('1e' AS DECIMAL) CAST('1e' AS DOUBLE) +1 1 1 1 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '1e' +Warning 1292 Truncated incorrect INTEGER value: '1e' +Warning 1292 Truncated incorrect DECIMAL value: '1e' +Warning 1292 Truncated incorrect DOUBLE value: '1e' +SELECT +CAST('1e-' AS SIGNED), +CAST('1e-' AS UNSIGNED), +CAST('1e-' AS DECIMAL), +CAST('1e-' AS DOUBLE); +CAST('1e-' AS SIGNED) CAST('1e-' AS UNSIGNED) CAST('1e-' AS DECIMAL) CAST('1e-' AS DOUBLE) +1 1 1 1 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '1e-' +Warning 1292 Truncated incorrect INTEGER value: '1e-' +Warning 1292 Truncated incorrect DECIMAL value: '1e-' +Warning 1292 Truncated incorrect DOUBLE value: '1e-' +SELECT +CAST('1E+' AS SIGNED), +CAST('1E+' AS UNSIGNED), +CAST('1E+' AS DECIMAL), +CAST('1E+' AS DOUBLE); +CAST('1E+' AS SIGNED) CAST('1E+' AS UNSIGNED) CAST('1E+' AS DECIMAL) CAST('1E+' AS DOUBLE) +1 1 1 1 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '1E+' +Warning 1292 Truncated incorrect INTEGER value: '1E+' +Warning 1292 Truncated incorrect DECIMAL value: '1E+' +Warning 1292 Truncated incorrect DOUBLE value: '1E+' +# +# End of 10.0 tests +# +# +# Start of 10.1 tests +# +# +# MDEV-9653 Assertion `length || !scale' failed in uint my_decimal_length_to_precision(uint, uint, bool) +# +SELECT NULL+1 AS c0, +COALESCE(NULL)+1 AS c2, +COALESCE(COALESCE(NULL))+1 AS c3, +''+1 AS c4, +COALESCE('')+1 AS c5, +COALESCE(COALESCE(''))+1 AS c6; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0 5 17 0 Y 32896 0 63 +def c2 5 17 0 Y 32896 0 63 +def c3 5 17 0 Y 32896 0 63 +def c4 5 23 1 N 32897 31 63 +def c5 5 17 1 N 32897 0 63 +def c6 5 17 1 N 32897 0 63 +c0 c2 c3 c4 c5 c6 +NULL NULL NULL 1 1 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' +Warning 1292 Truncated incorrect DOUBLE value: '' +Warning 1292 Truncated incorrect DOUBLE value: '' +# +# Start of 10.1 tests +# diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result index 53fc3104666..c998c28ebd9 100644 --- a/mysql-test/r/type_ranges.result +++ b/mysql-test/r/type_ranges.result @@ -15,7 +15,7 @@ ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL, umedium mediumint(8) unsigned DEFAULT '0' NOT NULL, ulong int(11) unsigned DEFAULT '0' NOT NULL, ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL, -time_stamp timestamp, +time_stamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, date_field date, time_field time, date_time datetime, @@ -129,6 +129,9 @@ Warning 1264 Out of range value for column 'ushort' at row 1 Warning 1264 Out of range value for column 'umedium' at row 1 Warning 1265 Data truncated for column 'options' at row 1 insert into t1 (tiny) values (1); +Warnings: +Warning 1364 Field 'mediumblob_col' doesn't have a default value +Warning 1364 Field 'longblob_col' doesn't have a default value select auto,string,tiny,short,medium,long_int,longlong,real_float,real_double,utiny,ushort,umedium,ulong,ulonglong,mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000),date_field,time_field,date_time,blob_col,tinyblob_col,mediumblob_col,longblob_col from t1; auto string tiny short medium long_int longlong real_float real_double utiny ushort umedium ulong ulonglong mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000) date_field time_field date_time blob_col tinyblob_col mediumblob_col longblob_col 10 1 1 1 1 1 1 1.0 1.0000 1 00001 1 1 1 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1 1 1 @@ -275,15 +278,15 @@ drop table t2; create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, 'a' as t2, repeat('a',256) as t3, binary repeat('b',256) as t4, repeat('a',4096) as t5, binary repeat('b',4096) as t6, '' as t7, binary '' as t8 from t1; show full columns from t2; Field Type Collation Null Key Default Extra Privileges Comment -auto int(11) unsigned NULL NO PRI 0 # -t1 int(1) NULL NO 0 # -t2 varchar(1) latin1_swedish_ci NO # -t3 varchar(256) latin1_swedish_ci NO # -t4 varbinary(256) NULL NO # +auto int(11) unsigned NULL NO PRI NULL # +t1 int(1) NULL NO NULL # +t2 varchar(1) latin1_swedish_ci NO NULL # +t3 varchar(256) latin1_swedish_ci NO NULL # +t4 varbinary(256) NULL NO NULL # t5 text latin1_swedish_ci NO NULL # t6 blob NULL NO NULL # -t7 char(0) latin1_swedish_ci NO # -t8 binary(0) NULL NO # +t7 char(0) latin1_swedish_ci NO NULL # +t8 binary(0) NULL NO NULL # select t1,t2,length(t3),length(t4),length(t5),length(t6),t7,t8 from t2; t1 t2 length(t3) length(t4) length(t5) length(t6) t7 t8 1 a 256 256 4096 4096 @@ -304,7 +307,7 @@ show full columns from t3; Field Type Collation Null Key Default Extra Privileges Comment c1 int(11) NULL YES NULL # c2 int(11) NULL YES NULL # -const int(1) NULL NO 0 # +const int(1) NULL NO NULL # drop table t1,t2,t3; create table t1 ( myfield INT NOT NULL, UNIQUE INDEX (myfield), unique (myfield), index(myfield)); Warnings: diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result index f3b7019c989..586c6345e00 100644 --- a/mysql-test/r/type_set.result +++ b/mysql-test/r/type_set.result @@ -263,3 +263,55 @@ DROP TABLE t1; # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-8729 Wrong result for SELECT..WHERE HEX(enum_column)='61' AND enum_column='a ' +# +CREATE TABLE t1 (a SET('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t1 VALUES ('a'),('A'); +SELECT * FROM t1 WHERE a='a '; +a +a +SELECT * FROM t1 WHERE HEX(a)='61'; +a +a +SELECT * FROM t1 WHERE HEX(a)='61' AND a='a '; +a +a +# Can't propagate the equality into HEX(a), because binary collations still ignore trailing spaces +EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a ') and (hex(`test`.`t1`.`a`) = '61')) +DROP TABLE t1; +CREATE TABLE t1 (a SET('a','a ') CHARACTER SET BINARY); +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE a='a '; +a +a +SELECT * FROM t1 WHERE HEX(a)='61'; +a +a +SELECT * FROM t1 WHERE HEX(a)='61' AND a='a'; +a +a +SELECT * FROM t1 WHERE HEX(a)='61' AND a='a '; +a +# Ok to propagate the equality into HEX(a), because "CHARACTER SET BINARY" does not ignore trailing spaces +EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 'a') +EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/type_temporal_innodb.result b/mysql-test/r/type_temporal_innodb.result new file mode 100644 index 00000000000..425e499a5d3 --- /dev/null +++ b/mysql-test/r/type_temporal_innodb.result @@ -0,0 +1,156 @@ +# +# MDEV-9604 crash in Item::save_in_field with empty enum value +# +SELECT TIME'00:00:00'=''; +TIME'00:00:00'='' +1 +Warnings: +Warning 1292 Truncated incorrect time value: '' +CREATE TABLE t1 (a ENUM('a'), b TIME, c INT, KEY(b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('','00:00:00',0); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +SELECT * FROM t1 WHERE b=''; +a b c + 00:00:00 0 +Warnings: +Warning 1292 Truncated incorrect time value: '' +SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; +a b c + 00:00:00 0 +Warnings: +Warning 1292 Truncated incorrect time value: '' +SELECT * FROM t1 WHERE a=b; +a b c + 00:00:00 0 +Warnings: +Warning 1292 Truncated incorrect time value: '' +SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; +1 +1 +Warnings: +Warning 1292 Truncated incorrect time value: '' +ALTER TABLE t1 ENGINE=MyISAM; +SELECT * FROM t1 WHERE b=''; +a b c + 00:00:00 0 +Warnings: +Warning 1292 Truncated incorrect time value: '' +SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; +a b c + 00:00:00 0 +Warnings: +Warning 1292 Truncated incorrect time value: '' +SELECT * FROM t1 WHERE a=b; +a b c + 00:00:00 0 +Warnings: +Warning 1292 Truncated incorrect time value: '' +SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; +1 +1 +Warnings: +Warning 1292 Truncated incorrect time value: '' +DROP TABLE t1; +SELECT DATE'0000-00-00'=''; +DATE'0000-00-00'='' +1 +Warnings: +Warning 1292 Incorrect datetime value: '' +CREATE TABLE t1 (a ENUM('a'), b DATE, c INT, KEY(b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('','0000-00-00',0); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +SELECT * FROM t1 WHERE b=''; +a b c + 0000-00-00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; +a b c + 0000-00-00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT * FROM t1 WHERE a=b; +a b c + 0000-00-00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; +1 +1 +Warnings: +Warning 1292 Incorrect datetime value: '' +ALTER TABLE t1 ENGINE=MyISAM; +SELECT * FROM t1 WHERE b=''; +a b c + 0000-00-00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; +a b c + 0000-00-00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT * FROM t1 WHERE a=b; +a b c + 0000-00-00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; +1 +1 +Warnings: +Warning 1292 Incorrect datetime value: '' +DROP TABLE t1; +SELECT TIMESTAMP'0000-00-00 00:00:00'=''; +TIMESTAMP'0000-00-00 00:00:00'='' +1 +Warnings: +Warning 1292 Incorrect datetime value: '' +CREATE TABLE t1 (a ENUM('a'), b DATETIME, c INT, KEY(b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('','0000-00-00 00:00:00',0); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +SELECT * FROM t1 WHERE b=''; +a b c + 0000-00-00 00:00:00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; +a b c + 0000-00-00 00:00:00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT * FROM t1 WHERE a=b; +a b c + 0000-00-00 00:00:00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; +1 +1 +Warnings: +Warning 1292 Incorrect datetime value: '' +ALTER TABLE t1 ENGINE=MyISAM; +SELECT * FROM t1 WHERE b=''; +a b c + 0000-00-00 00:00:00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; +a b c + 0000-00-00 00:00:00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT * FROM t1 WHERE a=b; +a b c + 0000-00-00 00:00:00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; +1 +1 +Warnings: +Warning 1292 Incorrect datetime value: '' +DROP TABLE t1; diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result index 477703edebb..b5689d31aef 100644 --- a/mysql-test/r/type_time.result +++ b/mysql-test/r/type_time.result @@ -393,3 +393,827 @@ SET timestamp=DEFAULT; # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-8699 Wrong result for SELECT..WHERE HEX(date_column)!='323030312D30312D3031' AND date_column='2001-01-01x' +# +# Trailing garbage in string literals +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES ('00:00:00'),('00:00:01'); +SELECT * FROM t1 WHERE LENGTH(a)=8; +a +00:00:00 +00:00:01 +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00x'; +a +00:00:00 +Warnings: +Warning 1292 Truncated incorrect time value: '00:00:00x' +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00x'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Warning 1292 Truncated incorrect time value: '00:00:00x' +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00x'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Warning 1292 Truncated incorrect time value: '00:00:00x' +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (<cache>(length(TIME'00:00:00')) = (30 + rand()))) +DROP TABLE t1; +# Trailing fractional digits in string literals +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES ('00:00:00'),('00:00:01'); +SELECT * FROM t1 WHERE LENGTH(a)=8; +a +00:00:00 +00:00:01 +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00.000000'; +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00.000000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00.000000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (<cache>(length(TIME'00:00:00')) = (30 + rand()))) +DROP TABLE t1; +# Trailing fractional digits in temporal literals +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES ('00:00:00'),('00:00:01'); +SELECT * FROM t1 WHERE LENGTH(a)=8; +a +00:00:00 +00:00:01 +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'00:00:00.000000'; +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'00:00:00.000000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00.000000') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00.000000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00.000000') and (<cache>(length(TIME'00:00:00')) = (30 + rand()))) +DROP TABLE t1; +# Trailing fractional digits in temporal literals, same precision +CREATE TABLE t1 (a TIME(6)); +INSERT INTO t1 VALUES ('00:00:00'),('00:00:01'); +SELECT * FROM t1 WHERE LENGTH(a)=8; +a +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'00:00:00.000000'; +a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'00:00:00.000000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00.000000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00.000000') and (<cache>(length(TIME'00:00:00.000000')) = (30 + rand()))) +DROP TABLE t1; +# Leading spaces in string literals +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES ('00:00:00'),('00:00:01'); +SELECT * FROM t1 WHERE LENGTH(a)=8; +a +00:00:00 +00:00:01 +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=' 00:00:00'; +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=' 00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' 00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (<cache>(length(TIME'00:00:00')) = (30 + rand()))) +DROP TABLE t1; +# Numeric format in string literals +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES ('00:00:00'),('00:00:01'); +SELECT * FROM t1 WHERE LENGTH(a)=8; +a +00:00:00 +00:00:01 +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='000000'; +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='000000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='000000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (<cache>(length(TIME'00:00:00')) = (30 + rand()))) +DROP TABLE t1; +# +# MDEV-8766 Wrong result for SELECT..WHERE LENGTH(time_column)=8 AND time_column=TIMESTAMP'2001-01-01 10:20:31' +# +SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03'); +# TIMESTAMP literal with the same scale, ok to propagate +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31'); +SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 10:20:31'; +a +10:20:31 +SELECT * FROM t1 WHERE LENGTH(a)=8; +a +10:20:31 +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31'; +a +10:20:31 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31') and (<cache>(length(TIME'10:20:31')) = (30 + rand()))) +DROP TABLE t1; +# TIMESTAMP literal with a bigger scale and fractional second truncation +# Ok to propagate with precision truncation +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31'); +SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 10:20:31.123'; +a +SELECT * FROM t1 WHERE LENGTH(a)=8; +a +10:20:31 +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123'; +a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31.123000') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.123'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123000') and (<cache>(length(TIME'10:20:31')) = (30 + rand()))) +DROP TABLE t1; +# TIMESTAMP literal with a bigger scale and no fractional second truncation +# Ok to propagate +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31'); +SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 10:20:31.000'; +a +10:20:31 +SELECT * FROM t1 WHERE LENGTH(a)=8; +a +10:20:31 +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.000'; +a +10:20:31 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31') and (<cache>(length(TIME'10:20:31')) = (30 + rand()))) +DROP TABLE t1; +# TIMESTAMP literal with a smaller scale +# Ok to propagate +CREATE TABLE t1 (a TIME(6)); +INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31'); +SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 10:20:31.123'; +a +SELECT * FROM t1 WHERE LENGTH(a)=8; +a +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123'; +a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.123'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123000') and (<cache>(length(TIME'10:20:31.123000')) = (30 + rand()))) +DROP TABLE t1; +# TIME literal with a bigger scale and fractional second truncation +# Ok to propagate with precision truncation +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31'); +SELECT * FROM t1 WHERE a=TIME'10:20:31.123'; +a +SELECT * FROM t1 WHERE LENGTH(a)=8; +a +10:20:31 +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.123'; +a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.123'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31.123') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'10:20:31.123'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123') and (<cache>(length(TIME'10:20:31')) = (30 + rand()))) +DROP TABLE t1; +# TIME literal with a bigger scale and no fractional second truncation +# Ok to propagate +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31'); +SELECT * FROM t1 WHERE a=TIME'10:20:31.000'; +a +10:20:31 +SELECT * FROM t1 WHERE LENGTH(a)=8; +a +10:20:31 +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.000'; +a +10:20:31 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31.000') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'10:20:31.000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.000') and (<cache>(length(TIME'10:20:31')) = (30 + rand()))) +DROP TABLE t1; +# TIME literal with a smaller scale +# Ok to propagate +CREATE TABLE t1 (a TIME(6)); +INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31'); +SELECT * FROM t1 WHERE a=TIME'10:20:31.123'; +a +SELECT * FROM t1 WHERE LENGTH(a)=8; +a +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.123'; +a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.123'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'10:20:31.123'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123') and (<cache>(length(TIME'10:20:31.123000')) = (30 + rand()))) +DROP TABLE t1; +# TIME-alike string literal with a bigger scale and fractional second truncation +# Ok to propagate with precision truncation +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31'); +SELECT * FROM t1 WHERE a='10:20:31.123'; +a +SELECT * FROM t1 WHERE LENGTH(a)=8; +a +10:20:31 +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123'; +a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31.123000') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.123'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123000') and (<cache>(length(TIME'10:20:31')) = (30 + rand()))) +DROP TABLE t1; +# TIME-alike string literal with a bigger scale and no fractional second truncation +# Ok to propagate +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31'); +SELECT * FROM t1 WHERE a='10:20:31.000'; +a +10:20:31 +SELECT * FROM t1 WHERE LENGTH(a)=8; +a +10:20:31 +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.000'; +a +10:20:31 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31') and (<cache>(length(TIME'10:20:31')) = (30 + rand()))) +DROP TABLE t1; +# TIME-alike string literal with a smaller scale +# Ok to propagate +CREATE TABLE t1 (a TIME(6)); +INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31'); +SELECT * FROM t1 WHERE a='10:20:31.123'; +a +SELECT * FROM t1 WHERE LENGTH(a)=8; +a +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123'; +a +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.123'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123000') and (<cache>(length(TIME'10:20:31.123000')) = (30 + rand()))) +DROP TABLE t1; +SET timestamp=DEFAULT; +SET @@old_mode=zero_date_time_cast; +# TIMESTAMP literal, old mode +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES ('0000-00-00 10:20:30'),('0000-00-00 10:20:31'); +INSERT INTO t1 VALUES ('0000-00-01 10:20:30'),('0000-00-01 10:20:31'); +INSERT INTO t1 VALUES ('31 10:20:30'),('32 10:20:30'),('33 10:20:30'),('34 10:20:30'); +SELECT * FROM t1; +a +10:20:30 +10:20:31 +34:20:30 +34:20:31 +754:20:30 +778:20:30 +802:20:30 +826:20:30 +# Old mode, TIMESTAMP literal, zero YYYYMMDD, Ok to propagate +SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30'; +a +10:20:30 +SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=8; +a +10:20:30 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=8; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:30') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=30+RAND(); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:30') and (<cache>(length(TIME'10:20:30')) = (30 + rand()))) +# Old mode, TIMESTAMP literal, zon-zero YYYYMMDD, no propagation +SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30'; +a +34:20:30 +SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30' AND LENGTH(a)=8; +a +34:20:30 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30' AND LENGTH(a)=8; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'0000-00-01 10:20:30') and (length(`test`.`t1`.`a`) = 8)) +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30' AND LENGTH(a)=30+RAND(); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'0000-00-01 10:20:30') and (length(`test`.`t1`.`a`) = (30 + rand()))) +# Old mode, TIMESTAMP-alike string literal, zero YYYYMMDD, Ok to propagate +SELECT * FROM t1 WHERE a='0000-00-00 10:20:30'; +a +10:20:30 +SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=8; +a +10:20:30 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=8; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:30') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=30+RAND(); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:30') and (<cache>(length(TIME'10:20:30')) = (30 + rand()))) +# Old mode, TIMESTAMP-alike literal, zon-zero YYYYMMDD, no propagation +SELECT * FROM t1 WHERE a='0000-00-01 10:20:30'; +a +34:20:30 +SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8; +a +34:20:30 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '0000-00-01 10:20:30') and (length(`test`.`t1`.`a`) = 8)) +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=30+RAND(); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '0000-00-01 10:20:30') and (length(`test`.`t1`.`a`) = (30 + rand()))) +DROP TABLE t1; +SET @@old_mode=DEFAULT; +# +# MDEV-8706 Wrong result for SELECT..WHERE time_column=TIMESTAMP'2015-08-30 00:00:00' AND time_column='00:00:00' +# +SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30'); +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES ('00:00:00'),('00:00:01'); +SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00'; +a +00:00:00 +SELECT * FROM t1 WHERE a='00:00:00'; +a +00:00:00 +SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00' AND a='00:00:00'; +a +00:00:00 +SELECT * FROM t1 WHERE a>=TIMESTAMP'2015-08-30 00:00:00' AND a='00:00:00'; +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a>=TIMESTAMP'2015-08-30 00:00:00' AND a='00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00') +DROP TABLE t1; +SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30'); +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES ('00:00:00'),('00:00:01'); +SELECT * FROM t1 WHERE DATE(a)<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00'; +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE DATE(a)<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (timestamp('2015-08-08',(TIME'00:00:00' + rand())) <= TIMESTAMP'2015-08-30 00:00:00.1')) +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00.1'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00.100000') and (timestamp('2015-08-08',(TIME'00:00:00' + rand())) <= TIMESTAMP'2015-08-30 00:00:00.1')) +DROP TABLE t1; +SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30'); +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES ('00:00:00'),('00:00:01'); +SELECT * FROM t1 WHERE DATE(a)<=DATE'2015-08-30' AND a='00:00:00'; +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE DATE(a)<=DATE'2015-08-30' AND a='00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=DATE'2015-08-30' AND a='00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (timestamp('2015-08-08',(TIME'00:00:00' + rand())) <= DATE'2015-08-30')) +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=DATE'2015-08-30' AND a='00:00:00.1'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00.100000') and (timestamp('2015-08-08',(TIME'00:00:00' + rand())) <= DATE'2015-08-30')) +DROP TABLE t1; +SET timestamp=DEFAULT; +# +# MDEV-8795 Equal expression propagation does not work for temporal literals +# +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES ('00:00:01'),('00:00:02'); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:01' AND COALESCE(a)>=TIME'00:00:01'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = TIME'00:00:01') +DROP TABLE t1; +# +# MDEV-8793 Wrong result set for SELECT ... WHERE COALESCE(time_column)=TIME('00:00:00') AND COALESCE(time_column)=DATE('2015-09-11') +# +SET timestamp=UNIX_TIMESTAMP('2015-09-11 20:20:20'); +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES('10:20:30'),('00:00:00'); +SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00'); +a +00:00:00 +SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11'); +a +00:00:00 +# TIME cast + DATE cast +SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE('2015-09-11'); +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE('2015-09-11'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = 00:00:00) +# TIME cast + DATE literal +SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE'2015-09-11'; +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE'2015-09-11'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = 00:00:00) +# TIME literal + DATE cast +SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE('2015-09-11'); +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE('2015-09-11'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = TIME'00:00:00') +# TIME literal + DATE literal +SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE'2015-09-11'; +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE'2015-09-11'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = TIME'00:00:00') +# TIME-alike string literal + DATE cast +SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE('2015-09-11'); +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE('2015-09-11'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = '00:00:00') and (coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00)) +# TIME-alike string literal + DATE literal +SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE'2015-09-11'; +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE'2015-09-11'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = '00:00:00') and (coalesce(`test`.`t1`.`a`) = DATE'2015-09-11')) +# TIME-alike integer literal + DATE cast +SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE('2015-09-11'); +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE('2015-09-11'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = 0) and (coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00)) +# TIME-alike integer literal + DATE literal +SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE'2015-09-11'; +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE'2015-09-11'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = 0) and (coalesce(`test`.`t1`.`a`) = DATE'2015-09-11')) +# DATE cast + TIME cast +SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME('00:00:00'); +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME('00:00:00'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00) +# DATE cast + TIME literal +SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME'00:00:00'; +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME'00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00) +# DATE cast + TIME-alike string literal +SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)='00:00:00'; +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)='00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00) and (coalesce(`test`.`t1`.`a`) = '00:00:00')) +# DATE cast + TIME-alike integer literal +SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=0; +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00) and (coalesce(`test`.`t1`.`a`) = 0)) +# DATE literal + TIME cast +SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME('00:00:00'); +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME('00:00:00'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = DATE'2015-09-11') +# DATE literal + TIME literal +SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME'00:00:00'; +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME'00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = DATE'2015-09-11') +# DATE literal + TIME-alike string literal +SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)='00:00:00'; +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)='00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = DATE'2015-09-11') and (coalesce(`test`.`t1`.`a`) = '00:00:00')) +# DATE literal + TIME-alike integer literal +SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=0; +a +00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = DATE'2015-09-11') and (coalesce(`test`.`t1`.`a`) = 0)) +DROP TABLE t1; +SET timestamp=DEFAULT; +# +# MDEV-8814 Wrong result for WHERE datetime_column > TIME('00:00:00') +# +CREATE TABLE t1 (a DATETIME); +INSERT INTO t1 VALUES ('2000-09-12 00:00:00'), ('2007-04-25 05:08:49'); +SELECT * FROM t1 WHERE a>TIME'00:00:00'; +a +SELECT * FROM t1 WHERE a>TIME('00:00:00'); +a +DROP TABLE t1; +# +# MDEV-8660 TIME(int_zerofill_column) returns a wrong result +# +CREATE TABLE t1 (a BIGINT(15), b BIGINT(15) ZEROFILL); +INSERT INTO t1 VALUES (9,9); +SELECT TIME(a),TIME(b) FROM t1; +TIME(a) TIME(b) +00:00:09 00:00:09 +DROP TABLE t1; +CREATE TABLE t1 (a BIGINT); +INSERT INTO t1 VALUES (-9223372036854775808); +SELECT CAST(a AS TIME), CAST(-9223372036854775808 AS TIME) FROM t1; +CAST(a AS TIME) CAST(-9223372036854775808 AS TIME) +-838:59:59 -838:59:59 +Warnings: +Warning 1292 Incorrect time value: '-9223372036854775808' for column 'a' at row 1 +Warning 1292 Truncated incorrect time value: '-9223372036854775808' +DROP TABLE t1; +CREATE TABLE t1 (a INT, b DECIMAL, c DOUBLE); +INSERT INTO t1 VALUES (-9000000,-9000000,-9000000); +INSERT INTO t1 VALUES (-1,-1,-1); +INSERT INTO t1 VALUES (0,0,0),(1,1,1),(9,9,9); +INSERT INTO t1 VALUES (9000000,9000000,9000000); +SELECT a, TIME(a),TIME(b),TIME(c) FROM t1 ORDER BY a; +a TIME(a) TIME(b) TIME(c) +-9000000 -838:59:59 -838:59:59 -838:59:59.999999 +-1 -00:00:01 -00:00:01 -00:00:01.000000 +0 00:00:00 00:00:00 00:00:00.000000 +1 00:00:01 00:00:01 00:00:01.000000 +9 00:00:09 00:00:09 00:00:09.000000 +9000000 838:59:59 838:59:59 838:59:59.999999 +Warnings: +Warning 1292 Incorrect time value: '-9000000' for column 'a' at row 1 +Warning 1292 Incorrect time value: '-9000000' for column 'b' at row 1 +Warning 1292 Incorrect time value: '-9000000' for column 'c' at row 1 +Warning 1292 Incorrect time value: '9000000' for column 'a' at row 6 +Warning 1292 Incorrect time value: '9000000' for column 'b' at row 6 +Warning 1292 Incorrect time value: '9000000' for column 'c' at row 6 +DROP TABLE t1; +CREATE TABLE t1 (a INT, b DECIMAL, c DOUBLE); +INSERT INTO t1 VALUES (0,0,0),(1,1,1),(9,9,9); +INSERT INTO t1 VALUES (9000000,9000000,9000000); +SELECT a, TIME(a),TIME(b),TIME(c) FROM t1 ORDER BY a; +a TIME(a) TIME(b) TIME(c) +0 00:00:00 00:00:00 00:00:00.000000 +1 00:00:01 00:00:01 00:00:01.000000 +9 00:00:09 00:00:09 00:00:09.000000 +9000000 838:59:59 838:59:59 838:59:59.999999 +Warnings: +Warning 1292 Incorrect time value: '9000000' for column 'a' at row 4 +Warning 1292 Incorrect time value: '9000000' for column 'b' at row 4 +Warning 1292 Incorrect time value: '9000000' for column 'c' at row 4 +DROP TABLE t1; +# +# MDEV-8862 Wrong field type for MAX(COALESCE(datetime_column)) +# +CREATE TABLE t1 (a TIME); +INSERT INTO t1 VALUES ('10:10:10'),('10:20:30'); +SELECT MAX(a), MAX(COALESCE(a)) FROM t1; +MAX(a) MAX(COALESCE(a)) +10:20:30 10:20:30 +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/type_time_6065.result b/mysql-test/r/type_time_6065.result index db3efc3bcbb..a61c658d50e 100644 --- a/mysql-test/r/type_time_6065.result +++ b/mysql-test/r/type_time_6065.result @@ -52,7 +52,7 @@ t2 force INDEX (col_datetime_key) WHERE col_time_key = col_datetime_key; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where -1 SIMPLE t2 ref col_datetime_key col_datetime_key 9 test.t1.col_time_key 1 100.00 Using where; Using index +1 SIMPLE t2 ref col_datetime_key col_datetime_key 6 test.t1.col_time_key 1 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`) SELECT * FROM @@ -73,7 +73,7 @@ t2 force INDEX (col_datetime_key) WHERE col_datetime_key = col_time_key; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where -1 SIMPLE t2 ref col_datetime_key col_datetime_key 9 test.t1.col_time_key 1 100.00 Using where; Using index +1 SIMPLE t2 ref col_datetime_key col_datetime_key 6 test.t1.col_time_key 1 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`) SELECT * FROM @@ -136,7 +136,7 @@ t2 force INDEX (col_datetime_key) WHERE col_time_key = col_datetime_key; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using where; Using index -1 SIMPLE t2 ref col_datetime_key col_datetime_key 9 test.t1.col_time_key 1 100.00 Using where; Using index +1 SIMPLE t2 ref col_datetime_key col_datetime_key 6 test.t1.col_time_key 1 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`) SELECT * FROM @@ -157,7 +157,7 @@ t2 force INDEX (col_datetime_key) WHERE col_datetime_key = col_time_key; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using where; Using index -1 SIMPLE t2 ref col_datetime_key col_datetime_key 9 test.t1.col_time_key 1 100.00 Using where; Using index +1 SIMPLE t2 ref col_datetime_key col_datetime_key 6 test.t1.col_time_key 1 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`) SELECT * FROM @@ -261,7 +261,7 @@ STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_time_key = col_datetime_key; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 9 NULL 5 100.00 Using index +1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`) @@ -282,7 +282,7 @@ STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_datetime_key = col_time_key; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 9 NULL 5 100.00 Using index +1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`) @@ -303,7 +303,7 @@ STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_time_key = col_datetime_key; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 9 NULL 5 100.00 Using where; Using index +1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using where; Using index 1 SIMPLE t1 ref col_time_key col_time_key 4 test.t2.col_datetime_key 2 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`) @@ -324,7 +324,7 @@ STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_datetime_key = col_time_key; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 9 NULL 5 100.00 Using where; Using index +1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using where; Using index 1 SIMPLE t1 ref col_time_key col_time_key 4 test.t2.col_datetime_key 2 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`) @@ -717,7 +717,7 @@ STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_time_key >= col_datetime_key; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 9 NULL 5 100.00 Using index +1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`) @@ -748,7 +748,7 @@ STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_datetime_key >= col_time_key; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 9 NULL 5 100.00 Using index +1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`) @@ -779,7 +779,7 @@ STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_time_key >= col_datetime_key; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 9 NULL 5 100.00 Using index +1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`) @@ -810,7 +810,7 @@ STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_datetime_key >= col_time_key; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 9 NULL 5 100.00 Using index +1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`) @@ -1153,7 +1153,7 @@ STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_time_key > col_datetime_key; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 9 NULL 5 100.00 Using index +1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`) @@ -1179,7 +1179,7 @@ STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_datetime_key > col_time_key; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 9 NULL 5 100.00 Using index +1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`) @@ -1205,7 +1205,7 @@ STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_time_key > col_datetime_key; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 9 NULL 5 100.00 Using index +1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`) @@ -1231,7 +1231,7 @@ STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_datetime_key > col_time_key; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 9 NULL 5 100.00 Using index +1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`) @@ -1629,7 +1629,7 @@ STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_time_key <= col_datetime_key; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 9 NULL 5 100.00 Using index +1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`) @@ -1660,7 +1660,7 @@ STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_datetime_key <= col_time_key; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 9 NULL 5 100.00 Using index +1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`) @@ -1691,7 +1691,7 @@ STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_time_key <= col_datetime_key; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 9 NULL 5 100.00 Using index +1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`) @@ -1722,7 +1722,7 @@ STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_datetime_key <= col_time_key; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 9 NULL 5 100.00 Using index +1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`) @@ -2065,7 +2065,7 @@ STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_time_key < col_datetime_key; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 9 NULL 5 100.00 Using index +1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`) @@ -2091,7 +2091,7 @@ STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_datetime_key < col_time_key; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 9 NULL 5 100.00 Using index +1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`) @@ -2117,7 +2117,7 @@ STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_time_key < col_datetime_key; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 9 NULL 5 100.00 Using index +1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`) @@ -2143,7 +2143,7 @@ STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_datetime_key < col_time_key; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 9 NULL 5 100.00 Using index +1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index 1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`) diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result index 28ec7e75870..69c9f68811d 100644 --- a/mysql-test/r/type_timestamp.result +++ b/mysql-test/r/type_timestamp.result @@ -1,6 +1,6 @@ drop table if exists t1,t2; set time_zone="+03:00"; -CREATE TABLE t1 (a int, t timestamp); +CREATE TABLE t1 (a int, t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); CREATE TABLE t2 (a int, t datetime); SET TIMESTAMP=1234; insert into t1 values(1,NULL); @@ -27,7 +27,7 @@ a t 9 1970-01-01 03:20:38 drop table t1,t2; SET TIMESTAMP=1234; -CREATE TABLE t1 (value TEXT NOT NULL, id VARCHAR(32) NOT NULL, stamp timestamp, PRIMARY KEY (id)); +CREATE TABLE t1 (value TEXT NOT NULL, id VARCHAR(32) NOT NULL, stamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (id)); INSERT INTO t1 VALUES ("my value", "myKey","1999-04-02 00:00:00"); SELECT stamp FROM t1 WHERE id="myKey"; stamp @@ -41,13 +41,13 @@ SELECT stamp FROM t1 WHERE id="myKey"; stamp 1999-04-02 00:00:00 drop table t1; -create table t1 (a timestamp); +create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values (now()); select date_format(a,"%Y %y"),year(a),year(now()) from t1; date_format(a,"%Y %y") year(a) year(now()) 1970 70 1970 1970 drop table t1; -create table t1 (ix timestamp); +create table t1 (ix timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000); select ix+0 from t1; ix+0 @@ -69,7 +69,7 @@ ix+0 19990630232922 19990601000000 drop table t1; -CREATE TABLE t1 (date date, date_time datetime, time_stamp timestamp); +CREATE TABLE t1 (date date, date_time datetime, time_stamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); INSERT INTO t1 VALUES ("1998-12-31","1998-12-31 23:59:59",19981231235959); INSERT INTO t1 VALUES ("1999-01-01","1999-01-01 00:00:00",19990101000000); INSERT INTO t1 VALUES ("1999-09-09","1999-09-09 23:59:59",19990909235959); @@ -97,7 +97,7 @@ date date_time time_stamp 2005-01-01 2005-01-01 00:00:00 2005-01-01 00:00:00 2030-01-01 2030-01-01 00:00:00 2030-01-01 00:00:00 drop table t1; -create table t1 (ix timestamp); +create table t1 (ix timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values (0),(20030101010160),(20030101016001),(20030101240101),(20030132010101),(20031301010101),(20031200000000),(20030000000000); Warnings: Warning 1265 Data truncated for column 'ix' at row 2 @@ -157,7 +157,7 @@ create table t1 (t1 timestamp default now(), t2 timestamp on update now()); drop table t1; create table t1 (t1 timestamp on update now(), t2 timestamp default now() on update now()); drop table t1; -create table t1 (t1 timestamp default '2003-01-01 00:00:00', t2 datetime, t3 timestamp); +create table t1 (t1 timestamp not null default '2003-01-01 00:00:00', t2 datetime, t3 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'); SET TIMESTAMP=1000000000; insert into t1 values (); SET TIMESTAMP=1000000001; @@ -181,7 +181,7 @@ t1 timestamp NO 2003-01-01 00:00:00 t2 datetime YES NULL t3 timestamp NO 0000-00-00 00:00:00 drop table t1; -create table t1 (t1 timestamp default now(), t2 datetime, t3 timestamp); +create table t1 (t1 timestamp not null default now(), t2 datetime, t3 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'); SET TIMESTAMP=1000000002; insert into t1 values (); SET TIMESTAMP=1000000003; @@ -205,7 +205,7 @@ t1 timestamp NO CURRENT_TIMESTAMP t2 datetime YES NULL t3 timestamp NO 0000-00-00 00:00:00 drop table t1; -create table t1 (t1 timestamp default '2003-01-01 00:00:00' on update now(), t2 datetime); +create table t1 (t1 timestamp not null default '2003-01-01 00:00:00' on update now(), t2 datetime); SET TIMESTAMP=1000000004; insert into t1 values (); select * from t1; @@ -230,7 +230,7 @@ Field Type Null Key Default Extra t1 timestamp NO 2003-01-01 00:00:00 on update CURRENT_TIMESTAMP t2 datetime YES NULL drop table t1; -create table t1 (t1 timestamp default now() on update now(), t2 datetime); +create table t1 (t1 timestamp not null default now() on update now(), t2 datetime); SET TIMESTAMP=1000000006; insert into t1 values (); select * from t1; @@ -255,7 +255,7 @@ Field Type Null Key Default Extra t1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP t2 datetime YES NULL drop table t1; -create table t1 (t1 timestamp, t2 datetime, t3 timestamp); +create table t1 (t1 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, t2 datetime, t3 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'); SET TIMESTAMP=1000000007; insert into t1 values (); select * from t1; @@ -282,7 +282,7 @@ t1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP t2 datetime YES NULL t3 timestamp NO 0000-00-00 00:00:00 drop table t1; -create table t1 (t1 timestamp default current_timestamp on update current_timestamp, t2 datetime); +create table t1 (t1 timestamp not null default current_timestamp on update current_timestamp, t2 datetime); SET TIMESTAMP=1000000009; insert into t1 values (); select * from t1; @@ -318,7 +318,7 @@ select * from t1; t1 t2 2004-04-03 00:00:00 2004-04-01 00:00:00 drop table t1; -create table t1 (pk int primary key, t1 timestamp default current_timestamp on update current_timestamp, bulk int); +create table t1 (pk int primary key, t1 timestamp not null default current_timestamp on update current_timestamp, bulk int); insert into t1 values (1, '2004-04-01 00:00:00', 10); SET TIMESTAMP=1000000013; replace into t1 set pk = 1, bulk= 20; @@ -326,7 +326,7 @@ select * from t1; pk t1 bulk 1 2001-09-09 04:46:53 20 drop table t1; -create table t1 (pk int primary key, t1 timestamp default '2003-01-01 00:00:00' on update current_timestamp, bulk int); +create table t1 (pk int primary key, t1 timestamp not null default '2003-01-01 00:00:00' on update current_timestamp, bulk int); insert into t1 values (1, '2004-04-01 00:00:00', 10); SET TIMESTAMP=1000000014; replace into t1 set pk = 1, bulk= 20; @@ -334,7 +334,7 @@ select * from t1; pk t1 bulk 1 2003-01-01 00:00:00 20 drop table t1; -create table t1 (pk int primary key, t1 timestamp default current_timestamp, bulk int); +create table t1 (pk int primary key, t1 timestamp not null default current_timestamp on update current_timestamp, bulk int); insert into t1 values (1, '2004-04-01 00:00:00', 10); SET TIMESTAMP=1000000015; replace into t1 set pk = 1, bulk= 20; @@ -342,7 +342,7 @@ select * from t1; pk t1 bulk 1 2001-09-09 04:46:55 20 drop table t1; -create table t1 (t1 timestamp default current_timestamp on update current_timestamp); +create table t1 (t1 timestamp not null default current_timestamp on update current_timestamp); insert into t1 values ('2004-04-01 00:00:00'); SET TIMESTAMP=1000000016; alter table t1 add i int default 10; @@ -397,13 +397,13 @@ drop table t1; create table t1 (a bigint, b bigint); insert into t1 values (NULL, NULL), (20030101000000, 20030102000000); set timestamp=1000000019; -alter table t1 modify a timestamp, modify b timestamp; +alter table t1 modify a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modify b timestamp NOT NULL DEFAULT '0000-00-00 00:00:0'; select * from t1; a b 2001-09-09 04:46:59 2001-09-09 04:46:59 2003-01-01 00:00:00 2003-01-02 00:00:00 drop table t1; -create table t1 (a char(2), t timestamp); +create table t1 (a char(2), t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 values ('a', '2004-01-01 00:00:00'), ('a', '2004-01-01 01:00:00'), ('b', '2004-02-01 00:00:00'); select max(t) from t1 group by a; @@ -421,7 +421,7 @@ t1 CREATE TABLE "t1" ( ) set sql_mode=''; drop table t1; -create table t1 (a int auto_increment primary key, b int, c timestamp); +create table t1 (a int auto_increment primary key, b int, c timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 (a, b, c) values (1, 0, '2001-01-01 01:01:01'), (2, 0, '2002-02-02 02:02:02'), (3, 0, '2003-03-03 03:03:03'); select * from t1; @@ -486,8 +486,8 @@ is_nullable NO drop table t1; CREATE TABLE t1 ( f1 INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, -f2 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, -f3 TIMESTAMP); +f2 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +f3 TIMESTAMP NOT NULL default '0000-00-00 00:00:00'); INSERT INTO t1 (f2,f3) VALUES (NOW(), "0000-00-00 00:00:00"); INSERT INTO t1 (f2,f3) VALUES (NOW(), NULL); INSERT INTO t1 (f2,f3) VALUES (NOW(), ASCII(NULL)); @@ -507,7 +507,7 @@ End of 5.0 tests # Bug #55779: select does not work properly in mysql server # Version "5.1.42 SUSE MySQL RPM" # -CREATE TABLE t1 (a TIMESTAMP, KEY (a)); +CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, KEY (a)); INSERT INTO t1 VALUES ('2000-01-01 00:00:00'), ('2000-01-01 00:00:00'), ('2000-01-01 00:00:01'), ('2000-01-01 00:00:01'); SELECT a FROM t1 WHERE a >= 20000101000000; @@ -604,7 +604,7 @@ Warning 1292 Incorrect datetime value: 'abc' Bug#50888 valgrind warnings in Field_timestamp::val_str SET TIMESTAMP=0; -CREATE TABLE t1(a timestamp); +CREATE TABLE t1(a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); INSERT INTO t1 VALUES ('2008-02-23 09:23:45'), ('2010-03-05 11:08:02'); FLUSH TABLES t1; SELECT MAX(a) FROM t1; @@ -741,3 +741,212 @@ t2 CREATE TABLE `t2` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1,t2; End of 10.0 tests +# +# Start of 10.1 tests +# +# +# MDEV-7831 Bad warning for DATE_ADD(timestamp_column, INTERVAL 10 SECOND) +# +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES ('0000-00-00 00:00:00'); +SELECT DATE_ADD(a, INTERVAL 10 SECOND) FROM t1; +DATE_ADD(a, INTERVAL 10 SECOND) +NULL +Warnings: +Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' +DROP TABLE t1; +# +# MDEV-7824 [Bug #68041] Zero date can be inserted in strict no-zero mode through a default value +# +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a TIMESTAMP DEFAULT '0000-00-00 00:00:00'); +SET sql_mode=TRADITIONAL; +INSERT INTO t1 VALUES ('0000-00-00 00:00:00'); +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'a' at row 1 +INSERT INTO t1 VALUES (); +ERROR 22007: Incorrect default value '0000-00-00 00:00:00' for column 'a' +INSERT INTO t1 VALUES (DEFAULT); +ERROR 22007: Incorrect default value '0000-00-00 00:00:00' for column 'a' +DROP TABLE t1; +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', b TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'); +CREATE TABLE t2 (a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'); +INSERT INTO t2 VALUES ('0000-00-00 00:00:00'); +SET sql_mode=TRADITIONAL; +INSERT INTO t1 (a) SELECT a FROM t2; +ERROR 22007: Incorrect default value '0000-00-00 00:00:00' for column 'b' +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a TIMESTAMP DEFAULT '0000-00-00 00:00:00', b TIMESTAMP DEFAULT '0000-00-00 00:00:00'); +INSERT INTO t1 VALUES (DEFAULT,DEFAULT);; +SELECT a INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/mdev-7824.txt' FROM t1; +DELETE FROM t1; +SET sql_mode=TRADITIONAL; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/mdev-7824.txt' INTO TABLE t1 (a); +ERROR 22007: Incorrect default value '0000-00-00 00:00:00' for column 'b' +DROP TABLE t1; +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a TIMESTAMP DEFAULT '0000-00-00 00:00:00');; +SET sql_mode='NO_ZERO_DATE'; +ALTER TABLE t1 ADD b INT NOT NULL; +ERROR 42000: Invalid default value for 'a' +DROP TABLE t1; +SET sql_mode=DEFAULT; +# +# End of MDEV-7824 [Bug #68041] Zero date can be inserted in strict no-zero mode through a default value +# +# +# MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field +# +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a TIMESTAMP);; +INSERT INTO t1 VALUES (0); +SET sql_mode='TRADITIONAL'; +CREATE TABLE t2 AS SELECT * FROM t1; +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'a' at row 1 +DROP TABLE t1; +# +# End of MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field +# +# +# MDEV-8699 Wrong result for SELECT..WHERE HEX(date_column)!='323030312D30312D3031' AND date_column='2001-01-01x' +# +CREATE TABLE t1 (a TIMESTAMP);; +INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01'); +SELECT * FROM t1 WHERE a='2001-01-01 00:00:00x'; +a +2001-01-01 00:00:00 +Warnings: +Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' +SELECT * FROM t1 WHERE LENGTH(a) != 20; +a +2001-01-01 00:00:00 +2001-01-01 00:00:01 +SELECT * FROM t1 WHERE LENGTH(a) != 20 AND a='2001-01-01 00:00:00x'; +a +2001-01-01 00:00:00 +Warnings: +Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a) != 20 AND a='2001-01-01 00:00:00x'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)!=30+RAND() AND a='2001-01-01 00:00:00x'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00')) <> (30 + rand()))) +DROP TABLE t1; +CREATE TABLE t1 (a TIMESTAMP);; +INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01'); +SELECT * FROM t1 WHERE LENGTH(a)=19; +a +2001-01-01 00:00:00 +2001-01-01 00:00:01 +SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=' 2001-01-01 00:00:00'; +a +2001-01-01 00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=' 2001-01-01 00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=19+RAND() AND a=' 2001-01-01 00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00')) = (19 + rand()))) +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' garbage '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Warning 1292 Incorrect datetime value: ' garbage ' +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'0000-00-00 00:00:00') and (<cache>(length(TIMESTAMP'0000-00-00 00:00:00')) = (30 + rand()))) +DROP TABLE t1; +CREATE TABLE t1 (a TIMESTAMP);; +INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01'); +SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 00:00:00.000000'; +a +2001-01-01 00:00:00 +SELECT * FROM t1 WHERE LENGTH(a)=19; +a +2001-01-01 00:00:00 +2001-01-01 00:00:01 +SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; +a +2001-01-01 00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00')) = (30 + rand()))) +DROP TABLE t1; +CREATE TABLE t1 (a TIMESTAMP(6));; +INSERT INTO t1 VALUES ('2001-01-01 00:00:00.000000'),('2001-01-01 00:00:01.000000'); +SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 00:00:00.000000'; +a +2001-01-01 00:00:00.000000 +SELECT * FROM t1 WHERE LENGTH(a)=26; +a +2001-01-01 00:00:00.000000 +2001-01-01 00:00:01.000000 +SELECT * FROM t1 WHERE LENGTH(a)=26 AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; +a +2001-01-01 00:00:00.000000 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=26 AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=40+RAND() AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00.000000')) = (40 + rand()))) +DROP TABLE t1; +SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30'); +CREATE TABLE t1 (a TIMESTAMP);; +INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01'); +SELECT * FROM t1 WHERE a=TIME'00:00:00'; +a +2001-01-01 00:00:00 +SELECT * FROM t1 WHERE LENGTH(a)=19; +a +2001-01-01 00:00:00 +2001-01-01 00:00:01 +SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIME'00:00:00'; +a +2001-01-01 00:00:00 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIME'00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE LENGTH(a)=40+RAND() AND a=TIME'00:00:00'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and (<cache>(length(TIMESTAMP'2001-01-01 00:00:00')) = (40 + rand()))) +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/type_timestamp_hires.result b/mysql-test/r/type_timestamp_hires.result index 6ebf83a09f0..573ebbeb709 100644 --- a/mysql-test/r/type_timestamp_hires.result +++ b/mysql-test/r/type_timestamp_hires.result @@ -50,7 +50,7 @@ a 2010-12-11 03:04:05.789 2010-12-11 15:47:11.123 drop table t1; -create table t1 (a timestamp(4)) engine=innodb; +create table t1 (a timestamp(4)NOT NULL DEFAULT CURRENT_TIMESTAMP(4) ON UPDATE CURRENT_TIMESTAMP(4)) engine=innodb; insert t1 values ('2010-12-11 01:02:03.456789'); select * from t1; a @@ -131,9 +131,9 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP(4) ON UPDATE CURRENT_TIMESTAMP(4), - `a+0` decimal(25,4) NOT NULL DEFAULT '0.0000', - `a-1` decimal(25,4) NOT NULL DEFAULT '0.0000', - `a*1` decimal(25,4) NOT NULL DEFAULT '0.0000', + `a+0` decimal(25,4) NOT NULL, + `a-1` decimal(25,4) NOT NULL, + `a*1` decimal(25,4) NOT NULL, `a/2` decimal(28,8) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show create table t3; @@ -216,7 +216,7 @@ decimal5_f4_timestamp 2010-11-12 11:14:17.7654 bigint_f5_timestamp 2010-11-12 11:14:17.00000 varchar_f6_timestamp 2010-11-12 11:14:17.765432 drop table t1, t2; -create table t1 (a timestamp(6), b timestamp(6)); +create table t1 (a timestamp(6)NOT NULL DEFAULT '0000-00-00 00:00:00.000000', b timestamp(6)NOT NULL DEFAULT '0000-00-00 00:00:00.000000'); create procedure foo(x timestamp, y timestamp(4)) insert into t1 values (x, y); call foo('2010-02-03 4:5:6.789123', '2010-02-03 4:5:6.789123'); select * from t1; @@ -266,7 +266,7 @@ drop table t1, t2; SET timestamp=DEFAULT; set time_zone='+03:00'; set timestamp=unix_timestamp('2011-01-01 01:01:01') + 0.123456; -create table t1 (a timestamp(5)); +create table t1 (a timestamp(5) DEFAULT CURRENT_TIMESTAMP); insert t1 values (); select * from t1; a diff --git a/mysql-test/r/type_varchar.result b/mysql-test/r/type_varchar.result index 965d113124b..e15b029e9c6 100644 --- a/mysql-test/r/type_varchar.result +++ b/mysql-test/r/type_varchar.result @@ -499,6 +499,7 @@ SELECT 5 = a FROM t1; 0 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 's' +Warning 1292 Truncated incorrect DOUBLE value: '' DROP TABLE t1; CREATE TABLE t1 (a CHAR(16)); INSERT INTO t1 VALUES ('5'), ('s'), (''); @@ -509,6 +510,7 @@ SELECT 5 = a FROM t1; 0 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 's ' +Warning 1292 Truncated incorrect DOUBLE value: ' ' DROP TABLE t1; # # Start of 10.0 tests @@ -549,5 +551,65 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 index PRIMARY PRIMARY 22 NULL 2 Using where; Using index DROP TABLE IF EXISTS t1,t2; # +# MDEV-6989 BINARY and COLLATE xxx_bin comparisions are not used for optimization in some cases +# +CREATE TABLE t1 (c1 VARCHAR(20) CHARACTER SET latin1, PRIMARY KEY(c1)); +INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'); +SELECT * FROM t1 WHERE c1=BINARY 'a'; +c1 +a +EXPLAIN SELECT * FROM t1 WHERE c1=BINARY 'a'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const PRIMARY PRIMARY 22 const 1 Using index +SELECT * FROM t1 WHERE c1=_latin1'a' COLLATE latin1_bin; +c1 +a +EXPLAIN SELECT * FROM t1 WHERE c1=_latin1'a' COLLATE latin1_bin; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const PRIMARY PRIMARY 22 const 1 Using index +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 VARCHAR(10) CHARACTER SET latin1, PRIMARY KEY(c1)); +INSERT INTO t2 VALUES ('a'),('b'); +SELECT * FROM t1, t2 WHERE t1.c1=t2.c1; +c1 c1 +a a +EXPLAIN SELECT * FROM t1, t2 WHERE t1.c1=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 const PRIMARY PRIMARY 12 const 1 Using index +ALTER TABLE t1 MODIFY c1 VARBINARY(10); +SELECT * FROM t1, t2 WHERE t1.c1=t2.c1; +c1 c1 +a a +EXPLAIN SELECT * FROM t1, t2 WHERE t1.c1=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 const PRIMARY PRIMARY 12 const 1 Using index +DROP TABLE t1, t2; +CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t1 VALUES ('a'),('c'); +CREATE TABLE t2 (c1 VARCHAR(10) CHARACTER SET latin1, PRIMARY KEY(c1)); +INSERT INTO t2 VALUES ('a'),('b'); +SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1); +c1 +a +c +# t2 should be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +ALTER TABLE t1 MODIFY c1 VARBINARY(10); +SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1); +c1 +a +c +# t2 should be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +DROP TABLE t1,t2; +# # End of 10.0 tests # diff --git a/mysql-test/r/type_year.result b/mysql-test/r/type_year.result index 38bddd42cfa..842a16e3b4a 100644 --- a/mysql-test/r/type_year.result +++ b/mysql-test/r/type_year.result @@ -394,3 +394,47 @@ select a from t1 where a=b; a drop table t1; drop function y2k; +# +# Start of 10.1 tests +# +# +# MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010 +# +CREATE TABLE t1 (a YEAR); +INSERT INTO t1 VALUES (2010),(2020); +SELECT * FROM t1 WHERE a=2010 AND a>=2010; +a +2010 +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND a>=2010; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010) +SELECT * FROM t1 WHERE a=2010 AND a>=10; +a +2010 +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND a>=10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010) +SELECT * FROM t1 WHERE a=10 AND a>=2010; +a +2010 +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND a>=2010; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010) +SELECT * FROM t1 WHERE a=10 AND a>=10; +a +2010 +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND a>=10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = 2010) +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 40f5a77e3d0..dd7c8fcc8ee 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -89,6 +89,10 @@ id select_type table type possible_keys key key_len ref rows filtered Extra NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort Warnings: Note 1003 (select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` limit 2) union all (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` order by `test`.`t2`.`a` limit 1) order by `b` desc +select count(*) from ( +(select a,b from t1 limit 2) union all (select a,b from t2 order by a)) q; +count(*) +6 (select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2; a b 1 a @@ -96,6 +100,10 @@ a b select found_rows(); found_rows() 6 +select count(*) from ( +select a,b from t1 union all select a,b from t2) q; +count(*) +8 select sql_calc_found_rows a,b from t1 union all select a,b from t2 limit 2; a b 1 a @@ -107,7 +115,6 @@ explain select a,b from t1 union all select a,b from t2; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 4 2 UNION t2 ALL NULL NULL NULL NULL 4 -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL explain select xx from t1 union select 1; ERROR 42S22: Unknown column 'xx' in 'field list' explain select a,b from t1 union select 1; @@ -309,12 +316,20 @@ create table t1 (a int); insert into t1 values (1),(2),(3); create table t2 (a int); insert into t2 values (3),(4),(5); +SELECT COUNT(*) FROM ( +(SELECT * FROM t1) UNION all (SELECT * FROM t2)) q; +COUNT(*) +6 (SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2) LIMIT 1; a 1 select found_rows(); found_rows() 6 +SELECT COUNT(*) FROM ( +(SELECT * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2)) q; +COUNT(*) +4 (SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2) LIMIT 2; a 1 @@ -322,6 +337,10 @@ a select found_rows(); found_rows() 4 +SELECT COUNT(*) FROM ( +(SELECT * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2)) q; +COUNT(*) +4 (SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2); a 1 @@ -331,6 +350,10 @@ a select found_rows(); found_rows() 4 +SELECT COUNT(*) FROM ( +(SELECT * FROM t1) UNION all (SELECT * FROM t2 LIMIT 1)) q; +COUNT(*) +4 (SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2 LIMIT 1); a 1 @@ -341,14 +364,23 @@ select found_rows(); found_rows() 4 (SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 -SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION all SELECT * FROM t2 LIMIT 2; a 1 -3 select found_rows(); found_rows() -6 +4 +SELECT COUNT(*) FROM ( +(SELECT * FROM t1 LIMIT 1) UNION SELECT * FROM t2) q; +COUNT(*) +4 +(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 1; +a +1 +select found_rows(); +found_rows() +4 +SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION all SELECT * FROM t2 LIMIT 2; +ERROR HY000: Incorrect usage of UNION and LIMIT SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION all SELECT * FROM t2 LIMIT 2; a 1 @@ -356,12 +388,28 @@ a select found_rows(); found_rows() 6 +SELECT COUNT(*) FROM ( +SELECT * FROM t1 UNION SELECT * FROM t2) q; +COUNT(*) +5 SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2; a 1 2 +SELECT COUNT(*) FROM ( +(SELECT * FROM t1 LIMIT 1) UNION all SELECT * FROM t2) q; +COUNT(*) +4 +(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all SELECT * FROM t2 LIMIT 2; +a +1 +3 select found_rows(); found_rows() +4 +SELECT COUNT(*) FROM ( +SELECT * FROM t1 UNION all SELECT * FROM t2) q; +COUNT(*) 6 SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 100; a @@ -374,31 +422,40 @@ select found_rows(); found_rows() 5 SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 100 UNION SELECT * FROM t2; +ERROR HY000: Incorrect usage of UNION and LIMIT +SELECT COUNT(*) FROM ( +(SELECT * FROM t1 LIMIT 100) UNION SELECT * FROM t2) q; +COUNT(*) +5 +(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 100) UNION SELECT * FROM t2; a 1 2 3 4 5 -select found_rows(); -found_rows() -5 SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION SELECT * FROM t2; +ERROR HY000: Incorrect usage of UNION and LIMIT +SELECT COUNT(*) FROM ( +(SELECT * FROM t1 LIMIT 1) UNION SELECT * FROM t2) q; +COUNT(*) +4 +(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2; a 1 3 4 5 -select found_rows(); -found_rows() -6 SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION SELECT * FROM t2 LIMIT 2; +ERROR HY000: Incorrect usage of UNION and LIMIT +SELECT COUNT(*) FROM ( +(SELECT * FROM t1 LIMIT 1) UNION SELECT * FROM t2) q; +COUNT(*) +4 +(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 2; a 1 3 -select found_rows(); -found_rows() -6 SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2,2; a 3 @@ -406,14 +463,21 @@ a select found_rows(); found_rows() 5 +SELECT COUNT(*) FROM ( +SELECT * FROM t1 UNION SELECT * FROM t2) q; +COUNT(*) +5 SELECT SQL_CALC_FOUND_ROWS * FROM t1 limit 2,2 UNION SELECT * FROM t2; +ERROR HY000: Incorrect usage of UNION and LIMIT +SELECT COUNT(*) FROM ( +(SELECT * FROM t1 limit 2,2) UNION SELECT * FROM t2) q; +COUNT(*) +3 +(SELECT SQL_CALC_FOUND_ROWS * FROM t1 limit 2,2) UNION SELECT * FROM t2; a 3 4 5 -select found_rows(); -found_rows() -5 SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1; a 5 @@ -430,7 +494,7 @@ drop temporary table t1; create table t1 select a from t1 union select a from t2; ERROR 42S01: Table 't1' already exists select a from t1 union select a from t2 order by t2.a; -ERROR 42S22: Unknown column 't2.a' in 'order clause' +ERROR 42000: Table 't2' from one of the SELECTs cannot be used in field list drop table t1,t2; select length(version()) > 1 as `*` UNION select 2; * @@ -1202,32 +1266,32 @@ foo bar drop table t1; CREATE TABLE t1 ( -a ENUM('ä','ö','ü') character set utf8 not null default 'ü', +a ENUM('ä','ö','ü') character set utf8 not null default 'ü', b ENUM("one", "two") character set utf8, c ENUM("one", "two") ); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('ä','ö','ü') CHARACTER SET utf8 NOT NULL DEFAULT 'ü', + `a` enum('ä','ö','ü') CHARACTER SET utf8 NOT NULL DEFAULT 'ü', `b` enum('one','two') CHARACTER SET utf8 DEFAULT NULL, `c` enum('one','two') DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -insert into t1 values ('ä', 'one', 'one'), ('ö', 'two', 'one'), ('ü', NULL, NULL); +insert into t1 values ('ä', 'one', 'one'), ('ö', 'two', 'one'), ('ü', NULL, NULL); create table t2 select NULL union select a from t1; show columns from t2; Field Type Null Key Default Extra -NULL enum('ä','ö','ü') YES NULL +NULL enum('ä','ö','ü') YES NULL drop table t2; create table t2 select a from t1 union select NULL; show columns from t2; Field Type Null Key Default Extra -a enum('ä','ö','ü') YES NULL +a enum('ä','ö','ü') YES NULL drop table t2; create table t2 select a from t1 union select a from t1; show columns from t2; Field Type Null Key Default Extra -a varchar(1) NO +a varchar(2) NO drop table t2; create table t2 select a from t1 union select c from t1; drop table t2; @@ -1309,7 +1373,7 @@ t3 CREATE TABLE `t3` ( drop tables t1,t2,t3; SELECT @tmp_max:= @@global.max_allowed_packet; @tmp_max:= @@global.max_allowed_packet -1048576 +4194304 SET @@global.max_allowed_packet=25000000; Warnings: Warning 1292 Truncated incorrect max_allowed_packet value: '25000000' @@ -1370,7 +1434,7 @@ id 5 99 drop table t1; -create table t1(f1 char(1), f2 char(5), f3 binary(1), f4 binary(5), f5 timestamp, f6 varchar(1) character set utf8 collate utf8_general_ci, f7 text); +create table t1(f1 char(1), f2 char(5), f3 binary(1), f4 binary(5), f5 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', f6 varchar(1) character set utf8 collate utf8_general_ci, f7 text); create table t2 as select *, f6 as f8 from t1 union select *, f7 from t1; show create table t2; Table Create Table @@ -1616,11 +1680,18 @@ a EXPLAIN EXTENDED SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE); -ERROR 42000: Incorrect usage/placement of 'MATCH()' +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 +2 UNION t1 ALL NULL NULL NULL NULL 2 100.00 +NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by (match `a` against ('+abc' in boolean mode)) # Should not crash SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE); -ERROR 42000: Incorrect usage/placement of 'MATCH()' +a +1 +2 # Should not crash (SELECT * FROM t1) UNION (SELECT * FROM t1) ORDER BY MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE); @@ -1638,7 +1709,7 @@ NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort 3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'a' of SELECT #3 was resolved in SELECT #-1 -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by (select `a` from `test`.`t2` where (`test`.`t2`.`b` = 12)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by <expr_cache><`a`>((select `a` from `test`.`t2` where (`test`.`t2`.`b` = 12))) # Should not crash SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY (SELECT a FROM t2 WHERE b = 12); @@ -1955,3 +2026,104 @@ cccc bbbb dddd drop table t1; +# +# WL#1763 Avoid creating temporary table in UNION ALL +# +EXPLAIN SELECT 1 UNION ALL SELECT 1 LIMIT 1 OFFSET 1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +# Bug #17579498 CHANGES IN DATATYPE OF THE RESULT QUERY IN UNION. +CREATE TABLE t1 (a TIME); +CREATE TABLE t2 (b DATETIME); +CREATE TABLE t3 +SELECT a FROM t1 UNION ALL SELECT b FROM t2; +SELECT column_name, column_type +FROM information_schema.columns +WHERE TABLE_NAME='t3'; +column_name column_type +a datetime +DROP TABLE t1, t2, t3; +# Bug #17602922 RESULT DIFFERENCES IN UNION QUERIES WITH IN +# (SUBQUERY-UNION ALL) +CREATE TABLE t1 (a VARCHAR(1)); +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES ('j'); +INSERT INTO t1 VALUES ('k'); +INSERT INTO t1 VALUES ('r'); +INSERT INTO t1 VALUES ('r'); +INSERT INTO t1 VALUES ('h'); +SELECT a FROM t1 WHERE a IN (SELECT 'r' FROM t1 UNION ALL SELECT 'j'); +a +j +r +r +CREATE TABLE t2 +SELECT a FROM t1 WHERE a IN (SELECT 'r' FROM t1 UNION ALL SELECT 'j'); +SELECT * FROM t2; +a +j +r +r +DROP TABLE t1, t2; +CREATE TABLE t1 (a INT PRIMARY KEY); +CREATE TABLE t2 (a INT PRIMARY KEY); +INSERT INTO t2 VALUES (1); +SELECT a, SUM(a) FROM t2 UNION ALL SELECT a, MIN(a) FROM t1 ; +a SUM(a) +1 1 +NULL NULL +SELECT FOUND_ROWS(); +FOUND_ROWS() +2 +DROP TABLE t1, t2; +# Bug #17669551 CRASH/ASSERT AT SELECT_CREATE::PREPARE2 AT +# SQL_INSERT.CC +CREATE TABLE t1 (a INT); +CREATE TABLE t2 SELECT a, a FROM t1 UNION ALL SELECT a, a FROM t1; +ERROR 42S21: Duplicate column name 'a' +DROP TABLE t1; +# Bug #17694956 RESULT DIFFERENCES IN UNION ALL QUERIES WITH LIMIT +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1); +(SELECT a FROM t1 ORDER BY a LIMIT 0) UNION ALL SELECT a FROM t1; +a +1 +DROP TABLE t1; +# Bug #17708480 FOUND_ROWS() VALUE DO NOT MATCH WITH UNION ALL QUERIES +CREATE TABLE t1 (a INT) ENGINE=MEMORY; +CREATE TABLE t2 (a INT) ENGINE=MEMORY; +INSERT INTO t2 VALUES (1); +SELECT COUNT(*) FROM ( +SELECT * FROM t2 UNION ALL SELECT * FROM t1) q; +COUNT(*) +1 +SELECT SQL_CALC_FOUND_ROWS * FROM t2 UNION ALL SELECT * FROM t1; +a +1 +SELECT FOUND_ROWS(); +FOUND_ROWS() +1 +SELECT COUNT(*) FROM ( +SELECT * FROM t1 UNION ALL SELECT * FROM t2) q; +COUNT(*) +1 +SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION ALL SELECT * FROM t2; +a +1 +SELECT FOUND_ROWS(); +FOUND_ROWS() +1 +DROP TABLE t1, t2; +# End of WL1763 tests +# +# Bug mdev-6874: crash with UNION ALL in a subquery +# +CREATE TABLE t1 (a int, b int); +INSERT INTO t1 VALUES (1,1), (2,8); +SELECT * FROM t1 t1_1 LEFT JOIN t1 t1_2 ON ( t1_2.b = t1_1.a ) +WHERE t1_2.b NOT IN ( SELECT 4 UNION ALL SELECT 5 ); +a b a b +1 1 1 1 +DROP TABLE t1; diff --git a/mysql-test/r/upgrade.result b/mysql-test/r/upgrade.result index b6e924c71cc..74b888e49c5 100644 --- a/mysql-test/r/upgrade.result +++ b/mysql-test/r/upgrade.result @@ -67,7 +67,7 @@ drop table `txu@0023p@0023p1`; # check the table created using mysql 4.0 CHECK TABLE t1; Table Op Msg_type Msg_text -test.t1 check error Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it! +test.t1 check error Upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it! # query the table created using mysql 4.0 SELECT * FROM t1; c1 c2 c3 diff --git a/mysql-test/r/user_limits.result b/mysql-test/r/user_limits.result index 688704f528a..5ab98d1fc30 100644 --- a/mysql-test/r/user_limits.result +++ b/mysql-test/r/user_limits.result @@ -6,6 +6,7 @@ delete from mysql.db where user like 'mysqltest\_%'; delete from mysql.tables_priv where user like 'mysqltest\_%'; delete from mysql.columns_priv where user like 'mysqltest\_%'; flush privileges; +create user mysqltest_1@localhost; grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 2; flush user_resources; select * from t1; @@ -17,6 +18,7 @@ ERROR 42000: User 'mysqltest_1' has exceeded the 'max_queries_per_hour' resource select * from t1; ERROR 42000: User 'mysqltest_1' has exceeded the 'max_queries_per_hour' resource (current value: 2) drop user mysqltest_1@localhost; +create user mysqltest_1@localhost; grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 2; flush user_resources; select * from t1; @@ -36,6 +38,7 @@ ERROR 42000: User 'mysqltest_1' has exceeded the 'max_updates_per_hour' resource select * from t1; i drop user mysqltest_1@localhost; +create user mysqltest_1@localhost; grant usage on *.* to mysqltest_1@localhost with max_connections_per_hour 2; flush user_resources; select * from t1; @@ -50,6 +53,7 @@ connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK); ERROR 42000: User 'mysqltest_1' has exceeded the 'max_connections_per_hour' resource (current value: 2) drop user mysqltest_1@localhost; flush privileges; +create user mysqltest_1@localhost; grant usage on *.* to mysqltest_1@localhost with max_user_connections 2; flush user_resources; select * from t1; @@ -86,6 +90,7 @@ set global max_user_connections= 2; select @@session.max_user_connections, @@global.max_user_connections; @@session.max_user_connections @@global.max_user_connections 2 2 +create user mysqltest_1@localhost; grant usage on *.* to mysqltest_1@localhost; flush user_resources; select @@session.max_user_connections, @@global.max_user_connections; diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result index e6e9ddf9545..2e1eb15cad4 100644 --- a/mysql-test/r/user_var-binlog.result +++ b/mysql-test/r/user_var-binlog.result @@ -30,7 +30,7 @@ use `test`/*!*/; SET TIMESTAMP=10000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/; -SET @@session.sql_mode=0/*!*/; +SET @@session.sql_mode=1342177280/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; diff --git a/mysql-test/r/status_user.result b/mysql-test/r/userstat.result index 829c8abb634..5ce10d96643 100644 --- a/mysql-test/r/status_user.result +++ b/mysql-test/r/userstat.result @@ -25,6 +25,8 @@ DENIED_CONNECTIONS bigint(21) NO 0 LOST_CONNECTIONS bigint(21) NO 0 ACCESS_DENIED bigint(21) NO 0 EMPTY_QUERIES bigint(21) NO 0 +TOTAL_SSL_CONNECTIONS bigint(21) unsigned NO 0 +MAX_STATEMENT_TIME_EXCEEDED bigint(21) NO 0 show columns from information_schema.user_statistics; Field Type Null Key Default Extra USER varchar(128) NO @@ -50,6 +52,8 @@ DENIED_CONNECTIONS bigint(21) NO 0 LOST_CONNECTIONS bigint(21) NO 0 ACCESS_DENIED bigint(21) NO 0 EMPTY_QUERIES bigint(21) NO 0 +TOTAL_SSL_CONNECTIONS bigint(21) unsigned NO 0 +MAX_STATEMENT_TIME_EXCEEDED bigint(21) NO 0 show columns from information_schema.index_statistics; Field Type Null Key Default Extra TABLE_SCHEMA varchar(192) NO @@ -76,6 +80,9 @@ delete from t1 where a=3; select * from t1 where a=999; a b drop table t1; +SHOW STATUS LIKE 'Ssl_cipher'; +Variable_name Value +Ssl_cipher DHE-RSA-AES256-SHA create table t1 (a int, primary key (a), b int default 0) engine=innodb; begin; insert into t1 values(1,1); @@ -138,8 +145,9 @@ test t1 6 13 13 show index_statistics; Table_schema Table_name Index_name Rows_read test t1 PRIMARY 2 -select TOTAL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics;; -TOTAL_CONNECTIONS 1 +select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics;; +TOTAL_CONNECTIONS 2 +TOTAL_SSL_CONNECTIONS 1 CONCURRENT_CONNECTIONS 0 ROWS_READ 6 ROWS_SENT 2 @@ -155,8 +163,9 @@ DENIED_CONNECTIONS 0 LOST_CONNECTIONS 0 ACCESS_DENIED 0 EMPTY_QUERIES 1 -select TOTAL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.user_statistics;; -TOTAL_CONNECTIONS 1 +select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.user_statistics;; +TOTAL_CONNECTIONS 2 +TOTAL_SSL_CONNECTIONS 1 CONCURRENT_CONNECTIONS 0 ROWS_READ 6 ROWS_SENT 2 @@ -178,12 +187,9 @@ select * from information_schema.index_statistics; TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ select * from information_schema.table_statistics; TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES -show status like "%statistics%"; +show status like "%generic%"; Variable_name Value -Com_show_client_statistics 0 -Com_show_index_statistics 1 -Com_show_table_statistics 1 -Com_show_user_statistics 0 +Com_show_generic 2 select connected_time <> 0, busy_time <> 0, bytes_received <> 0, bytes_sent <> 0, binlog_bytes_written <> 0 from information_schema.user_statistics; diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result index 689db16b5d4..58cab5ad1ca 100644 --- a/mysql-test/r/varbinary.result +++ b/mysql-test/r/varbinary.result @@ -91,7 +91,7 @@ length(a) length(b) 255 3 CHECK TABLE t1 FOR UPGRADE; Table Op Msg_type Msg_text -test.t1 check error Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it! +test.t1 check error Upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it! REPAIR TABLE t1; Table Op Msg_type Msg_text test.t1 repair status OK @@ -175,6 +175,8 @@ b'' 0+b'' select x'', 0+x''; x'' 0+x'' 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' select 0x; ERROR 42S22: Unknown column '0x' in 'field list' select 0b; diff --git a/mysql-test/r/variables-notembedded.result b/mysql-test/r/variables-notembedded.result index 75fd2430e4b..f8191345219 100644 --- a/mysql-test/r/variables-notembedded.result +++ b/mysql-test/r/variables-notembedded.result @@ -44,19 +44,58 @@ ERROR HY000: Variable 'relay_log' is a read only variable SET @@global.relay_log= 'x'; ERROR HY000: Variable 'relay_log' is a read only variable # +SHOW VARIABLES like 'relay_log_basename'; +Variable_name Value +relay_log_basename MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin +SELECT @@session.relay_log_basename; +ERROR HY000: Variable 'relay_log_basename' is a GLOBAL variable +SELECT @@global.relay_log_basename; +@@global.relay_log_basename +MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin +SET @@session.relay_log_basename= 'x'; +ERROR HY000: Variable 'relay_log_basename' is a read only variable +SET @@global.relay_log_basename= 'x'; +ERROR HY000: Variable 'relay_log_basename' is a read only variable +# +SHOW VARIABLES like 'log_bin_basename'; +Variable_name Value +log_bin_basename +SELECT @@session.log_bin_basename; +ERROR HY000: Variable 'log_bin_basename' is a GLOBAL variable +SELECT @@global.log_bin_basename; +@@global.log_bin_basename +NULL +SET @@session.log_bin_basename= 'x'; +ERROR HY000: Variable 'log_bin_basename' is a read only variable +SET @@global.log_bin_basename= 'x'; +ERROR HY000: Variable 'log_bin_basename' is a read only variable +# SHOW VARIABLES like 'relay_log_index'; Variable_name Value -relay_log_index mysqld-relay-bin.index +relay_log_index MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin.index SELECT @@session.relay_log_index; ERROR HY000: Variable 'relay_log_index' is a GLOBAL variable SELECT @@global.relay_log_index; @@global.relay_log_index -mysqld-relay-bin.index +MYSQLTEST_VARDIR/mysqld.1/data/mysqld-relay-bin.index SET @@session.relay_log_index= 'x'; ERROR HY000: Variable 'relay_log_index' is a read only variable SET @@global.relay_log_index= 'x'; ERROR HY000: Variable 'relay_log_index' is a read only variable # +SHOW VARIABLES like 'log_bin_index'; +Variable_name Value +log_bin_index +SELECT @@session.log_bin_index; +ERROR HY000: Variable 'log_bin_index' is a GLOBAL variable +SELECT @@global.log_bin_index; +@@global.log_bin_index +NULL +SET @@session.log_bin_index= 'x'; +ERROR HY000: Variable 'log_bin_index' is a read only variable +SET @@global.log_bin_index= 'x'; +ERROR HY000: Variable 'log_bin_index' is a read only variable +# SHOW VARIABLES like 'relay_log_info_file'; Variable_name Value relay_log_info_file relay-log.info diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index a42c0c5abcb..fef3e4a3e9e 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -20,7 +20,6 @@ set @my_myisam_max_sort_file_size =@@global.myisam_max_sort_file_size; set @my_net_buffer_length =@@global.net_buffer_length; set @my_net_write_timeout =@@global.net_write_timeout; set @my_net_read_timeout =@@global.net_read_timeout; -set @my_rpl_recovery_rank =@@global.rpl_recovery_rank; set @my_server_id =@@global.server_id; set @my_slow_launch_time =@@global.slow_launch_time; set @my_storage_engine =@@global.default_storage_engine; @@ -318,8 +317,8 @@ SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size', 'query_alloc_block_size', 'query_prealloc_size', 'transaction_alloc_block_size', 'transaction_prealloc_size'); Variable_name Value -query_alloc_block_size 8192 -query_prealloc_size 8192 +query_alloc_block_size 16384 +query_prealloc_size 24576 range_alloc_block_size 4096 transaction_alloc_block_size 8192 transaction_prealloc_size 4096 @@ -329,8 +328,8 @@ WHERE variable_name IN ('range_alloc_block_size', 'query_alloc_block_size', 'query_prealloc_size', 'transaction_alloc_block_size', 'transaction_prealloc_size') ORDER BY 1; VARIABLE_NAME VARIABLE_VALUE -QUERY_ALLOC_BLOCK_SIZE 8192 -QUERY_PREALLOC_SIZE 8192 +QUERY_ALLOC_BLOCK_SIZE 16384 +QUERY_PREALLOC_SIZE 24576 RANGE_ALLOC_BLOCK_SIZE 4096 TRANSACTION_ALLOC_BLOCK_SIZE 8192 TRANSACTION_PREALLOC_SIZE 4096 @@ -411,8 +410,8 @@ SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size', 'query_alloc_block_size', 'query_prealloc_size', 'transaction_alloc_block_size', 'transaction_prealloc_size'); Variable_name Value -query_alloc_block_size 8192 -query_prealloc_size 8192 +query_alloc_block_size 16384 +query_prealloc_size 24576 range_alloc_block_size 4096 transaction_alloc_block_size 8192 transaction_prealloc_size 4096 @@ -522,7 +521,6 @@ Warnings: Warning 1292 Truncated incorrect max_heap_table_size value: '100' set max_join_size=100; set max_sort_length=100; -set max_tmp_tables=100; set global max_user_connections=100; select @@max_user_connections; @@max_user_connections @@ -540,9 +538,6 @@ set read_buffer_size=100; Warnings: Warning 1292 Truncated incorrect read_buffer_size value: '100' set read_rnd_buffer_size=100; -set global rpl_recovery_rank=100; -Warnings: -Warning 1287 '@@rpl_recovery_rank' is deprecated and will be removed in a future release. set global server_id=100; set global slow_launch_time=100; set sort_buffer_size=100; @@ -1061,9 +1056,6 @@ Warnings: Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length' set global net_write_timeout =@my_net_write_timeout; set global net_read_timeout =@my_net_read_timeout; -set global rpl_recovery_rank =@my_rpl_recovery_rank; -Warnings: -Warning 1287 '@@rpl_recovery_rank' is deprecated and will be removed in a future release. set global server_id =@my_server_id; set global slow_launch_time =@my_slow_launch_time; set global default_storage_engine =@my_storage_engine; @@ -1141,12 +1133,12 @@ ERROR HY000: Variable 'ft_stopword_file' is a read only variable # SHOW VARIABLES like 'back_log'; Variable_name Value -back_log 150 +back_log 80 SELECT @@session.back_log; ERROR HY000: Variable 'back_log' is a GLOBAL variable SELECT @@global.back_log; @@global.back_log -150 +80 SET @@session.back_log= 7; ERROR HY000: Variable 'back_log' is a read only variable SET @@global.back_log= 7; @@ -1536,7 +1528,7 @@ SET @@global.key_buffer_size=@kbs; SET @@global.key_cache_block_size=@kcbs; select @@max_long_data_size; @@max_long_data_size -1048576 +4194304 # # Bug#11766424 59527: # Assert in DECIMAL_BIN_SIZE: @@ -1577,7 +1569,7 @@ CREATE TABLE t1 AS SELECT @a:= CAST(1 AS UNSIGNED) AS a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(1) unsigned NOT NULL DEFAULT '0' + `a` int(1) unsigned NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; End of 5.1 tests @@ -1751,7 +1743,9 @@ SET @@sql_quote_show_create = @sql_quote_show_create_saved; drop table if exists t1; drop function if exists t1_max; drop function if exists t1_min; +set sql_mode=""; create table t1 (a int) engine=innodb; +set sql_mode=default; insert into t1(a) values (0), (1); create function t1_max() returns int return (select max(a) from t1); create function t1_min() returns int return (select min(a) from t1); diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 96c35d9dcb3..d4a2a9b1b79 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -826,6 +826,9 @@ drop table t2; create table t1 (a int); insert into t1 values (1), (2); create view v1 as select 5 from t1 order by 1; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 5 AS `5` from `t1` order by 1 latin1 latin1_swedish_ci select * from v1; 5 5 @@ -1350,8 +1353,11 @@ a b delete from t1; load data infile '../../std_data/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines; Warnings: +Note 1265 Data truncated for column 'a' at row 1 +Note 1265 Data truncated for column 'a' at row 2 Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3 Warning 1369 CHECK OPTION failed 'test.v1' +Note 1265 Data truncated for column 'a' at row 3 Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 4 Warning 1369 CHECK OPTION failed 'test.v1' select * from t1 order by a,b; @@ -2237,12 +2243,12 @@ drop table t1; create table t1 ( r_object_id char(16) NOT NULL, group_name varchar(32) NOT NULL -) engine = InnoDB; +); create table t2 ( r_object_id char(16) NOT NULL, i_position int(11) NOT NULL, users_names varchar(32) default NULL -) Engine = InnoDB; +); create view v1 as select r_object_id, group_name from t1; create view v2 as select r_object_id, i_position, users_names from t2; create unique index r_object_id on t1(r_object_id); @@ -2902,6 +2908,8 @@ Tables_in_test t1 DROP TABLE t1; DROP VIEW IF EXISTS v1; +set GLOBAL sql_mode=""; +set LOCAL sql_mode=""; CREATE DATABASE bug21261DB; USE bug21261DB; CREATE TABLE t1 (x INT); @@ -2924,6 +2932,8 @@ DROP VIEW v1; DROP TABLE t1; DROP DATABASE bug21261DB; USE test; +set GLOBAL sql_mode=default; +set LOCAL sql_mode=default; create table t1 (f1 datetime); create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute; show create view v1; @@ -4426,36 +4436,58 @@ CREATE TABLE t1 (a varchar(10), KEY (a)) ; INSERT INTO t1 VALUES ('DD'), ('ZZ'), ('ZZ'), ('KK'), ('FF'), ('HH'),('MM'); CREATE VIEW v1 AS SELECT * FROM t1; +# t1 and v1 should return the same result set SELECT * FROM v1 WHERE a > 'JJ' OR a <> 0 AND a = 'VV'; a KK MM ZZ ZZ -Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'VV' +SELECT * FROM t1 WHERE a > 'JJ' OR a <> 0 AND a = 'VV'; +a +KK +MM +ZZ +ZZ +# t1 and v1 should propagate constants in the same way EXPLAIN EXTENDED SELECT * FROM v1 WHERE a > 'JJ' OR a <> 0 AND a = 'VV'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range a a 13 NULL 4 100.00 Using where; Using index Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'VV' -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > 'JJ') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` > 'JJ') or ((`test`.`t1`.`a` = 'VV') and (`test`.`t1`.`a` <> 0))) +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a > 'JJ' OR a <> 0 AND a = 'VV'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 13 NULL 4 100.00 Using where; Using index +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` > 'JJ') or ((`test`.`t1`.`a` = 'VV') and (`test`.`t1`.`a` <> 0))) +# t1 and v1 should return the same result set SELECT * FROM v1 WHERE a > 'JJ' OR a AND a = 'VV'; a KK MM ZZ ZZ -Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'VV' +SELECT * FROM t1 WHERE a > 'JJ' OR a AND a = 'VV'; +a +KK +MM +ZZ +ZZ +# t1 and v1 should propagate constants in the same way EXPLAIN EXTENDED SELECT * FROM v1 WHERE a > 'JJ' OR a AND a = 'VV'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range a a 13 NULL 4 100.00 Using where; Using index Warnings: -Warning 1292 Truncated incorrect DOUBLE value: 'VV' -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > 'JJ') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` > 'JJ') or ((`test`.`t1`.`a` = 'VV') and (`test`.`t1`.`a` <> 0))) +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a > 'JJ' OR a AND a = 'VV'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 range a a 13 NULL 4 100.00 Using where; Using index +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` > 'JJ') or ((`test`.`t1`.`a` = 'VV') and (`test`.`t1`.`a` <> 0))) DROP VIEW v1; DROP TABLE t1; # @@ -5430,6 +5462,7 @@ DROP FUNCTION f1; DROP VIEW v1; DROP TABLE t1, t2; create view v1 as select 1; +FOUND /mariadb-version/ in v1.frm drop view v1; # # MDEV-7260: Crash in get_best_combination when executing multi-table @@ -5785,3 +5818,90 @@ ERROR 42S22: Unknown column 'SOME_GARBAGE.b.a' in 'field list' # -- End of 10.0 tests. # ----------------------------------------------------------------- SET optimizer_switch=@save_optimizer_switch; +# +# Start of 10.1 tests +# +# +# MDEV-8747 Wrong result for SELECT..WHERE derived_table_column='a' AND derived_table_column<>_latin1'A' COLLATE latin1_bin +# +CREATE TABLE t1 (a varchar(10) character set cp1251 collate cp1251_ukrainian_ci, KEY (a)) ; +INSERT INTO t1 VALUES ('DD'), ('ZZ'), ('ZZ'), ('KK'), ('FF'), ('HH'),('MM'),('`1'); +CREATE VIEW v1 AS SELECT * FROM t1; +SELECT * FROM t1 WHERE a <> 0 AND a = ' 1'; +a +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '`1' +SELECT * FROM v1 WHERE a <> 0 AND a = ' 1'; +a +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '`1' +DROP VIEW v1; +DROP TABLE t1; +CREATE TABLE t1 (a ENUM('5','6')); +INSERT INTO t1 VALUES ('5'),('6'); +CREATE VIEW v1 AS SELECT * FROM t1; +SELECT * FROM t1 WHERE a='5' AND a<2; +a +5 +SELECT * FROM v1 WHERE a='5' AND a<2; +a +5 +DROP VIEW v1; +DROP TABLE t1; +# +# MDEV-8749 Wrong result for SELECT..WHERE derived_table_enum_column='number' AND derived_table_enum_column OP number2 +# +CREATE TABLE t1 (a varchar(10) character set cp1251 collate cp1251_ukrainian_ci, KEY (a)); +INSERT INTO t1 VALUES ('DD'), ('ZZ'), ('ZZ'), ('KK'), ('FF'), ('HH'),('MM'),('`1'); +CREATE VIEW v1 AS SELECT * FROM t1; +SELECT * FROM t1 WHERE a <> 0 AND a = ' 1'; +a +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '`1' +SELECT * FROM v1 WHERE a <> 0 AND a = ' 1'; +a +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '`1' +DROP VIEW v1; +DROP TABLE t1; +CREATE TABLE t1 (a ENUM('5','6')); +INSERT INTO t1 VALUES ('5'),('6'); +CREATE VIEW v1 AS SELECT * FROM t1; +SELECT * FROM t1 WHERE a='5' AND a<2; +a +5 +SELECT * FROM v1 WHERE a='5' AND a<2; +a +5 +DROP VIEW v1; +DROP TABLE t1; +# +# MDEV-8742 Wrong result for SELECT..WHERE view_latin1_swedish_ci_field='a' COLLATE latin1_bin +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1); +INSERT INTO t1 VALUES ('a'),('A'); +CREATE VIEW v1 AS SELECT * FROM t1 WHERE a='a'; +SELECT * FROM v1 WHERE a=_latin1'a' COLLATE latin1_bin; +a +a +DROP VIEW v1; +DROP TABLE t1; +# +# MDEV-9701: CREATE VIEW with GROUP BY or ORDER BY and constant +# produces invalid definition +# +CREATE TABLE t1 ( i INT ); +INSERT INTO t1 VALUES (1),(2); +CREATE VIEW v1 AS +SELECT 3 AS three, COUNT(*) FROM t1 GROUP BY three; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 3 AS `three`,count(0) AS `COUNT(*)` from `t1` group by '' latin1 latin1_swedish_ci +SELECT * FROM v1; +three COUNT(*) +3 2 +drop view v1; +drop table t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/view_debug.result b/mysql-test/r/view_debug.result new file mode 100644 index 00000000000..0aab5c5ac33 --- /dev/null +++ b/mysql-test/r/view_debug.result @@ -0,0 +1,20 @@ +# +#MDEV-8087:Server crashed in Time_and_counter_tracker::incr_loops +# +CREATE PROCEDURE proc() SELECT * FROM v2; +CREATE ALGORITHM = UNDEFINED VIEW v1 AS SELECT 1; +CREATE ALGORITHM = TEMPTABLE VIEW v2 AS SELECT 3 FROM v1; +DROP VIEW v1; +CALL proc(); +ERROR HY000: View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +SET DEBUG_SYNC= 'after_cached_view_opened SIGNAL oppp WAIT_FOR created'; +CALL proc(); +SET DEBUG_SYNC= 'now WAIT_FOR oppp'; +SET DEBUG_SYNC= 'RESET'; +CREATE ALGORITHM = TEMPTABLE VIEW v1 AS SELECT 2; +SET DEBUG_SYNC= 'now SIGNAL created'; +3 +3 +SET DEBUG_SYNC= 'RESET'; +drop procedure proc; +drop view v1,v2; diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result index 8f0ffdda742..525f9fbb5e1 100644 --- a/mysql-test/r/view_grant.result +++ b/mysql-test/r/view_grant.result @@ -1,5 +1,6 @@ drop database if exists mysqltest; drop view if exists v1,v2,v3; +create user test@localhost; grant create view on test.* to test@localhost; show grants for test@localhost; Grants for test@localhost @@ -13,6 +14,7 @@ drop user test@localhost; create database mysqltest; create table mysqltest.t1 (a int, b int); create table mysqltest.t2 (a int, b int); +create user mysqltest_1@localhost; grant select on mysqltest.t1 to mysqltest_1@localhost; grant create view,select on test.* to mysqltest_1@localhost; create definer=root@localhost view v1 as select * from mysqltest.t1; @@ -46,18 +48,19 @@ c select d from mysqltest.v1; ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'd' in table 'v1' revoke all privileges on mysqltest.v1 from mysqltest_1@localhost; -delete from mysql.user where user='mysqltest_1'; +drop user mysqltest_1@localhost; drop database mysqltest; create database mysqltest; create table mysqltest.t1 (a int, b int); create algorithm=temptable view mysqltest.v1 (c,d) as select a+1,b+1 from mysqltest.t1; +create user mysqltest_1@localhost; grant select (c) on mysqltest.v1 to mysqltest_1@localhost; select c from mysqltest.v1; c select d from mysqltest.v1; ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'd' in table 'v1' revoke all privileges on mysqltest.v1 from mysqltest_1@localhost; -delete from mysql.user where user='mysqltest_1'; +drop user mysqltest_1@localhost; drop database mysqltest; create database mysqltest; create table mysqltest.t1 (a int, b int); @@ -67,6 +70,7 @@ create algorithm=temptable view mysqltest.v2 (c,d) as select a+1,b+1 from mysqlt create view mysqltest.v3 (c,d) as select a+1,b+1 from mysqltest.t2; create algorithm=temptable view mysqltest.v4 (c,d) as select a+1,b+1 from mysqltest.t2; create view mysqltest.v5 (c,d) as select a+1,b+1 from mysqltest.t1; +create user mysqltest_1@localhost; grant select on mysqltest.v1 to mysqltest_1@localhost; grant select on mysqltest.v2 to mysqltest_1@localhost; grant select on mysqltest.v3 to mysqltest_1@localhost; @@ -91,19 +95,19 @@ Field Type Null Key Default Extra c bigint(12) YES NULL d bigint(12) YES NULL explain select c from mysqltest.v1; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v1; ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1' explain select c from mysqltest.v2; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v2; ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v2' explain select c from mysqltest.v3; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v3; ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v3' explain select c from mysqltest.v4; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v4; ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v4' explain select c from mysqltest.v5; @@ -115,7 +119,7 @@ show create view mysqltest.v5; View Create View character_set_client collation_connection v5 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v5` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci explain select c from mysqltest.v1; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v1; ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1' grant show view on mysqltest.v1 to mysqltest_1@localhost; @@ -128,15 +132,15 @@ show create view mysqltest.v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci explain select c from mysqltest.v2; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v2; ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v2' explain select c from mysqltest.v3; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v3; ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v3' explain select c from mysqltest.v4; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v4; ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v4' explain select c from mysqltest.v5; @@ -156,17 +160,17 @@ show create view mysqltest.v2; View Create View character_set_client collation_connection v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v2` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci explain select c from mysqltest.v3; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v3; View Create View character_set_client collation_connection v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v3` AS select (`mysqltest`.`t2`.`a` + 1) AS `c`,(`mysqltest`.`t2`.`b` + 1) AS `d` from `mysqltest`.`t2` latin1 latin1_swedish_ci explain select c from mysqltest.v4; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v4; View Create View character_set_client collation_connection v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v4` AS select (`mysqltest`.`t2`.`a` + 1) AS `c`,(`mysqltest`.`t2`.`b` + 1) AS `d` from `mysqltest`.`t2` latin1 latin1_swedish_ci revoke all privileges on mysqltest.* from mysqltest_1@localhost; -delete from mysql.user where user='mysqltest_1'; +drop user mysqltest_1@localhost; drop database mysqltest; create database mysqltest; create table mysqltest.t1 (a int, b int, primary key(a)); @@ -176,6 +180,7 @@ insert into mysqltest.t2 values (3), (4), (5), (6); create view mysqltest.v1 (a,c) as select a, b+1 from mysqltest.t1; create view mysqltest.v2 (a,c) as select a, b from mysqltest.t1; create view mysqltest.v3 (a,c) as select a, b+1 from mysqltest.t1; +create user mysqltest_1@localhost; grant update (a) on mysqltest.v2 to mysqltest_1@localhost; grant update on mysqltest.v1 to mysqltest_1@localhost; grant select on mysqltest.* to mysqltest_1@localhost; @@ -222,6 +227,7 @@ update v3 set a=a+c; ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table 'v3' use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; +drop user mysqltest_1@localhost; drop database mysqltest; create database mysqltest; create table mysqltest.t1 (a int, b int, primary key(a)); @@ -230,6 +236,7 @@ create table mysqltest.t2 (x int); insert into mysqltest.t2 values (3), (4), (5), (6); create view mysqltest.v1 (a,c) as select a, b+1 from mysqltest.t1; create view mysqltest.v2 (a,c) as select a, b+1 from mysqltest.t1; +create user mysqltest_1@localhost; grant delete on mysqltest.v1 to mysqltest_1@localhost; grant select on mysqltest.* to mysqltest_1@localhost; use mysqltest; @@ -250,6 +257,7 @@ delete from v2 where c < 4; ERROR 42000: DELETE command denied to user 'mysqltest_1'@'localhost' for table 'v2' use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; +drop user mysqltest_1@localhost; drop database mysqltest; create database mysqltest; create table mysqltest.t1 (a int, b int, primary key(a)); @@ -258,6 +266,7 @@ create table mysqltest.t2 (x int, y int); insert into mysqltest.t2 values (3,4); create view mysqltest.v1 (a,c) as select a, b from mysqltest.t1; create view mysqltest.v2 (a,c) as select a, b from mysqltest.t1; +create user mysqltest_1@localhost; grant insert on mysqltest.v1 to mysqltest_1@localhost; grant select on mysqltest.* to mysqltest_1@localhost; use mysqltest; @@ -280,10 +289,12 @@ insert into v2 select x,y from t2; ERROR 42000: INSERT command denied to user 'mysqltest_1'@'localhost' for table 'v2' use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; +drop user mysqltest_1@localhost; drop database mysqltest; create database mysqltest; create table mysqltest.t1 (a int, b int); create table mysqltest.t2 (a int, b int); +create user mysqltest_1@localhost; grant update on mysqltest.t1 to mysqltest_1@localhost; grant update(b) on mysqltest.t2 to mysqltest_1@localhost; grant create view,update on test.* to mysqltest_1@localhost; @@ -308,18 +319,22 @@ ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column grant update,select(b) on mysqltest.t2 to mysqltest_1@localhost; create view v4 as select b+1 from mysqltest.t2; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; +drop user mysqltest_1@localhost; drop database mysqltest; drop view v1,v2,v4; create database mysqltest; create table mysqltest.t1 (a int); +create user mysqltest_1@localhost; grant all privileges on mysqltest.* to mysqltest_1@localhost; use mysqltest; create view v1 as select * from t1; use test; revoke all privileges on mysqltest.* from mysqltest_1@localhost; +drop user mysqltest_1@localhost; drop database mysqltest; create database mysqltest; create table mysqltest.t1 (a int, b int); +create user mysqltest_1@localhost; grant select on mysqltest.t1 to mysqltest_1@localhost; grant create view,select on test.* to mysqltest_1@localhost; create view v1 as select * from mysqltest.t1; @@ -333,6 +348,7 @@ grant select on mysqltest.t1 to mysqltest_1@localhost; select * from v1; a b REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; +drop user mysqltest_1@localhost; drop view v1; drop database mysqltest; create database mysqltest; @@ -348,6 +364,7 @@ create algorithm=MERGE view v2 as select f2() from t1; create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select f2() from t1; create algorithm=MERGE SQL SECURITY INVOKER view v4 as select f2() from t1; create SQL SECURITY INVOKER view v5 as select * from v4; +create user mysqltest_1@localhost; grant select on v1 to mysqltest_1@localhost; grant select on v2 to mysqltest_1@localhost; grant select on v3 to mysqltest_1@localhost; @@ -372,6 +389,7 @@ drop function f2; drop table t1, t2; use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; +drop user mysqltest_1@localhost; drop database mysqltest; create database mysqltest; use mysqltest; @@ -381,6 +399,7 @@ create table t2 (s1 int); drop function if exists f2; create function f2 () returns int begin declare v int; select s1 from t2 into v; return v; end// +create user mysqltest_1@localhost; grant select on t1 to mysqltest_1@localhost; grant execute on function f2 to mysqltest_1@localhost; grant create view on mysqltest.* to mysqltest_1@localhost; @@ -409,12 +428,14 @@ drop function f2; drop table t1, t2; use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; +drop user mysqltest_1@localhost; drop database mysqltest; create database mysqltest; use mysqltest; create table t1 (a int); create table v1 (a int); insert into t1 values (1); +create user mysqltest_1@localhost; grant select on t1 to mysqltest_1@localhost; grant select on v1 to mysqltest_1@localhost; grant create view on mysqltest.* to mysqltest_1@localhost; @@ -442,6 +463,7 @@ ERROR HY000: View 'mysqltest.v5' references invalid table(s) or column(s) or fun drop table t1; use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; +drop user mysqltest_1@localhost; drop database mysqltest; create database mysqltest; use mysqltest; @@ -452,6 +474,7 @@ create algorithm=MERGE view v2 as select *, a as b from t1; create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select *, a as b from t1; create algorithm=MERGE SQL SECURITY INVOKER view v4 as select *, a as b from t1; create SQL SECURITY INVOKER view v5 as select * from v4; +create user mysqltest_1@localhost; grant select on v1 to mysqltest_1@localhost; grant select on v2 to mysqltest_1@localhost; grant select on v3 to mysqltest_1@localhost; @@ -475,12 +498,14 @@ drop view v1, v2, v3, v4, v5; drop table t1; use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; +drop user mysqltest_1@localhost; drop database mysqltest; drop view if exists v1; drop table if exists t1; create table t1 as select * from mysql.user where user=''; delete from mysql.user where user=''; flush privileges; +create user 'test14256'@'%'; grant all on test.* to 'test14256'@'%'; use test; create view v1 as select 42; @@ -511,6 +536,7 @@ CREATE VIEW v1 AS SELECT * FROM t1; SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci +create user mysqltest_1@localhost; GRANT SELECT, LOCK TABLES ON mysqltest.* TO mysqltest_1@localhost; use mysqltest; LOCK TABLES v1 READ; @@ -853,6 +879,7 @@ INSERT INTO mysqltest1.t1 VALUES (11), (12), (13), (14); INSERT INTO mysqltest1.t2 VALUES (21), (22), (23), (24); INSERT INTO mysqltest1.t3 VALUES (31), (32), (33), (34); INSERT INTO mysqltest1.t4 VALUES (41), (42), (43), (44); +CREATE USER mysqltest_u1@localhost; GRANT SELECT ON mysqltest1.t1 TO mysqltest_u1@localhost; GRANT INSERT ON mysqltest1.t2 TO mysqltest_u1@localhost; GRANT SELECT, UPDATE ON mysqltest1.t3 TO mysqltest_u1@localhost; @@ -933,6 +960,7 @@ CREATE DATABASE db1; USE db1; CREATE TABLE t1(f1 INT, f2 INT); CREATE VIEW v1 AS SELECT f1, f2 FROM t1; +CREATE USER foo; GRANT SELECT (f1) ON t1 TO foo; GRANT SELECT (f1) ON v1 TO foo; USE db1; @@ -1027,7 +1055,7 @@ grant select, show view on mysqltest1.v1 to quintessa@localhost; select * from v1; i explain select * from v1; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ... as cecil select * from v1; ERROR 42000: SELECT command denied to user 'cecil'@'localhost' for table 'v1' @@ -1043,7 +1071,7 @@ id select_type table type possible_keys key key_len ref rows Extra select * from v1; i explain select * from v1; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ... as fiona select * from v2; i j @@ -1057,14 +1085,14 @@ ERROR 42000: SELECT command denied to user 'fiona'@'localhost' for table 'v1' explain select * from t2; ERROR 42000: SELECT command denied to user 'fiona'@'localhost' for table 't2' explain select * from v2; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ... as greg select * from v2; i j explain select * from v1; ERROR 42000: SELECT command denied to user 'greg'@'localhost' for table 'v1' explain select * from v2; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ... as han select * from t3; ERROR 42000: SELECT command denied to user 'han'@'localhost' for table 't3' @@ -1084,17 +1112,17 @@ id select_type table type possible_keys key key_len ref rows Extra select * from v2; i j explain select * from v2; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ... as jamie select * from v2; i j explain select * from v2; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ... as karl select * from v2; i j explain select * from v2; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ... as lena select * from v2; ERROR 42000: SELECT command denied to user 'lena'@'localhost' for table 'v2' @@ -1111,22 +1139,22 @@ id select_type table type possible_keys key key_len ref rows Extra select * from v2; i j explain select * from v2; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ... as olga select * from v2; i j explain select * from v2; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ... as pjotr select * from v2; i j explain select * from v2; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ... as quintessa select * from v1; i explain select * from v1; -ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ... as root again at last: clean-up time! drop user alice@localhost; drop user bob@localhost; diff --git a/mysql-test/r/wait_timeout_not_windows.result b/mysql-test/r/wait_timeout_not_windows.result index df70aa99221..867787a8ed3 100644 --- a/mysql-test/r/wait_timeout_not_windows.result +++ b/mysql-test/r/wait_timeout_not_windows.result @@ -1,3 +1,4 @@ set global log_warnings=2; set @@wait_timeout=1; +FOUND /Aborted.*Got timeout reading communication packets/ in mysqld.1.err set global log_warnings=@@log_warnings; diff --git a/mysql-test/r/warnings_engine_disabled.result b/mysql-test/r/warnings_engine_disabled.result index 9fcd3b934c0..d9e490ba18f 100644 --- a/mysql-test/r/warnings_engine_disabled.result +++ b/mysql-test/r/warnings_engine_disabled.result @@ -1,3 +1,4 @@ +set sql_mode=""; create table t1 (id int) engine=InnoDB; Warnings: Warning 1286 Unknown storage engine 'InnoDB' @@ -6,6 +7,7 @@ alter table t1 engine=InnoDB; Warnings: Warning 1286 Unknown storage engine 'InnoDB' drop table t1; +set sql_mode=default; SELECT ENGINE, SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='InnoDB'; ENGINE SUPPORT InnoDB NO diff --git a/mysql-test/r/xa_sync.result b/mysql-test/r/xa_sync.result new file mode 100644 index 00000000000..769a13d1773 --- /dev/null +++ b/mysql-test/r/xa_sync.result @@ -0,0 +1,24 @@ +# +# MDEV-7793 - Race condition between XA COMMIT/ROLLBACK and disconnect +# +# Note that this test is meaningful only with valgrind. +XA START 'xatest'; +XA END 'xatest'; +XA PREPARE 'xatest'; +SET debug_sync='xa_after_search SIGNAL parked WAIT_FOR go'; +XA COMMIT 'xatest'; +SET debug_sync='now WAIT_FOR parked'; +# Waiting for thread to get deleted +SET debug_sync='now SIGNAL go'; +ERROR XAE04: XAER_NOTA: Unknown XID +SET debug_sync='RESET'; +XA START 'xatest'; +XA END 'xatest'; +XA PREPARE 'xatest'; +SET debug_sync='xa_after_search SIGNAL parked WAIT_FOR go'; +XA ROLLBACK 'xatest'; +SET debug_sync='now WAIT_FOR parked'; +# Waiting for thread to get deleted +SET debug_sync='now SIGNAL go'; +ERROR XAE04: XAER_NOTA: Unknown XID +SET debug_sync='RESET'; diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result index 24b95f0e204..41dbc744228 100644 --- a/mysql-test/r/xml.result +++ b/mysql-test/r/xml.result @@ -1161,6 +1161,8 @@ SET NAMES latin1; SELECT UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0); UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0) NULL +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' # # Bug#12375190: UPDATEXML CRASHES ON SIMPLE INPUTS # @@ -1182,6 +1184,8 @@ aa bb SELECT ExtractValue('<a><b>abc</b><c>2</c><d>1</d></a>','substring(/a/b,..)'); ExtractValue('<a><b>abc</b><c>2</c><d>1</d></a>','substring(/a/b,..)') +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '' # # Bug#62429 XML: ExtractValue, UpdateXML max arg length 127 chars # @@ -1241,6 +1245,8 @@ DROP TABLE t1; SELECT ExtractValue('<a><b>abc</b><c>2</c><d>1</d></a>','substring(/a/b,..)') AS e; e +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '' SELECT ExtractValue('<a><b>abc</b><c>2</c><d>1</d></a>','substring(/a/b,/a/c)') AS e; e bc |