summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <ibabaev@bk-internal.mysql.com>2007-05-28 00:05:38 +0200
committerunknown <ibabaev@bk-internal.mysql.com>2007-05-28 00:05:38 +0200
commit11dd353e12de970d93a0304ea3e6e43df1126907 (patch)
tree88e9d6e9af319de1b0c833c9bb011ed5025ac543
parent06297270880ca0f0023c66ca90291665ec3aacc2 (diff)
parent5f99cf963ea4138fd7adb70ec4a9add55388c281 (diff)
downloadmariadb-git-11dd353e12de970d93a0304ea3e6e43df1126907.tar.gz
Merge bk-internal.mysql.com:/data0/bk/mysql-5.0
into bk-internal.mysql.com:/data0/bk/mysql-5.0-opt client/mysqldump.c: Auto merged mysql-test/r/mysqldump.result: Auto merged mysql-test/r/ps_2myisam.result: Auto merged mysql-test/r/ps_3innodb.result: Auto merged mysql-test/r/ps_4heap.result: Auto merged mysql-test/r/ps_5merge.result: Auto merged mysql-test/r/ps_6bdb.result: Auto merged mysql-test/r/ps_7ndb.result: Auto merged sql/field.h: Auto merged sql/item_func.cc: Auto merged sql/my_decimal.h: Auto merged sql/sql_base.cc: Auto merged
-rw-r--r--client/mysqldump.c7
-rw-r--r--mysql-test/r/alter_table.result19
-rw-r--r--mysql-test/r/func_gconcat.result47
-rw-r--r--mysql-test/r/join_outer.result15
-rw-r--r--mysql-test/r/key.result8
-rw-r--r--mysql-test/r/kill.result82
-rw-r--r--mysql-test/r/myisam.result26
-rw-r--r--mysql-test/r/mysqldump.result11
-rw-r--r--mysql-test/r/ps_2myisam.result32
-rw-r--r--mysql-test/r/ps_3innodb.result32
-rw-r--r--mysql-test/r/ps_4heap.result32
-rw-r--r--mysql-test/r/ps_5merge.result64
-rw-r--r--mysql-test/r/ps_6bdb.result32
-rw-r--r--mysql-test/r/ps_7ndb.result32
-rw-r--r--mysql-test/r/subselect3.result18
-rw-r--r--mysql-test/r/type_newdecimal.result6
-rw-r--r--mysql-test/r/view.result10
-rw-r--r--mysql-test/t/alter_table.test22
-rw-r--r--mysql-test/t/func_gconcat.test30
-rw-r--r--mysql-test/t/join_outer.test16
-rw-r--r--mysql-test/t/key.test12
-rw-r--r--mysql-test/t/kill.test132
-rw-r--r--mysql-test/t/myisam.test16
-rw-r--r--mysql-test/t/mysqldump.test7
-rw-r--r--mysql-test/t/subselect3.test18
-rw-r--r--mysql-test/t/type_newdecimal.test13
-rw-r--r--mysql-test/t/view.test19
-rw-r--r--sql/field.h5
-rw-r--r--sql/field_conv.cc14
-rw-r--r--sql/item_func.cc2
-rw-r--r--sql/item_subselect.cc81
-rw-r--r--sql/item_sum.cc14
-rw-r--r--sql/my_decimal.h10
-rw-r--r--sql/sp_head.cc3
-rw-r--r--sql/sql_base.cc9
-rw-r--r--sql/sql_select.cc67
-rw-r--r--sql/sql_table.cc72
-rw-r--r--sql/table.h23
-rw-r--r--strings/decimal.c3
39 files changed, 894 insertions, 167 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index f1e6a825257..93b9b373ecb 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -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
{
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 280cedb8b89..4eace9ac628 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -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;
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index 20df776ec1b..8b71ad1940e 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -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
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index c62601946c2..1366a8fe97a 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -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;
diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result
index ec15eaa97f5..3abc95ec3bf 100644
--- a/mysql-test/r/key.result
+++ b/mysql-test/r/key.result
@@ -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.
diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result
index cf5486d1091..4bc04c6de3c 100644
--- a/mysql-test/r/kill.result
+++ b/mysql-test/r/kill.result
@@ -41,3 +41,85 @@ select 1;
select RELEASE_LOCK("a");
RELEASE_LOCK("a")
1
+create table t1(f1 int);
+create function bug27563() returns int(11)
+deterministic
+begin
+declare continue handler for sqlstate '70100' set @a:= 'killed';
+declare continue handler for sqlexception set @a:= 'exception';
+set @a= get_lock("lock27563", 10);
+return 1;
+end|
+select get_lock("lock27563",10);
+get_lock("lock27563",10)
+1
+insert into t1 values (bug27563());
+ERROR 70100: Query execution was interrupted
+select @a;
+@a
+NULL
+select * from t1;
+f1
+insert into t1 values(0);
+update t1 set f1= bug27563();
+ERROR 70100: Query execution was interrupted
+select @a;
+@a
+NULL
+select * from t1;
+f1
+0
+insert into t1 values(1);
+delete from t1 where bug27563() is null;
+ERROR 70100: Query execution was interrupted
+select @a;
+@a
+NULL
+select * from t1;
+f1
+0
+1
+select * from t1 where f1= bug27563();
+ERROR 70100: Query execution was interrupted
+select @a;
+@a
+NULL
+create procedure proc27563()
+begin
+declare continue handler for sqlstate '70100' set @a:= 'killed';
+declare continue handler for sqlexception set @a:= 'exception';
+select get_lock("lock27563",10);
+select "shouldn't be selected";
+end|
+call proc27563();
+get_lock("lock27563",10)
+NULL
+ERROR 70100: Query execution was interrupted
+select @a;
+@a
+NULL
+create table t2 (f2 int);
+create trigger trg27563 before insert on t1 for each row
+begin
+declare continue handler for sqlstate '70100' set @a:= 'killed';
+declare continue handler for sqlexception set @a:= 'exception';
+set @a:= get_lock("lock27563",10);
+insert into t2 values(1);
+end|
+insert into t1 values(2),(3);
+ERROR 70100: Query execution was interrupted
+select @a;
+@a
+NULL
+select * from t1;
+f1
+0
+1
+select * from t2;
+f2
+select release_lock("lock27563");
+release_lock("lock27563")
+1
+drop table t1, t2;
+drop function bug27563;
+drop procedure proc27563;
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index 94f2f1f72b3..7fc29cd13ca 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -1780,4 +1780,30 @@ create table t3 (c1 int) engine=myisam pack_keys=default;
create table t4 (c1 int) engine=myisam pack_keys=2;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2' at line 1
drop table t1, t2, t3;
+CREATE TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM;
+INSERT INTO t1(a,b) VALUES (1,1),(2,2),(3,3),(4,4),(5,5);
+SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
+a
+1
+ALTER TABLE t1 DISABLE KEYS;
+SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
+a
+1
+SELECT a FROM t1 USE INDEX (inx) WHERE a=1;
+a
+1
+SELECT b FROM t1 FORCE INDEX (uinx) WHERE b=1;
+b
+1
+SELECT b FROM t1 USE INDEX (uinx) WHERE b=1;
+b
+1
+SELECT a FROM t1 FORCE INDEX (inx,uinx) WHERE a=1;
+a
+1
+ALTER TABLE t1 ENABLE KEYS;
+SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
+a
+1
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 6ccca713948..7865148905e 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -3310,5 +3310,16 @@ drop user user1;
drop user user2;
drop database mysqldump_test_db;
#
+# Bug #28522: buffer overrun by '\0' byte using --hex-blob.
+#
+CREATE TABLE t1 (c1 INT, c2 LONGBLOB);
+INSERT INTO t1 SET c1=11, c2=REPEAT('q',509);
+CREATE TABLE `t1` (
+ `c1` int(11) default NULL,
+ `c2` longblob
+);
+INSERT INTO `t1` VALUES (11,0x7171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171);
+DROP TABLE t1;
+#
# End of 5.0 tests
#
diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result
index abd98067dae..32ed34e1d52 100644
--- a/mysql-test/r/ps_2myisam.result
+++ b/mysql-test/r/ps_2myisam.result
@@ -1927,8 +1927,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -1974,8 +1974,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2024,8 +2024,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2064,8 +2064,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2112,8 +2112,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2156,8 +2156,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2202,8 +2202,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2240,8 +2240,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result
index b90cf996db4..c53056cfa0e 100644
--- a/mysql-test/r/ps_3innodb.result
+++ b/mysql-test/r/ps_3innodb.result
@@ -1910,8 +1910,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -1957,8 +1957,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2007,8 +2007,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2047,8 +2047,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2095,8 +2095,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2139,8 +2139,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2185,8 +2185,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2223,8 +2223,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result
index aed2fcea1ce..2951ce28fa5 100644
--- a/mysql-test/r/ps_4heap.result
+++ b/mysql-test/r/ps_4heap.result
@@ -1911,8 +1911,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -1958,8 +1958,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2008,8 +2008,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2048,8 +2048,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2096,8 +2096,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2140,8 +2140,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2186,8 +2186,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2224,8 +2224,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result
index ed85e4411aa..56ec1e04901 100644
--- a/mysql-test/r/ps_5merge.result
+++ b/mysql-test/r/ps_5merge.result
@@ -1847,8 +1847,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -1894,8 +1894,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -1944,8 +1944,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -1984,8 +1984,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2032,8 +2032,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2076,8 +2076,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2122,8 +2122,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2160,8 +2160,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -4868,8 +4868,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -4915,8 +4915,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -4965,8 +4965,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -5005,8 +5005,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -5053,8 +5053,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -5097,8 +5097,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -5143,8 +5143,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -5181,8 +5181,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result
index 3dc5859d304..ed774b202b2 100644
--- a/mysql-test/r/ps_6bdb.result
+++ b/mysql-test/r/ps_6bdb.result
@@ -1910,8 +1910,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -1957,8 +1957,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2007,8 +2007,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2047,8 +2047,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2095,8 +2095,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2139,8 +2139,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2185,8 +2185,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2223,8 +2223,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result
index 0df2733aa7a..ff5ecbb2e9b 100644
--- a/mysql-test/r/ps_7ndb.result
+++ b/mysql-test/r/ps_7ndb.result
@@ -1910,8 +1910,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -1957,8 +1957,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2007,8 +2007,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2047,8 +2047,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2095,8 +2095,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2139,8 +2139,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2185,8 +2185,8 @@ def @arg07 253 23 1 Y 128 31 63
def @arg08 253 23 1 Y 128 31 63
def @arg09 253 23 1 Y 128 31 63
def @arg10 253 23 1 Y 128 31 63
-def @arg11 253 67 6 Y 128 30 63
-def @arg12 253 67 6 Y 128 30 63
+def @arg11 253 83 6 Y 128 30 63
+def @arg12 253 83 6 Y 128 30 63
def @arg13 253 8192 10 Y 128 31 63
def @arg14 253 8192 19 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
@@ -2223,8 +2223,8 @@ def @arg07 253 23 0 Y 128 31 63
def @arg08 253 23 0 Y 128 31 63
def @arg09 253 23 0 Y 128 31 63
def @arg10 253 23 0 Y 128 31 63
-def @arg11 253 67 0 Y 128 30 63
-def @arg12 253 67 0 Y 128 30 63
+def @arg11 253 83 0 Y 128 30 63
+def @arg12 253 83 0 Y 128 30 63
def @arg13 253 8192 0 Y 128 31 63
def @arg14 253 8192 0 Y 128 31 63
def @arg15 253 8192 19 Y 128 31 63
diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result
index 9bbfdc6c5f9..098dacc8189 100644
--- a/mysql-test/r/subselect3.result
+++ b/mysql-test/r/subselect3.result
@@ -742,3 +742,21 @@ x
0
0
DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (a INT NOT NULL);
+INSERT INTO t1 VALUES (1),(-1), (65),(66);
+CREATE TABLE t2 (a INT UNSIGNED NOT NULL PRIMARY KEY);
+INSERT INTO t2 VALUES (65),(66);
+SELECT a FROM t1 WHERE a NOT IN (65,66);
+a
+1
+-1
+SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2);
+a
+1
+-1
+EXPLAIN SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
+2 DEPENDENT SUBQUERY t2 unique_subquery PRIMARY PRIMARY 4 func 1 Using index
+DROP TABLE t1;
+End of 5.0 tests
diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result
index cbcab126439..9e165721033 100644
--- a/mysql-test/r/type_newdecimal.result
+++ b/mysql-test/r/type_newdecimal.result
@@ -1465,4 +1465,10 @@ Error 1264 Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at r
Error 1264 Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at row 1
Error 1264 Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at row 1
Error 1264 Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at row 1
+create table t1 (s varchar(100));
+insert into t1 values (0.00000000010000000000000000364321973154977415791655470655996396089904010295867919921875);
+drop table t1;
+SELECT 1.000000000000 * 99.999999999998 / 100 a,1.000000000000 * (99.999999999998 / 100) b;
+a b
+0.9999999999999800000000000000 0.9999999999999800000000000000
End of 5.0 tests
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 8d9d802949d..13239af41ad 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -3367,4 +3367,14 @@ SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(1.23456789 as decimal(8,0)) AS `col`
DROP VIEW v1;
+CREATE TABLE t1 (id int);
+CREATE TABLE t2 (id int, c int DEFAULT 0);
+INSERT INTO t1 (id) VALUES (1);
+INSERT INTO t2 (id) VALUES (1);
+CREATE VIEW v1 AS
+SELECT t2.c FROM t1, t2
+WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+UPDATE v1 SET c=1;
+DROP VIEW v1;
+DROP TABLE t1,t2;
End of 5.0 tests.
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 83686f31e9e..3ced1087757 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -662,3 +662,25 @@ insert into t1 values (null);
select * from t1;
drop table t1;
+
+#
+# Bug#27507: Wrong DATETIME value was allowed by ALTER TABLE in the
+# NO_ZERO_DATE mode.
+#
+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');
+--error 1292
+alter table t1 add column f3 datetime not null;
+--error 1292
+alter table t1 add column f3 date not null;
+--error 1292
+alter table t1 add column f4 datetime not null default '2002-02-02',
+ add column f41 date not null;
+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;
+drop table t1;
+set sql_mode= @orig_sql_mode;
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index 7771f216f69..767df5ae233 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -520,5 +520,35 @@ SELECT GROUP_CONCAT( a ORDER BY b ) FROM t1;
SELECT GROUP_CONCAT( DISTINCT a ORDER BY b ) FROM t1;
SET group_concat_max_len = DEFAULT;
DROP TABLE t1;
+# Bug #23856:GROUP_CONCAT and ORDER BY: junk from previous rows for query on I_S
+#
+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;
+SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1;
+SELECT GROUP_CONCAT(DISTINCT a) FROM t1;
+SET group_concat_max_len= 10;
+SELECT GROUP_CONCAT(a ORDER BY b) FROM t1;
+SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1;
+SELECT GROUP_CONCAT(DISTINCT a) FROM t1;
+
+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;
+
+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 );
+SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 1;
+SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 2;
+SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 3;
+
+SET group_concat_max_len= DEFAULT;
+DROP TABLE t1, t2, t3;
--echo End of 5.0 tests
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index 51e79a20d65..1a59dbf8fc2 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -845,3 +845,19 @@ SELECT t1.id, a FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.b IS NULL;
show status like 'Handler_read%';
DROP TABLE t1,t2;
+
+#
+# Bug 28571: outer join with false on condition over constant tables
+#
+
+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;
+SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL;
+SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d<=>NULL;
+
+DROP TABLE t1,t2;
+
diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test
index e84b2071ab1..3d0e68dc0f3 100644
--- a/mysql-test/t/key.test
+++ b/mysql-test/t/key.test
@@ -432,3 +432,15 @@ ORDER BY c.b, c.d
;
DROP TABLE t1, t2;
+
+
+#
+# Bug #20604: Test for disabled keys with aggregate functions and FORCE INDEX.
+#
+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);
+DROP TABLE t1;
+
+--echo End of 5.0 tests.
diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test
index 1e99911a7e3..83194e214fb 100644
--- a/mysql-test/t/kill.test
+++ b/mysql-test/t/kill.test
@@ -117,3 +117,135 @@ reap;
select 1;
connection con1;
select RELEASE_LOCK("a");
+
+#
+# Bug#27563: Stored functions and triggers wasn't throwing an error when killed.
+#
+create table t1(f1 int);
+delimiter |;
+create function bug27563() returns int(11)
+deterministic
+begin
+ declare continue handler for sqlstate '70100' set @a:= 'killed';
+ declare continue handler for sqlexception set @a:= 'exception';
+ set @a= get_lock("lock27563", 10);
+ return 1;
+end|
+delimiter ;|
+# Test stored functions
+# Test INSERT
+connection con1;
+select get_lock("lock27563",10);
+connection con2;
+let $ID= `select connection_id()`;
+send insert into t1 values (bug27563());
+real_sleep 2;
+connection con1;
+disable_query_log;
+eval kill query $ID;
+enable_query_log;
+connection con2;
+--error 1317
+reap;
+select @a;
+connection con1;
+select * from t1;
+
+# Test UPDATE
+insert into t1 values(0);
+connection con2;
+send update t1 set f1= bug27563();
+real_sleep 2;
+connection con1;
+disable_query_log;
+eval kill query $ID;
+enable_query_log;
+connection con2;
+--error 1317
+reap;
+select @a;
+connection con1;
+select * from t1;
+
+# Test DELETE
+insert into t1 values(1);
+connection con2;
+send delete from t1 where bug27563() is null;
+real_sleep 2;
+connection con1;
+disable_query_log;
+eval kill query $ID;
+enable_query_log;
+connection con2;
+--error 1317
+reap;
+select @a;
+connection con1;
+select * from t1;
+
+# Test SELECT
+connection con2;
+send select * from t1 where f1= bug27563();
+real_sleep 2;
+connection con1;
+disable_query_log;
+eval kill query $ID;
+enable_query_log;
+connection con2;
+--error 1317
+reap;
+select @a;
+
+# Test PROCEDURE
+connection con2;
+delimiter |;
+create procedure proc27563()
+begin
+ declare continue handler for sqlstate '70100' set @a:= 'killed';
+ declare continue handler for sqlexception set @a:= 'exception';
+ select get_lock("lock27563",10);
+ select "shouldn't be selected";
+end|
+delimiter ;|
+send call proc27563();
+real_sleep 2;
+connection con1;
+disable_query_log;
+eval kill query $ID;
+enable_query_log;
+connection con2;
+--error 1317
+reap;
+select @a;
+
+# Test TRIGGERS
+connection con2;
+create table t2 (f2 int);
+delimiter |;
+create trigger trg27563 before insert on t1 for each row
+begin
+ declare continue handler for sqlstate '70100' set @a:= 'killed';
+ declare continue handler for sqlexception set @a:= 'exception';
+ set @a:= get_lock("lock27563",10);
+ insert into t2 values(1);
+end|
+delimiter ;|
+send insert into t1 values(2),(3);
+real_sleep 2;
+connection con1;
+disable_query_log;
+eval kill query $ID;
+enable_query_log;
+connection con2;
+--error 1317
+reap;
+select @a;
+connection con1;
+select * from t1;
+select * from t2;
+
+# Cleanup
+select release_lock("lock27563");
+drop table t1, t2;
+drop function bug27563;
+drop procedure proc27563;
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index 82d10059c65..12b9423be21 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -1145,4 +1145,20 @@ create table t3 (c1 int) engine=myisam pack_keys=default;
create table t4 (c1 int) engine=myisam pack_keys=2;
drop table t1, t2, t3;
+#
+# Bug#28476: force index on a disabled myisam index gives error 124
+#
+CREATE TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM;
+INSERT INTO t1(a,b) VALUES (1,1),(2,2),(3,3),(4,4),(5,5);
+SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
+ALTER TABLE t1 DISABLE KEYS;
+SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
+SELECT a FROM t1 USE INDEX (inx) WHERE a=1;
+SELECT b FROM t1 FORCE INDEX (uinx) WHERE b=1;
+SELECT b FROM t1 USE INDEX (uinx) WHERE b=1;
+SELECT a FROM t1 FORCE INDEX (inx,uinx) WHERE a=1;
+ALTER TABLE t1 ENABLE KEYS;
+SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 4c4690520c6..7df65f2b2e1 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -1528,7 +1528,14 @@ drop user user2;
drop database mysqldump_test_db;
+--echo #
+--echo # Bug #28522: buffer overrun by '\0' byte using --hex-blob.
+--echo #
+CREATE TABLE t1 (c1 INT, c2 LONGBLOB);
+INSERT INTO t1 SET c1=11, c2=REPEAT('q',509);
+--exec $MYSQL_DUMP --skip-create --compact --hex-blob test t1
+DROP TABLE t1;
--echo #
--echo # End of 5.0 tests
diff --git a/mysql-test/t/subselect3.test b/mysql-test/t/subselect3.test
index 65556012588..0302e2cede6 100644
--- a/mysql-test/t/subselect3.test
+++ b/mysql-test/t/subselect3.test
@@ -571,3 +571,21 @@ SELECT (t1.id IN (SELECT t2.id FROM t2,t3
FROM t1;
DROP TABLE t1,t2,t3;
+
+#
+# Bug #22855: Optimizer doesn't rewrite NOT IN subselects to a correlated
+# subquery
+#
+CREATE TABLE t1 (a INT NOT NULL);
+INSERT INTO t1 VALUES (1),(-1), (65),(66);
+
+CREATE TABLE t2 (a INT UNSIGNED NOT NULL PRIMARY KEY);
+INSERT INTO t2 VALUES (65),(66);
+
+SELECT a FROM t1 WHERE a NOT IN (65,66);
+SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2);
+EXPLAIN SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2);
+
+DROP TABLE t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test
index a7906be79d4..d2b808bd5e0 100644
--- a/mysql-test/t/type_newdecimal.test
+++ b/mysql-test/t/type_newdecimal.test
@@ -1149,4 +1149,17 @@ select cast(a as DECIMAL(3,2)), count(*)
UNION select 12.1234
) t group by 1;
+#
+# Bug #28361 Buffer overflow in DECIMAL code on Windows
+#
+
+create table t1 (s varchar(100));
+insert into t1 values (0.00000000010000000000000000364321973154977415791655470655996396089904010295867919921875);
+drop table t1;
+
+#
+# Bug #27984 Long Decimal Maths produces truncated results
+#
+
+SELECT 1.000000000000 * 99.999999999998 / 100 a,1.000000000000 * (99.999999999998 / 100) b;
--echo End of 5.0 tests
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 3275ba0a687..1f6bee8b142 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -3233,4 +3233,23 @@ CREATE VIEW v1 AS SELECT CAST(1.23456789 AS DECIMAL(8,0)) AS col;
SHOW CREATE VIEW v1;
DROP VIEW v1;
+#
+# Bug #28561: update on multi-table view with CHECK OPTION and
+# a subquery in WHERE condition
+#
+
+CREATE TABLE t1 (id int);
+CREATE TABLE t2 (id int, c int DEFAULT 0);
+INSERT INTO t1 (id) VALUES (1);
+INSERT INTO t2 (id) VALUES (1);
+
+CREATE VIEW v1 AS
+ SELECT t2.c FROM t1, t2
+ WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+
+UPDATE v1 SET c=1;
+
+DROP VIEW v1;
+DROP TABLE t1,t2;
+
--echo End of 5.0 tests.
diff --git a/sql/field.h b/sql/field.h
index 78aa12ad200..997ae1f2cd4 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1108,6 +1108,11 @@ public:
class Field_varstring :public Field_longstr {
public:
+ /*
+ The maximum space available in a Field_varstring, in bytes. See
+ length_bytes.
+ */
+ static const uint MAX_SIZE= UINT_MAX16;
/* Store number of bytes used to store length (1 or 2) */
uint32 length_bytes;
Field_varstring(char *ptr_arg,
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index 5670b1e0676..5c74ea9e49f 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -530,7 +530,21 @@ void Copy_field::set(char *to,Field *from)
}
+/*
+ To do:
+
+ If 'save\ is set to true and the 'from' is a blob field, do_copy is set to
+ do_save_blob rather than do_conv_blob. The only differences between them
+ appears to be:
+ - do_save_blob allocates and uses an intermediate buffer before calling
+ Field_blob::store. Is this in order to trigger the call to
+ well_formed_copy_nchars, by changing the pointer copy->tmp.ptr()?
+ That call will take place anyway in all known cases.
+
+ - The above causes a truncation to MAX_FIELD_WIDTH. Is this the intended
+ effect? Truncation is handled by well_formed_copy_nchars anyway.
+ */
void Copy_field::set(Field *to,Field *from,bool save)
{
if (to->type() == FIELD_TYPE_NULL)
diff --git a/sql/item_func.cc b/sql/item_func.cc
index af4e96af37b..34f3c2c6add 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -5347,6 +5347,8 @@ Item_func_sp::execute()
{
null_value= 1;
context->process_error(thd);
+ if (thd->killed)
+ thd->send_kill_message();
return TRUE;
}
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 48b82e3cde6..3f4ba16a18d 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -775,6 +775,11 @@ bool Item_in_subselect::val_bool()
if (exec())
{
reset();
+ /*
+ Must mark the IN predicate as NULL so as to make sure an enclosing NOT
+ predicate will return FALSE. See the comments in
+ subselect_uniquesubquery_engine::copy_ref_key for further details.
+ */
null_value= 1;
return 0;
}
@@ -1936,10 +1941,38 @@ int subselect_uniquesubquery_engine::scan_table()
DESCRIPTION
Copy ref key and check for null parts in it.
+ Depending on the nullability and conversion problems this function
+ recognizes and processes the following states :
+ 1. Partial match on top level. This means IN has a value of FALSE
+ regardless of the data in the subquery table.
+ Detected by finding a NULL in the left IN operand of a top level
+ expression.
+ We may actually skip reading the subquery, so return TRUE to skip
+ the table scan in subselect_uniquesubquery_engine::exec and make
+ the value of the IN predicate a NULL (that is equal to FALSE on
+ top level).
+ 2. No exact match when IN is nested inside another predicate.
+ Detected by finding a NULL in the left IN operand when IN is not
+ a top level predicate.
+ We cannot have an exact match. But we must proceed further with a
+ table scan to find out if it's a partial match (and IN has a value
+ of NULL) or no match (and IN has a value of FALSE).
+ So we return FALSE to continue with the scan and see if there are
+ any record that would constitute a partial match (as we cannot
+ determine that from the index).
+ 3. Error converting the left IN operand to the column type of the
+ right IN operand. This counts as no match (and IN has the value of
+ FALSE). We mark the subquery table cursor as having no more rows
+ (to ensure that the processing that follows will not find a match)
+ and return FALSE, so IN is not treated as returning NULL.
+
RETURN
- FALSE - ok, index lookup key without keys copied.
- TRUE - an error occured while copying the key
+ FALSE - The value of the IN predicate is not known. Proceed to find the
+ value of the IN predicate using the determined values of
+ null_keypart and table->status.
+ TRUE - IN predicate has a value of NULL. Stop the processing right there
+ and return NULL to the outer predicates.
*/
bool subselect_uniquesubquery_engine::copy_ref_key()
@@ -1959,13 +1992,37 @@ bool subselect_uniquesubquery_engine::copy_ref_key()
function.
*/
null_keypart= (*copy)->null_key;
- bool top_level= ((Item_in_subselect *) item)->is_top_level_item();
- if (null_keypart && !top_level)
- break;
- if ((tab->ref.key_err) & 1 || (null_keypart && top_level))
+ if (null_keypart)
+ {
+ bool top_level= ((Item_in_subselect *) item)->is_top_level_item();
+ if (top_level)
+ {
+ /* Partial match on top level */
+ DBUG_RETURN(1);
+ }
+ else
+ {
+ /* No exact match when IN is nested inside another predicate */
+ break;
+ }
+ }
+
+ /*
+ Check if the error is equal to STORE_KEY_FATAL. This is not expressed
+ using the store_key::store_key_result enum because ref.key_err is a
+ boolean and we want to detect both TRUE and STORE_KEY_FATAL from the
+ space of the union of the values of [TRUE, FALSE] and
+ store_key::store_key_result.
+ TODO: fix the variable an return types.
+ */
+ if (tab->ref.key_err & 1)
{
+ /*
+ Error converting the left IN operand to the column type of the right
+ IN operand.
+ */
tab->table->status= STATUS_NOT_FOUND;
- DBUG_RETURN(1);
+ break;
}
}
DBUG_RETURN(0);
@@ -2008,10 +2065,20 @@ int subselect_uniquesubquery_engine::exec()
int error;
TABLE *table= tab->table;
empty_result_set= TRUE;
+ table->status= 0;
/* TODO: change to use of 'full_scan' here? */
if (copy_ref_key())
DBUG_RETURN(1);
+ if (table->status)
+ {
+ /*
+ We know that there will be no rows even if we scan.
+ Can be set in copy_ref_key.
+ */
+ ((Item_in_subselect *) item)->value= 0;
+ DBUG_RETURN(0);
+ }
if (null_keypart)
DBUG_RETURN(scan_table());
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index d6b31d43389..ea2a14ffb63 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -432,7 +432,7 @@ Field *Item_sum::create_tmp_field(bool group, TABLE *table,
2-byte lenght.
*/
if (max_length/collation.collation->mbmaxlen > 255 &&
- convert_blob_length < UINT_MAX16 && convert_blob_length)
+ convert_blob_length <= Field_varstring::MAX_SIZE && convert_blob_length)
return new Field_varstring(convert_blob_length, maybe_null,
name, table,
collation.collation);
@@ -3269,14 +3269,20 @@ bool Item_func_group_concat::setup(THD *thd)
tmp_table_param->force_copy_fields= force_copy_fields;
DBUG_ASSERT(table == 0);
/*
+ Currently we have to force conversion of BLOB values to VARCHAR's
+ if we are to store them in TREE objects used for ORDER BY and
+ DISTINCT. This leads to truncation if the BLOB's size exceeds
+ Field_varstring::MAX_SIZE.
+ */
+ if (arg_count_order > 0 || distinct)
+ set_if_smaller(tmp_table_param->convert_blob_length,
+ Field_varstring::MAX_SIZE);
+ /*
We have to create a temporary table to get descriptions of fields
(types, sizes and so on).
Note that in the table, we first have the ORDER BY fields, then the
field list.
-
- We need to set set_sum_field in true for storing value of blob in buffer
- of a record instead of a pointer of one.
*/
if (!(table= create_tmp_table(thd, tmp_table_param, all_fields,
(ORDER*) 0, 0, TRUE,
diff --git a/sql/my_decimal.h b/sql/my_decimal.h
index 2de8b9add11..c661579ea66 100644
--- a/sql/my_decimal.h
+++ b/sql/my_decimal.h
@@ -36,13 +36,17 @@ C_MODE_END
/* maximum length of buffer in our big digits (uint32) */
#define DECIMAL_BUFF_LENGTH 9
+
+/* the number of digits that my_decimal can possibly contain */
+#define DECIMAL_MAX_POSSIBLE_PRECISION (DECIMAL_BUFF_LENGTH * 9)
+
/*
maximum guaranteed precision of number in decimal digits (number of our
digits * number of decimal digits in one our big digit - number of decimal
- digits in one our big digit decreased on 1 (because we always put decimal
+ digits in one our big digit decreased by 1 (because we always put decimal
point on the border of our big digits))
*/
-#define DECIMAL_MAX_PRECISION ((DECIMAL_BUFF_LENGTH * 9) - 8*2)
+#define DECIMAL_MAX_PRECISION (DECIMAL_MAX_POSSIBLE_PRECISION - 8*2)
#define DECIMAL_MAX_SCALE 30
#define DECIMAL_NOT_SPECIFIED 31
@@ -50,7 +54,7 @@ C_MODE_END
maximum length of string representation (number of maximum decimal
digits + 1 position for sign + 1 position for decimal point)
*/
-#define DECIMAL_MAX_STR_LENGTH (DECIMAL_MAX_PRECISION + 2)
+#define DECIMAL_MAX_STR_LENGTH (DECIMAL_MAX_POSSIBLE_PRECISION + 2)
/*
maximum size of packet length
*/
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 835d8bf038f..a3c3566926a 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1321,6 +1321,9 @@ err_with_cleanup:
free_root(&call_mem_root, MYF(0));
thd->spcont= octx;
+ if (thd->killed)
+ thd->send_kill_message();
+
DBUG_RETURN(err_status);
}
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 16a88346bb6..999a05ca616 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -5167,7 +5167,12 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
get_key_map_from_key_list(&map, table, table_list->use_index);
if (map.is_set_all())
DBUG_RETURN(1);
- table->keys_in_use_for_query=map;
+ /*
+ Don't introduce keys in keys_in_use_for_query that weren't there
+ before. FORCE/USE INDEX should not add keys, it should only remove
+ all keys except the key(s) specified in the hint.
+ */
+ table->keys_in_use_for_query.intersect(map);
}
if (table_list->ignore_index)
{
@@ -5800,7 +5805,7 @@ fill_record(THD *thd, Field **ptr, List<Item> &values, bool ignore_errors)
table= (*ptr)->table;
table->auto_increment_field_not_null= FALSE;
}
- while ((field = *ptr++))
+ while ((field = *ptr++) && !thd->net.report_error)
{
value=v++;
table= field->table;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index ea59cbbe9f2..57dff4b23a5 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -5666,28 +5666,6 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
join->const_table_map,
(table_map) 0);
DBUG_EXECUTE("where",print_where(const_cond,"constants"););
- for (JOIN_TAB *tab= join->join_tab+join->const_tables;
- tab < join->join_tab+join->tables ; tab++)
- {
- if (*tab->on_expr_ref)
- {
- JOIN_TAB *cond_tab= tab->first_inner;
- COND *tmp= make_cond_for_table(*tab->on_expr_ref,
- join->const_table_map,
- ( table_map) 0);
- if (!tmp)
- continue;
- tmp= new Item_func_trig_cond(tmp, &cond_tab->not_null_compl);
- if (!tmp)
- DBUG_RETURN(1);
- tmp->quick_fix_field();
- cond_tab->select_cond= !cond_tab->select_cond ? tmp :
- new Item_cond_and(cond_tab->select_cond,tmp);
- if (!cond_tab->select_cond)
- DBUG_RETURN(1);
- cond_tab->select_cond->quick_fix_field();
- }
- }
if (const_cond && !const_cond->val_int())
{
DBUG_PRINT("info",("Found impossible WHERE condition"));
@@ -5918,13 +5896,39 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
}
/*
- Push down all predicates from on expressions.
- Each of these predicated are guarded by a variable
+ Push down conditions from all on expressions.
+ Each of these conditions are guarded by a variable
that turns if off just before null complemented row for
- outer joins is formed. Thus, the predicates from an
+ outer joins is formed. Thus, the condition from an
'on expression' are guaranteed not to be checked for
the null complemented row.
*/
+
+ /* First push down constant conditions from on expressions */
+ for (JOIN_TAB *join_tab= join->join_tab+join->const_tables;
+ join_tab < join->join_tab+join->tables ; join_tab++)
+ {
+ if (*join_tab->on_expr_ref)
+ {
+ JOIN_TAB *cond_tab= join_tab->first_inner;
+ COND *tmp= make_cond_for_table(*join_tab->on_expr_ref,
+ join->const_table_map,
+ (table_map) 0);
+ if (!tmp)
+ continue;
+ tmp= new Item_func_trig_cond(tmp, &cond_tab->not_null_compl);
+ if (!tmp)
+ DBUG_RETURN(1);
+ tmp->quick_fix_field();
+ cond_tab->select_cond= !cond_tab->select_cond ? tmp :
+ new Item_cond_and(cond_tab->select_cond,tmp);
+ if (!cond_tab->select_cond)
+ DBUG_RETURN(1);
+ cond_tab->select_cond->quick_fix_field();
+ }
+ }
+
+ /* Push down non-constant conditions from on expressions */
JOIN_TAB *last_tab= tab;
while (first_inner_tab && first_inner_tab->last_inner == last_tab)
{
@@ -6375,7 +6379,6 @@ void JOIN::cleanup(bool full)
for (tab= join_tab, end= tab+tables; tab != end; tab++)
tab->cleanup();
table= 0;
- tables= 0;
}
else
{
@@ -8800,7 +8803,7 @@ Field* create_tmp_field_from_field(THD *thd, Field* org_field,
Make sure that the blob fits into a Field_varstring which has
2-byte lenght.
*/
- if (convert_blob_length && convert_blob_length < UINT_MAX16 &&
+ if (convert_blob_length && convert_blob_length <= Field_varstring::MAX_SIZE &&
(org_field->flags & BLOB_FLAG))
new_field= new Field_varstring(convert_blob_length,
org_field->maybe_null(),
@@ -8891,7 +8894,8 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
2-byte lenght.
*/
else if (item->max_length/item->collation.collation->mbmaxlen > 255 &&
- convert_blob_length < UINT_MAX16 && convert_blob_length)
+ convert_blob_length <= Field_varstring::MAX_SIZE &&
+ convert_blob_length)
new_field= new Field_varstring(convert_blob_length, maybe_null,
item->name, table,
item->collation.collation);
@@ -12246,10 +12250,11 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
LINT_INIT(ref_key_parts);
/*
- Check which keys can be used to resolve ORDER BY.
- We must not try to use disabled keys.
+ Keys disabled by ALTER TABLE ... DISABLE KEYS should have already
+ been taken into account.
*/
- usable_keys= table->s->keys_in_use;
+ usable_keys= table->keys_in_use_for_query;
+ DBUG_ASSERT(usable_keys.is_subset(table->s->keys_in_use));
for (ORDER *tmp_order=order; tmp_order ; tmp_order=tmp_order->next)
{
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 079cc0d6456..a8ed2a53601 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -37,7 +37,8 @@ static int copy_data_between_tables(TABLE *from,TABLE *to,
List<create_field> &create, bool ignore,
uint order_num, ORDER *order,
ha_rows *copied,ha_rows *deleted,
- enum enum_enable_or_disable keys_onoff);
+ enum enum_enable_or_disable keys_onoff,
+ bool error_if_not_empty);
static bool prepare_blob_field(THD *thd, create_field *sql_field);
static bool check_engine(THD *thd, const char *table_name,
@@ -3077,6 +3078,16 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
bool need_copy_table;
bool no_table_reopen= FALSE, varchar= FALSE;
frm_type_enum frm_type;
+ /*
+ Throw an error if the table to be altered isn't empty.
+ Used in DATE/DATETIME fields default value checking.
+ */
+ bool error_if_not_empty= FALSE;
+ /*
+ A field used for error reporting in DATE/DATETIME fields default
+ value checking.
+ */
+ create_field *new_datetime_field= 0;
DBUG_ENTER("mysql_alter_table");
thd->proc_info="init";
@@ -3445,6 +3456,22 @@ view_err:
my_error(ER_BAD_FIELD_ERROR, MYF(0), def->change, table_name);
DBUG_RETURN(TRUE);
}
+ /*
+ Check that the DATE/DATETIME not null field we are going to add is
+ either has a default value or the '0000-00-00' is allowed by the
+ set sql mode.
+ If the '0000-00-00' value isn't allowed then raise the error_if_not_empty
+ flag to allow ALTER TABLE only if the table to be altered is empty.
+ */
+ if ((def->sql_type == MYSQL_TYPE_DATE ||
+ def->sql_type == MYSQL_TYPE_NEWDATE ||
+ def->sql_type == MYSQL_TYPE_DATETIME) && !new_datetime_field &&
+ !(~def->flags & (NO_DEFAULT_VALUE_FLAG | NOT_NULL_FLAG)) &&
+ thd->variables.sql_mode & MODE_NO_ZERO_DATE)
+ {
+ new_datetime_field= def;
+ error_if_not_empty= TRUE;
+ }
if (!def->after)
new_info.create_list.push_back(def);
else if (def->after == first_keyword)
@@ -3765,7 +3792,8 @@ view_err:
new_table->next_number_field=new_table->found_next_number_field;
error= copy_data_between_tables(table, new_table, new_info.create_list,
ignore, order_num, order,
- &copied, &deleted, alter_info->keys_onoff);
+ &copied, &deleted, alter_info->keys_onoff,
+ error_if_not_empty);
}
else if (!new_table)
{
@@ -3999,6 +4027,37 @@ end_temporary:
DBUG_RETURN(FALSE);
err:
+ /*
+ No default value was provided for a DATE/DATETIME field, the
+ current sql_mode doesn't allow the '0000-00-00' value and
+ the table to be altered isn't empty.
+ Report error here.
+ */
+ if (error_if_not_empty && thd->row_count)
+ {
+ const char *f_val= 0;
+ enum enum_mysql_timestamp_type t_type= MYSQL_TIMESTAMP_DATE;
+ switch (new_datetime_field->sql_type)
+ {
+ case MYSQL_TYPE_DATE:
+ case MYSQL_TYPE_NEWDATE:
+ f_val= "0000-00-00";
+ t_type= MYSQL_TIMESTAMP_DATE;
+ break;
+ case MYSQL_TYPE_DATETIME:
+ f_val= "0000-00-00 00:00:00";
+ t_type= MYSQL_TIMESTAMP_DATETIME;
+ break;
+ default:
+ /* Shouldn't get here. */
+ DBUG_ASSERT(0);
+ }
+ bool save_abort_on_warning= thd->abort_on_warning;
+ thd->abort_on_warning= TRUE;
+ make_truncated_value_warning(thd, f_val, strlength(f_val), t_type,
+ new_datetime_field->field_name);
+ thd->abort_on_warning= save_abort_on_warning;
+ }
DBUG_RETURN(TRUE);
}
@@ -4010,7 +4069,8 @@ copy_data_between_tables(TABLE *from,TABLE *to,
uint order_num, ORDER *order,
ha_rows *copied,
ha_rows *deleted,
- enum enum_enable_or_disable keys_onoff)
+ enum enum_enable_or_disable keys_onoff,
+ bool error_if_not_empty)
{
int error;
Copy_field *copy,*copy_end;
@@ -4125,6 +4185,12 @@ copy_data_between_tables(TABLE *from,TABLE *to,
break;
}
thd->row_count++;
+ /* Return error if source table isn't empty. */
+ if (error_if_not_empty)
+ {
+ error= 1;
+ break;
+ }
if (to->next_number_field)
{
if (auto_increment_field_copied)
diff --git a/sql/table.h b/sql/table.h
index da2c90ab212..952b575c00e 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -137,7 +137,12 @@ typedef struct st_table_share
const char *table_name; /* Table name (for open) */
const char *path; /* Path to .frm file (from datadir) */
LEX_STRING connect_string;
- key_map keys_in_use; /* Keys in use for table */
+
+ /*
+ Set of keys in use, implemented as a Bitmap.
+ Excludes keys disabled by ALTER TABLE ... DISABLE KEYS.
+ */
+ key_map keys_in_use;
key_map keys_for_keyread;
ulong avg_row_length; /* create information */
ulong raid_chunksize;
@@ -208,7 +213,21 @@ struct st_table {
byte *record[2]; /* Pointer to records */
byte *insert_values; /* used by INSERT ... UPDATE */
- key_map quick_keys, used_keys, keys_in_use_for_query;
+ key_map quick_keys, used_keys;
+
+ /*
+ A set of keys that can be used in the query that references this
+ table
+
+ All indexes disabled on the table's TABLE_SHARE (see TABLE::s) will be
+ subtracted from this set upon instantiation. Thus for any TABLE t it holds
+ that t.keys_in_use_for_query is a subset of t.s.keys_in_use. Generally we
+ must not introduce any new keys here (see setup_tables).
+
+ The set is implemented as a bitmap.
+ */
+ key_map keys_in_use_for_query;
+ key_map merge_keys;
KEY *key_info; /* data of keys in database */
Field *next_number_field, /* Set if next_number is activated */
diff --git a/strings/decimal.c b/strings/decimal.c
index 1ae75167794..f1f02f3a071 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -1517,9 +1517,10 @@ decimal_round(decimal_t *from, decimal_t *to, int scale,
dec1 *p0= buf0+intg0+max(frac1, frac0);
dec1 *p1= buf1+intg1+max(frac1, frac0);
- to->buf[0]= 0;
while (buf0 < p0)
*(--p1) = *(--p0);
+ if (unlikely(intg1 > intg0))
+ to->buf[0]= 0;
intg0= intg1;
buf0=to->buf;