Loading client/mysqldump.c +5 −2 Original line number Diff line number Diff line Loading @@ -2535,15 +2535,18 @@ static void dump_table(char *table, char *db) plus 2 bytes for '0x' prefix. - In non-HEX mode we need up to 2 bytes per character, plus 2 bytes for leading and trailing '\'' characters. Also we need to reserve 1 byte for terminating '\0'. */ dynstr_realloc_checked(&extended_row,length * 2+2); dynstr_realloc_checked(&extended_row,length * 2 + 2 + 1); if (opt_hex_blob && is_blob) { dynstr_append_checked(&extended_row, "0x"); extended_row.length+= mysql_hex_string(extended_row.str + extended_row.length, row[i], length); extended_row.str[extended_row.length]= '\0'; DBUG_ASSERT(extended_row.length+1 <= extended_row.max_length); /* mysql_hex_string() already terminated string by '\0' */ DBUG_ASSERT(extended_row.str[extended_row.length] == '\0'); } else { Loading mysql-test/r/alter_table.result +19 −0 Original line number Diff line number Diff line Loading @@ -884,3 +884,22 @@ id 50 51 drop table t1; set @orig_sql_mode = @@sql_mode; set sql_mode="no_zero_date"; create table t1(f1 int); alter table t1 add column f2 datetime not null, add column f21 date not null; insert into t1 values(1,'2000-01-01','2000-01-01'); alter table t1 add column f3 datetime not null; ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'f3' at row 1 alter table t1 add column f3 date not null; ERROR 22007: Incorrect date value: '0000-00-00' for column 'f3' at row 1 alter table t1 add column f4 datetime not null default '2002-02-02', add column f41 date not null; ERROR 22007: Incorrect date value: '0000-00-00' for column 'f41' at row 1 alter table t1 add column f4 datetime not null default '2002-02-02', add column f41 date not null default '2002-02-02'; select * from t1; f1 f2 f21 f4 f41 1 2000-01-01 00:00:00 2000-01-01 2002-02-02 00:00:00 2002-02-02 drop table t1; set sql_mode= @orig_sql_mode; mysql-test/r/func_gconcat.result +47 −0 Original line number Diff line number Diff line Loading @@ -763,4 +763,51 @@ Warnings: Warning 1260 1 line(s) were cut by GROUP_CONCAT() SET group_concat_max_len = DEFAULT; DROP TABLE t1; SET group_concat_max_len= 65535; CREATE TABLE t1( a TEXT, b INTEGER ); INSERT INTO t1 VALUES ( 'a', 0 ), ( 'b', 1 ); SELECT GROUP_CONCAT( a ORDER BY b ) FROM t1; GROUP_CONCAT( a ORDER BY b ) a,b SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1; GROUP_CONCAT(DISTINCT a ORDER BY b) a,b SELECT GROUP_CONCAT(DISTINCT a) FROM t1; GROUP_CONCAT(DISTINCT a) a,b SET group_concat_max_len= 10; SELECT GROUP_CONCAT(a ORDER BY b) FROM t1; GROUP_CONCAT(a ORDER BY b) a,b SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1; GROUP_CONCAT(DISTINCT a ORDER BY b) a,b SELECT GROUP_CONCAT(DISTINCT a) FROM t1; GROUP_CONCAT(DISTINCT a) a,b SET group_concat_max_len= 65535; CREATE TABLE t2( a TEXT ); INSERT INTO t2 VALUES( REPEAT( 'a', 5000 ) ); INSERT INTO t2 VALUES( REPEAT( 'b', 5000 ) ); INSERT INTO t2 VALUES( REPEAT( 'a', 5000 ) ); SELECT LENGTH( GROUP_CONCAT( DISTINCT a ) ) FROM t2; LENGTH( GROUP_CONCAT( DISTINCT a ) ) 10001 CREATE TABLE t3( a TEXT, b INT ); INSERT INTO t3 VALUES( REPEAT( 'a', 65534 ), 1 ); INSERT INTO t3 VALUES( REPEAT( 'a', 65535 ), 2 ); INSERT INTO t3 VALUES( REPEAT( 'a', 65536 ), 3 ); Warnings: Warning 1265 Data truncated for column 'a' at row 1 SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 1; LENGTH( GROUP_CONCAT( a ) ) 65534 SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 2; LENGTH( GROUP_CONCAT( a ) ) 65535 SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 3; LENGTH( GROUP_CONCAT( a ) ) 65535 SET group_concat_max_len= DEFAULT; DROP TABLE t1, t2, t3; End of 5.0 tests mysql-test/r/join_outer.result +15 −0 Original line number Diff line number Diff line Loading @@ -1239,3 +1239,18 @@ Handler_read_prev 0 Handler_read_rnd 0 Handler_read_rnd_next 6 DROP TABLE t1,t2; CREATE TABLE t1 (c int PRIMARY KEY, e int NOT NULL); INSERT INTO t1 VALUES (1,0), (2,1); CREATE TABLE t2 (d int PRIMARY KEY); INSERT INTO t2 VALUES (1), (2), (3); EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 1 SIMPLE t2 index NULL PRIMARY 4 NULL 3 Using where; Using index; Not exists SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL; c e d 1 0 NULL SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d<=>NULL; c e d 1 0 NULL DROP TABLE t1,t2; mysql-test/r/key.result +8 −0 Original line number Diff line number Diff line Loading @@ -455,3 +455,11 @@ ORDER BY c.b, c.d a b c d e f g h i j a b c d 2 2 1 2004-11-30 12:00:00 1 0 0 0 0 0 2 3388000 -553000 NULL DROP TABLE t1, t2; CREATE TABLE t1( a TINYINT, KEY(a) ) ENGINE=MyISAM; INSERT INTO t1 VALUES( 1 ); ALTER TABLE t1 DISABLE KEYS; EXPLAIN SELECT MAX(a) FROM t1 FORCE INDEX(a); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 DROP TABLE t1; End of 5.0 tests. Loading
client/mysqldump.c +5 −2 Original line number Diff line number Diff line Loading @@ -2535,15 +2535,18 @@ static void dump_table(char *table, char *db) plus 2 bytes for '0x' prefix. - In non-HEX mode we need up to 2 bytes per character, plus 2 bytes for leading and trailing '\'' characters. Also we need to reserve 1 byte for terminating '\0'. */ dynstr_realloc_checked(&extended_row,length * 2+2); dynstr_realloc_checked(&extended_row,length * 2 + 2 + 1); if (opt_hex_blob && is_blob) { dynstr_append_checked(&extended_row, "0x"); extended_row.length+= mysql_hex_string(extended_row.str + extended_row.length, row[i], length); extended_row.str[extended_row.length]= '\0'; DBUG_ASSERT(extended_row.length+1 <= extended_row.max_length); /* mysql_hex_string() already terminated string by '\0' */ DBUG_ASSERT(extended_row.str[extended_row.length] == '\0'); } else { Loading
mysql-test/r/alter_table.result +19 −0 Original line number Diff line number Diff line Loading @@ -884,3 +884,22 @@ id 50 51 drop table t1; set @orig_sql_mode = @@sql_mode; set sql_mode="no_zero_date"; create table t1(f1 int); alter table t1 add column f2 datetime not null, add column f21 date not null; insert into t1 values(1,'2000-01-01','2000-01-01'); alter table t1 add column f3 datetime not null; ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'f3' at row 1 alter table t1 add column f3 date not null; ERROR 22007: Incorrect date value: '0000-00-00' for column 'f3' at row 1 alter table t1 add column f4 datetime not null default '2002-02-02', add column f41 date not null; ERROR 22007: Incorrect date value: '0000-00-00' for column 'f41' at row 1 alter table t1 add column f4 datetime not null default '2002-02-02', add column f41 date not null default '2002-02-02'; select * from t1; f1 f2 f21 f4 f41 1 2000-01-01 00:00:00 2000-01-01 2002-02-02 00:00:00 2002-02-02 drop table t1; set sql_mode= @orig_sql_mode;
mysql-test/r/func_gconcat.result +47 −0 Original line number Diff line number Diff line Loading @@ -763,4 +763,51 @@ Warnings: Warning 1260 1 line(s) were cut by GROUP_CONCAT() SET group_concat_max_len = DEFAULT; DROP TABLE t1; SET group_concat_max_len= 65535; CREATE TABLE t1( a TEXT, b INTEGER ); INSERT INTO t1 VALUES ( 'a', 0 ), ( 'b', 1 ); SELECT GROUP_CONCAT( a ORDER BY b ) FROM t1; GROUP_CONCAT( a ORDER BY b ) a,b SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1; GROUP_CONCAT(DISTINCT a ORDER BY b) a,b SELECT GROUP_CONCAT(DISTINCT a) FROM t1; GROUP_CONCAT(DISTINCT a) a,b SET group_concat_max_len= 10; SELECT GROUP_CONCAT(a ORDER BY b) FROM t1; GROUP_CONCAT(a ORDER BY b) a,b SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1; GROUP_CONCAT(DISTINCT a ORDER BY b) a,b SELECT GROUP_CONCAT(DISTINCT a) FROM t1; GROUP_CONCAT(DISTINCT a) a,b SET group_concat_max_len= 65535; CREATE TABLE t2( a TEXT ); INSERT INTO t2 VALUES( REPEAT( 'a', 5000 ) ); INSERT INTO t2 VALUES( REPEAT( 'b', 5000 ) ); INSERT INTO t2 VALUES( REPEAT( 'a', 5000 ) ); SELECT LENGTH( GROUP_CONCAT( DISTINCT a ) ) FROM t2; LENGTH( GROUP_CONCAT( DISTINCT a ) ) 10001 CREATE TABLE t3( a TEXT, b INT ); INSERT INTO t3 VALUES( REPEAT( 'a', 65534 ), 1 ); INSERT INTO t3 VALUES( REPEAT( 'a', 65535 ), 2 ); INSERT INTO t3 VALUES( REPEAT( 'a', 65536 ), 3 ); Warnings: Warning 1265 Data truncated for column 'a' at row 1 SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 1; LENGTH( GROUP_CONCAT( a ) ) 65534 SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 2; LENGTH( GROUP_CONCAT( a ) ) 65535 SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 3; LENGTH( GROUP_CONCAT( a ) ) 65535 SET group_concat_max_len= DEFAULT; DROP TABLE t1, t2, t3; End of 5.0 tests
mysql-test/r/join_outer.result +15 −0 Original line number Diff line number Diff line Loading @@ -1239,3 +1239,18 @@ Handler_read_prev 0 Handler_read_rnd 0 Handler_read_rnd_next 6 DROP TABLE t1,t2; CREATE TABLE t1 (c int PRIMARY KEY, e int NOT NULL); INSERT INTO t1 VALUES (1,0), (2,1); CREATE TABLE t2 (d int PRIMARY KEY); INSERT INTO t2 VALUES (1), (2), (3); EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 1 SIMPLE t2 index NULL PRIMARY 4 NULL 3 Using where; Using index; Not exists SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL; c e d 1 0 NULL SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d<=>NULL; c e d 1 0 NULL DROP TABLE t1,t2;
mysql-test/r/key.result +8 −0 Original line number Diff line number Diff line Loading @@ -455,3 +455,11 @@ ORDER BY c.b, c.d a b c d e f g h i j a b c d 2 2 1 2004-11-30 12:00:00 1 0 0 0 0 0 2 3388000 -553000 NULL DROP TABLE t1, t2; CREATE TABLE t1( a TINYINT, KEY(a) ) ENGINE=MyISAM; INSERT INTO t1 VALUES( 1 ); ALTER TABLE t1 DISABLE KEYS; EXPLAIN SELECT MAX(a) FROM t1 FORCE INDEX(a); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 DROP TABLE t1; End of 5.0 tests.