List:Commits« Previous MessageNext Message »
From:He Zhenxing Date:March 9 2009 8:42am
Subject:bzr commit into mysql-5.1-bugteam branch (zhenxing.he:2837) Bug#37416
Bug#39843 Bug#40363 Bug#40657 Bug#41305 Bug#41465 Bug#42790
View as plain text  
#At file:///media/sdb2/hezx/work/mysql/bzrwork/b22082/5.1-bugteam/

 2837 He Zhenxing	2009-03-09 [merge]
      Auto merge
modified:
  mysql-test/r/lock.result
  mysql-test/r/merge.result
  mysql-test/r/ps.result
  mysql-test/r/strict.result
  mysql-test/r/variables.result
  mysql-test/suite/sys_vars/r/auto_increment_increment_basic.result
  mysql-test/suite/sys_vars/r/auto_increment_increment_func.result
  mysql-test/suite/sys_vars/r/auto_increment_offset_basic.result
  mysql-test/suite/sys_vars/r/auto_increment_offset_func.result
  mysql-test/suite/sys_vars/r/concurrent_insert_basic.result
  mysql-test/suite/sys_vars/r/connect_timeout_basic.result
  mysql-test/suite/sys_vars/r/default_week_format_basic.result
  mysql-test/suite/sys_vars/r/delayed_insert_timeout_basic.result
  mysql-test/suite/sys_vars/r/div_precision_increment_basic.result
  mysql-test/suite/sys_vars/r/expire_logs_days_basic.result
  mysql-test/suite/sys_vars/r/group_concat_max_len_basic.result
  mysql-test/suite/sys_vars/r/interactive_timeout_basic.result
  mysql-test/suite/sys_vars/r/max_allowed_packet_basic.result
  mysql-test/suite/sys_vars/r/max_binlog_size_basic.result
  mysql-test/suite/sys_vars/r/max_connections_basic.result
  mysql-test/suite/sys_vars/r/max_delayed_threads_basic.result
  mysql-test/suite/sys_vars/r/max_error_count_basic.result
  mysql-test/suite/sys_vars/r/max_insert_delayed_threads_basic.result
  mysql-test/suite/sys_vars/r/max_length_for_sort_data_basic.result
  mysql-test/suite/sys_vars/r/max_prepared_stmt_count_basic.result
  mysql-test/suite/sys_vars/r/max_relay_log_size_basic.result
  mysql-test/suite/sys_vars/r/max_sort_length_basic.result
  mysql-test/suite/sys_vars/r/max_sp_recursion_depth_basic.result
  mysql-test/suite/sys_vars/r/myisam_data_pointer_size_basic.result
  mysql-test/suite/sys_vars/r/net_buffer_length_basic.result
  mysql-test/suite/sys_vars/r/net_read_timeout_basic.result
  mysql-test/suite/sys_vars/r/net_write_timeout_basic.result
  mysql-test/suite/sys_vars/r/optimizer_prune_level_basic.result
  mysql-test/suite/sys_vars/r/optimizer_search_depth_basic.result
  mysql-test/suite/sys_vars/r/preload_buffer_size_basic.result
  mysql-test/suite/sys_vars/r/read_buffer_size_basic.result
  mysql-test/suite/sys_vars/r/read_rnd_buffer_size_basic.result
  mysql-test/suite/sys_vars/r/slave_net_timeout_basic.result
  mysql-test/suite/sys_vars/r/slow_launch_time_basic.result
  mysql-test/suite/sys_vars/r/table_definition_cache_basic.result
  mysql-test/suite/sys_vars/r/table_lock_wait_timeout_basic.result
  mysql-test/suite/sys_vars/r/table_open_cache_basic.result
  mysql-test/t/lock.test
  mysql-test/t/merge.test
  mysql-test/t/strict.test
  mysql-test/t/variables.test
  sql/log.cc
  sql/mysqld.cc
  sql/set_var.cc
  sql/share/errmsg.txt
  sql/sql_cache.cc
  sql/sql_lex.cc
  sql/sql_lex.h
  sql/sql_parse.cc
  sql/sql_yacc.yy
  sql/unireg.cc
  storage/myisammrg/ha_myisammrg.cc

=== modified file 'mysql-test/r/lock.result'
--- a/mysql-test/r/lock.result	2007-08-02 09:59:02 +0000
+++ b/mysql-test/r/lock.result	2009-03-05 14:22:33 +0000
@@ -166,4 +166,31 @@ ERROR HY000: View's SELECT refers to a t
 Cleanup.
 
 drop table t2, t3;
+#
+# Bug#39843 DELETE requires write access to table in subquery in where clause
+#
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (
+table1_rowid SMALLINT NOT NULL
+);
+CREATE TABLE t2 (
+table2_rowid SMALLINT NOT NULL
+);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+LOCK TABLES t1 WRITE, t2 READ;
+# Sub-select should not try to aquire a write lock.
+DELETE FROM t1 
+WHERE EXISTS 
+( 
+SELECT 'x' 
+FROM t2
+WHERE t1.table1_rowid = t2.table2_rowid
+) ;
+# While implementing the patch we didn't break old behavior;
+# The following sub-select should still requires a write lock:
+SELECT * FROM t1 WHERE 1 IN (SELECT * FROM t2 FOR UPDATE);
+ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
+UNLOCK TABLES;
+DROP TABLE t1,t2;
 End of 5.1 tests.

=== modified file 'mysql-test/r/merge.result'
--- a/mysql-test/r/merge.result	2009-02-12 10:25:12 +0000
+++ b/mysql-test/r/merge.result	2009-03-04 09:18:07 +0000
@@ -2103,4 +2103,16 @@ a
 UNLOCK TABLES;
 # drop the created tables
 DROP TABLE t1, t2, t3;
+# insert duplicate value in child table while merge table doesn't have key
+create table t1 (
+col1 int(10),
+primary key (col1)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+CREATE TABLE m1 (
+col1 int(10) NOT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(t1);
+insert into m1 (col1) values (1);
+insert into m1 (col1) values (1);
+ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
+drop table m1, t1;
 End of 5.1 tests

=== modified file 'mysql-test/r/ps.result'
--- a/mysql-test/r/ps.result	2009-03-03 00:11:25 +0000
+++ b/mysql-test/r/ps.result	2009-03-06 15:11:34 +0000
@@ -803,6 +803,8 @@ select @@max_prepared_stmt_count;
 @@max_prepared_stmt_count
 16382
 set global max_prepared_stmt_count=-1;
+Warnings:
+Warning	1292	Truncated incorrect max_prepared_stmt_count value: '-1'
 select @@max_prepared_stmt_count;
 @@max_prepared_stmt_count
 0

=== modified file 'mysql-test/r/strict.result'
--- a/mysql-test/r/strict.result	2008-12-01 04:17:52 +0000
+++ b/mysql-test/r/strict.result	2009-03-05 11:20:01 +0000
@@ -1305,7 +1305,7 @@ set @@sql_mode='traditional';
 create table t1 (i int)
 comment '123456789*123456789*123456789*123456789*123456789*
          123456789*123456789*123456789*123456789*123456789*';
-ERROR HY000: Too long comment for table 't1'
+ERROR HY000: Comment for table 't1' is too long (max = 60)
 create table t1 (
 i int comment
 '123456789*123456789*123456789*123456789*
@@ -1315,7 +1315,7 @@ i int comment
  123456789*123456789*123456789*123456789*
  123456789*123456789*123456789*123456789*
  123456789*123456789*123456789*123456789*');
-ERROR HY000: Too long comment for field 'i'
+ERROR HY000: Comment for field 'i' is too long (max = 255)
 set @@sql_mode= @org_mode;
 create table t1
 (i int comment
@@ -1327,7 +1327,7 @@ create table t1
   123456789*123456789*123456789*123456789*
   123456789*123456789*123456789*123456789*');
 Warnings:
-Warning	1105	Unknown error
+Warning	1629	Comment for field 'i' is too long (max = 255)
 select column_name, column_comment from information_schema.columns where
 table_schema = 'test' and table_name = 't1';
 column_name	column_comment

=== modified file 'mysql-test/r/variables.result'
--- a/mysql-test/r/variables.result	2009-03-05 11:34:02 +0000
+++ b/mysql-test/r/variables.result	2009-03-06 15:11:34 +0000
@@ -753,7 +753,7 @@ VARIABLE_NAME	VARIABLE_VALUE
 MYISAM_DATA_POINTER_SIZE	7
 SET GLOBAL table_open_cache=-1;
 Warnings:
-Warning	1292	Truncated incorrect table_open_cache value: '0'
+Warning	1292	Truncated incorrect table_open_cache value: '-1'
 SHOW VARIABLES LIKE 'table_open_cache';
 Variable_name	Value
 table_open_cache	1
@@ -1389,8 +1389,41 @@ SET @@session.thread_stack= 7;
 ERROR HY000: Variable 'thread_stack' is a read only variable
 SET @@global.thread_stack= 7;
 ERROR HY000: Variable 'thread_stack' is a read only variable
+SELECT @@global.expire_logs_days INTO @old_eld;
+SET GLOBAL expire_logs_days = -1;
+Warnings:
+Warning	1292	Truncated incorrect expire_logs_days value: '-1'
+needs to've been adjusted (0)
+SELECT @@global.expire_logs_days;
+@@global.expire_logs_days
+0
+SET GLOBAL expire_logs_days = 11;
+SET @old_mode=@@sql_mode;
+SET SESSION sql_mode = 'TRADITIONAL';
+SET GLOBAL expire_logs_days = 100;
+ERROR 42000: Variable 'expire_logs_days' can't be set to the value of '100'
+needs to be unchanged (11)
+SELECT @@global.expire_logs_days;
+@@global.expire_logs_days
+11
+SET SESSION sql_mode = @old_mode;
+SET GLOBAL expire_logs_days = 100;
+Warnings:
+Warning	1292	Truncated incorrect expire_logs_days value: '100'
+needs to've been adjusted (99)
+SELECT @@global.expire_logs_days;
+@@global.expire_logs_days
+99
+SET GLOBAL expire_logs_days = 11;
+SET GLOBAL expire_logs_days = 99;
+needs to pass with no warnings (99)
+SELECT @@global.expire_logs_days;
+@@global.expire_logs_days
+99
+SET GLOBAL expire_logs_days = @old_eld;
 select @@storage_engine;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
 def					@@storage_engine	253	6	6	N	1	31	8
 @@storage_engine
 MyISAM
+End of 5.1 tests

=== modified file 'mysql-test/suite/sys_vars/r/auto_increment_increment_basic.result'
--- a/mysql-test/suite/sys_vars/r/auto_increment_increment_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/auto_increment_increment_basic.result	2009-02-27 20:43:43 +0000
@@ -61,7 +61,7 @@ SELECT @@global.auto_increment_increment
 1
 SET @@global.auto_increment_increment = -1024;
 Warnings:
-Warning	1292	Truncated incorrect auto-increment-increment value: '0'
+Warning	1292	Truncated incorrect auto_increment_increment value: '-1024'
 SELECT @@global.auto_increment_increment;
 @@global.auto_increment_increment
 1
@@ -89,7 +89,7 @@ SELECT @@session.auto_increment_incremen
 1
 SET @@session.auto_increment_increment = -2;
 Warnings:
-Warning	1292	Truncated incorrect auto-increment-increment value: '0'
+Warning	1292	Truncated incorrect auto_increment_increment value: '-2'
 SELECT @@session.auto_increment_increment;
 @@session.auto_increment_increment
 1

=== modified file 'mysql-test/suite/sys_vars/r/auto_increment_increment_func.result'
--- a/mysql-test/suite/sys_vars/r/auto_increment_increment_func.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/auto_increment_increment_func.result	2009-02-27 20:43:43 +0000
@@ -169,7 +169,7 @@ id	name
 ## Verifying behavior of variable with negative value ##
 SET @@auto_increment_increment = -10;
 Warnings:
-Warning	1292	Truncated incorrect auto-increment-increment value: '0'
+Warning	1292	Truncated incorrect auto_increment_increment value: '-10'
 INSERT into t1(name) values('Record_17');
 INSERT into t1(name) values('Record_18');
 SELECT * from t1;

=== modified file 'mysql-test/suite/sys_vars/r/auto_increment_offset_basic.result'
--- a/mysql-test/suite/sys_vars/r/auto_increment_offset_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/auto_increment_offset_basic.result	2009-02-27 20:43:43 +0000
@@ -61,7 +61,7 @@ SELECT @@global.auto_increment_offset;
 1
 SET @@global.auto_increment_offset = -1024;
 Warnings:
-Warning	1292	Truncated incorrect auto-increment-offset value: '0'
+Warning	1292	Truncated incorrect auto_increment_offset value: '-1024'
 SELECT @@global.auto_increment_offset;
 @@global.auto_increment_offset
 1
@@ -94,7 +94,7 @@ SELECT @@session.auto_increment_offset;
 1
 SET @@session.auto_increment_offset = -2;
 Warnings:
-Warning	1292	Truncated incorrect auto-increment-offset value: '0'
+Warning	1292	Truncated incorrect auto_increment_offset value: '-2'
 SELECT @@session.auto_increment_offset;
 @@session.auto_increment_offset
 1

=== modified file 'mysql-test/suite/sys_vars/r/auto_increment_offset_func.result'
--- a/mysql-test/suite/sys_vars/r/auto_increment_offset_func.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/auto_increment_offset_func.result	2009-02-27 20:43:43 +0000
@@ -178,7 +178,7 @@ id	name
 ## Assigning -ve value to variable ## 
 SET @@auto_increment_offset = -10;
 Warnings:
-Warning	1292	Truncated incorrect auto-increment-offset value: '0'
+Warning	1292	Truncated incorrect auto_increment_offset value: '-10'
 SELECT @@auto_increment_offset = -10;
 @@auto_increment_offset = -10
 0

=== modified file 'mysql-test/suite/sys_vars/r/concurrent_insert_basic.result'
--- a/mysql-test/suite/sys_vars/r/concurrent_insert_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/concurrent_insert_basic.result	2009-02-27 20:43:43 +0000
@@ -28,6 +28,8 @@ SELECT @@global.concurrent_insert;
 2
 '#--------------------FN_DYNVARS_018_04-------------------------#'
 SET @@global.concurrent_insert = -1;
+Warnings:
+Warning	1292	Truncated incorrect concurrent_insert value: '-1'
 Select @@global.concurrent_insert;
 @@global.concurrent_insert
 0

=== modified file 'mysql-test/suite/sys_vars/r/connect_timeout_basic.result'
--- a/mysql-test/suite/sys_vars/r/connect_timeout_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/connect_timeout_basic.result	2009-02-27 20:43:43 +0000
@@ -35,7 +35,7 @@ SELECT @@global.connect_timeout;
 2
 SET @@global.connect_timeout = -1024;
 Warnings:
-Warning	1292	Truncated incorrect connect_timeout value: '0'
+Warning	1292	Truncated incorrect connect_timeout value: '-1024'
 SELECT @@global.connect_timeout;
 @@global.connect_timeout
 2

=== modified file 'mysql-test/suite/sys_vars/r/default_week_format_basic.result'
--- a/mysql-test/suite/sys_vars/r/default_week_format_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/default_week_format_basic.result	2009-02-27 20:43:43 +0000
@@ -64,6 +64,8 @@ SELECT @@global.default_week_format;
 @@global.default_week_format
 7
 SET @@global.default_week_format = -1024;
+Warnings:
+Warning	1292	Truncated incorrect default_week_format value: '-1024'
 SELECT @@global.default_week_format;
 @@global.default_week_format
 0
@@ -100,6 +102,8 @@ SELECT @@session.default_week_format;
 @@session.default_week_format
 7
 SET @@session.default_week_format = -2;
+Warnings:
+Warning	1292	Truncated incorrect default_week_format value: '-2'
 SELECT @@session.default_week_format;
 @@session.default_week_format
 0

=== modified file 'mysql-test/suite/sys_vars/r/delayed_insert_timeout_basic.result'
--- a/mysql-test/suite/sys_vars/r/delayed_insert_timeout_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/delayed_insert_timeout_basic.result	2009-02-27 20:43:43 +0000
@@ -35,7 +35,7 @@ SELECT @@global.delayed_insert_timeout;
 1
 SET @@global.delayed_insert_timeout = -1024;
 Warnings:
-Warning	1292	Truncated incorrect delayed_insert_timeout value: '0'
+Warning	1292	Truncated incorrect delayed_insert_timeout value: '-1024'
 SELECT @@global.delayed_insert_timeout;
 @@global.delayed_insert_timeout
 1

=== modified file 'mysql-test/suite/sys_vars/r/div_precision_increment_basic.result'
--- a/mysql-test/suite/sys_vars/r/div_precision_increment_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/div_precision_increment_basic.result	2009-02-27 20:43:43 +0000
@@ -78,6 +78,8 @@ SELECT @@global.div_precision_increment;
 @@global.div_precision_increment
 30
 SET @@global.div_precision_increment = -1024;
+Warnings:
+Warning	1292	Truncated incorrect div_precision_increment value: '-1024'
 SELECT @@global.div_precision_increment;
 @@global.div_precision_increment
 0
@@ -100,6 +102,8 @@ SELECT @@session.div_precision_increment
 @@session.div_precision_increment
 30
 SET @@session.div_precision_increment = -2;
+Warnings:
+Warning	1292	Truncated incorrect div_precision_increment value: '-2'
 SELECT @@session.div_precision_increment;
 @@session.div_precision_increment
 0

=== modified file 'mysql-test/suite/sys_vars/r/expire_logs_days_basic.result'
--- a/mysql-test/suite/sys_vars/r/expire_logs_days_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/expire_logs_days_basic.result	2009-02-27 20:43:43 +0000
@@ -32,6 +32,8 @@ SELECT @@global.expire_logs_days;
 21
 '#--------------------FN_DYNVARS_029_04-------------------------#'
 SET @@global.expire_logs_days = -1;
+Warnings:
+Warning	1292	Truncated incorrect expire_logs_days value: '-1'
 SELECT @@global.expire_logs_days;
 @@global.expire_logs_days
 0
@@ -53,6 +55,8 @@ SELECT @@global.expire_logs_days;
 @@global.expire_logs_days
 99
 SET @@global.expire_logs_days = -1024;
+Warnings:
+Warning	1292	Truncated incorrect expire_logs_days value: '-1024'
 SELECT @@global.expire_logs_days;
 @@global.expire_logs_days
 0

=== modified file 'mysql-test/suite/sys_vars/r/group_concat_max_len_basic.result'
--- a/mysql-test/suite/sys_vars/r/group_concat_max_len_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/group_concat_max_len_basic.result	2009-02-27 20:43:43 +0000
@@ -65,7 +65,7 @@ SELECT @@global.group_concat_max_len;
 4
 SET @@global.group_concat_max_len = -1024;
 Warnings:
-Warning	1292	Truncated incorrect group_concat_max_len value: '0'
+Warning	1292	Truncated incorrect group_concat_max_len value: '-1024'
 SELECT @@global.group_concat_max_len;
 @@global.group_concat_max_len
 4
@@ -91,7 +91,7 @@ SELECT @@session.group_concat_max_len;
 4
 SET @@session.group_concat_max_len = -2;
 Warnings:
-Warning	1292	Truncated incorrect group_concat_max_len value: '0'
+Warning	1292	Truncated incorrect group_concat_max_len value: '-2'
 SELECT @@session.group_concat_max_len;
 @@session.group_concat_max_len
 4

=== modified file 'mysql-test/suite/sys_vars/r/interactive_timeout_basic.result'
--- a/mysql-test/suite/sys_vars/r/interactive_timeout_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/interactive_timeout_basic.result	2009-02-27 20:43:43 +0000
@@ -61,7 +61,7 @@ SELECT @@global.interactive_timeout;
 1
 SET @@global.interactive_timeout = -1024;
 Warnings:
-Warning	1292	Truncated incorrect interactive_timeout value: '0'
+Warning	1292	Truncated incorrect interactive_timeout value: '-1024'
 SELECT @@global.interactive_timeout;
 @@global.interactive_timeout
 1
@@ -89,7 +89,7 @@ SELECT @@session.interactive_timeout;
 1
 SET @@session.interactive_timeout = -2;
 Warnings:
-Warning	1292	Truncated incorrect interactive_timeout value: '0'
+Warning	1292	Truncated incorrect interactive_timeout value: '-2'
 SELECT @@session.interactive_timeout;
 @@session.interactive_timeout
 1

=== modified file 'mysql-test/suite/sys_vars/r/max_allowed_packet_basic.result'
--- a/mysql-test/suite/sys_vars/r/max_allowed_packet_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/max_allowed_packet_basic.result	2009-02-27 20:43:43 +0000
@@ -76,7 +76,7 @@ SELECT @@global.max_allowed_packet;
 1024
 SET @@global.max_allowed_packet = -1024;
 Warnings:
-Warning	1292	Truncated incorrect max_allowed_packet value: '0'
+Warning	1292	Truncated incorrect max_allowed_packet value: '-1024'
 SELECT @@global.max_allowed_packet;
 @@global.max_allowed_packet
 1024

=== modified file 'mysql-test/suite/sys_vars/r/max_binlog_size_basic.result'
--- a/mysql-test/suite/sys_vars/r/max_binlog_size_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/max_binlog_size_basic.result	2009-02-27 20:43:43 +0000
@@ -39,7 +39,7 @@ SELECT @@global.max_binlog_size;
 '#--------------------FN_DYNVARS_072_04-------------------------#'
 SET @@global.max_binlog_size = -1;
 Warnings:
-Warning	1292	Truncated incorrect max_binlog_size value: '0'
+Warning	1292	Truncated incorrect max_binlog_size value: '-1'
 SELECT @@global.max_binlog_size;
 @@global.max_binlog_size
 4096
@@ -56,7 +56,7 @@ SELECT @@global.max_binlog_size;
 1073741824
 SET @@global.max_binlog_size = -1024;
 Warnings:
-Warning	1292	Truncated incorrect max_binlog_size value: '0'
+Warning	1292	Truncated incorrect max_binlog_size value: '-1024'
 SELECT @@global.max_binlog_size;
 @@global.max_binlog_size
 4096

=== modified file 'mysql-test/suite/sys_vars/r/max_connections_basic.result'
--- a/mysql-test/suite/sys_vars/r/max_connections_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/max_connections_basic.result	2009-02-27 20:43:43 +0000
@@ -39,7 +39,7 @@ SELECT @@global.max_connections;
 '#--------------------FN_DYNVARS_074_04-------------------------#'
 SET @@global.max_connections = -1;
 Warnings:
-Warning	1292	Truncated incorrect max_connections value: '0'
+Warning	1292	Truncated incorrect max_connections value: '-1'
 SELECT @@global.max_connections;
 @@global.max_connections
 1
@@ -56,7 +56,7 @@ SELECT @@global.max_connections;
 100000
 SET @@global.max_connections = -1024;
 Warnings:
-Warning	1292	Truncated incorrect max_connections value: '0'
+Warning	1292	Truncated incorrect max_connections value: '-1024'
 SELECT @@global.max_connections;
 @@global.max_connections
 1

=== modified file 'mysql-test/suite/sys_vars/r/max_delayed_threads_basic.result'
--- a/mysql-test/suite/sys_vars/r/max_delayed_threads_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/max_delayed_threads_basic.result	2009-02-27 20:43:43 +0000
@@ -76,10 +76,14 @@ SELECT @@session.max_delayed_threads;
 16383
 '#------------------FN_DYNVARS_075_05-----------------------#'
 SET @@global.max_delayed_threads = -1024;
+Warnings:
+Warning	1292	Truncated incorrect max_delayed_threads value: '-1024'
 SELECT @@global.max_delayed_threads;
 @@global.max_delayed_threads
 0
 SET @@global.max_delayed_threads = -1;
+Warnings:
+Warning	1292	Truncated incorrect max_delayed_threads value: '-1'
 SELECT @@global.max_delayed_threads;
 @@global.max_delayed_threads
 0

=== modified file 'mysql-test/suite/sys_vars/r/max_error_count_basic.result'
--- a/mysql-test/suite/sys_vars/r/max_error_count_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/max_error_count_basic.result	2009-02-27 20:43:43 +0000
@@ -63,10 +63,14 @@ SELECT @@session.max_error_count;
 65534
 '#------------------FN_DYNVARS_076_05-----------------------#'
 SET @@global.max_error_count = -1;
+Warnings:
+Warning	1292	Truncated incorrect max_error_count value: '-1'
 SELECT @@global.max_error_count;
 @@global.max_error_count
 0
 SET @@global.max_error_count = -1024;
+Warnings:
+Warning	1292	Truncated incorrect max_error_count value: '-1024'
 SELECT @@global.max_error_count;
 @@global.max_error_count
 0
@@ -93,6 +97,8 @@ SELECT @@global.max_error_count;
 @@global.max_error_count
 65535
 SET @@session.max_error_count = -1;
+Warnings:
+Warning	1292	Truncated incorrect max_error_count value: '-1'
 SELECT @@session.max_error_count;
 @@session.max_error_count
 0
@@ -102,6 +108,8 @@ SELECT @@session.max_error_count;
 @@session.max_error_count
 65535
 SET @@session.max_error_count = -2;
+Warnings:
+Warning	1292	Truncated incorrect max_error_count value: '-2'
 SELECT @@session.max_error_count;
 @@session.max_error_count
 0

=== modified file 'mysql-test/suite/sys_vars/r/max_insert_delayed_threads_basic.result'
--- a/mysql-test/suite/sys_vars/r/max_insert_delayed_threads_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/max_insert_delayed_threads_basic.result	2009-02-27 20:43:43 +0000
@@ -77,10 +77,14 @@ SELECT @@session.max_insert_delayed_thre
 16383
 '#------------------FN_DYNVARS_078_05-----------------------#'
 SET @@global.max_insert_delayed_threads = -1024;
+Warnings:
+Warning	1292	Truncated incorrect max_insert_delayed_threads value: '-1024'
 SELECT @@global.max_insert_delayed_threads;
 @@global.max_insert_delayed_threads
 0
 SET @@global.max_insert_delayed_threads = -1;
+Warnings:
+Warning	1292	Truncated incorrect max_insert_delayed_threads value: '-1'
 SELECT @@global.max_insert_delayed_threads;
 @@global.max_insert_delayed_threads
 0

=== modified file 'mysql-test/suite/sys_vars/r/max_length_for_sort_data_basic.result'
--- a/mysql-test/suite/sys_vars/r/max_length_for_sort_data_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/max_length_for_sort_data_basic.result	2009-02-27 20:43:43 +0000
@@ -71,7 +71,7 @@ SELECT @@session.max_length_for_sort_dat
 '#------------------FN_DYNVARS_080_05-----------------------#'
 SET @@global.max_length_for_sort_data = -1024;
 Warnings:
-Warning	1292	Truncated incorrect max_length_for_sort_data value: '0'
+Warning	1292	Truncated incorrect max_length_for_sort_data value: '-1024'
 SELECT @@global.max_length_for_sort_data;
 @@global.max_length_for_sort_data
 4
@@ -111,7 +111,7 @@ SELECT @@session.max_length_for_sort_dat
 8388608
 SET @@session.max_length_for_sort_data = -1;
 Warnings:
-Warning	1292	Truncated incorrect max_length_for_sort_data value: '0'
+Warning	1292	Truncated incorrect max_length_for_sort_data value: '-1'
 SELECT @@session.max_length_for_sort_data;
 @@session.max_length_for_sort_data
 4

=== modified file 'mysql-test/suite/sys_vars/r/max_prepared_stmt_count_basic.result'
--- a/mysql-test/suite/sys_vars/r/max_prepared_stmt_count_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/max_prepared_stmt_count_basic.result	2009-02-27 20:43:43 +0000
@@ -36,6 +36,8 @@ SELECT @@global.max_prepared_stmt_count;
 65535
 '#--------------------FN_DYNVARS_081_04-------------------------#'
 SET @@global.max_prepared_stmt_count = -1;
+Warnings:
+Warning	1292	Truncated incorrect max_prepared_stmt_count value: '-1'
 SELECT @@global.max_prepared_stmt_count;
 @@global.max_prepared_stmt_count
 0
@@ -51,6 +53,8 @@ SELECT @@global.max_prepared_stmt_count;
 @@global.max_prepared_stmt_count
 1048576
 SET @@global.max_prepared_stmt_count = -1024;
+Warnings:
+Warning	1292	Truncated incorrect max_prepared_stmt_count value: '-1024'
 SELECT @@global.max_prepared_stmt_count;
 @@global.max_prepared_stmt_count
 0

=== modified file 'mysql-test/suite/sys_vars/r/max_relay_log_size_basic.result'
--- a/mysql-test/suite/sys_vars/r/max_relay_log_size_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/max_relay_log_size_basic.result	2009-02-27 20:43:43 +0000
@@ -38,6 +38,8 @@ SELECT @@global.max_relay_log_size;
 'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
 '#--------------------FN_DYNVARS_082_04-------------------------#'
 SET @@global.max_relay_log_size = -1;
+Warnings:
+Warning	1292	Truncated incorrect max_relay_log_size value: '-1'
 SELECT @@global.max_relay_log_size;
 @@global.max_relay_log_size
 0
@@ -53,6 +55,8 @@ SELECT @@global.max_relay_log_size;
 @@global.max_relay_log_size
 1073741824
 SET @@global.max_relay_log_size = -1024;
+Warnings:
+Warning	1292	Truncated incorrect max_relay_log_size value: '-1024'
 SELECT @@global.max_relay_log_size;
 @@global.max_relay_log_size
 0

=== modified file 'mysql-test/suite/sys_vars/r/max_sort_length_basic.result'
--- a/mysql-test/suite/sys_vars/r/max_sort_length_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/max_sort_length_basic.result	2009-02-27 20:43:43 +0000
@@ -71,7 +71,7 @@ SELECT @@session.max_sort_length;
 '#------------------FN_DYNVARS_084_05-----------------------#'
 SET @@global.max_sort_length = -1024;
 Warnings:
-Warning	1292	Truncated incorrect max_sort_length value: '0'
+Warning	1292	Truncated incorrect max_sort_length value: '-1024'
 SELECT @@global.max_sort_length;
 @@global.max_sort_length
 4
@@ -111,7 +111,7 @@ SELECT @@session.max_sort_length;
 8388608
 SET @@session.max_sort_length = -1;
 Warnings:
-Warning	1292	Truncated incorrect max_sort_length value: '0'
+Warning	1292	Truncated incorrect max_sort_length value: '-1'
 SELECT @@session.max_sort_length;
 @@session.max_sort_length
 4

=== modified file 'mysql-test/suite/sys_vars/r/max_sp_recursion_depth_basic.result'
--- a/mysql-test/suite/sys_vars/r/max_sp_recursion_depth_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/max_sp_recursion_depth_basic.result	2009-02-27 20:43:43 +0000
@@ -74,6 +74,8 @@ SELECT @@session.max_sp_recursion_depth;
 150
 '#------------------FN_DYNVARS_085_05-----------------------#'
 SET @@global.max_sp_recursion_depth = -1024;
+Warnings:
+Warning	1292	Truncated incorrect max_sp_recursion_depth value: '-1024'
 SELECT @@global.max_sp_recursion_depth;
 @@global.max_sp_recursion_depth
 0
@@ -84,6 +86,8 @@ SELECT @@global.max_sp_recursion_depth;
 @@global.max_sp_recursion_depth
 255
 SET @@global.max_sp_recursion_depth = -1;
+Warnings:
+Warning	1292	Truncated incorrect max_sp_recursion_depth value: '-1'
 SELECT @@global.max_sp_recursion_depth;
 @@global.max_sp_recursion_depth
 0
@@ -110,6 +114,8 @@ SELECT @@session.max_sp_recursion_depth;
 @@session.max_sp_recursion_depth
 255
 SET @@session.max_sp_recursion_depth = -1;
+Warnings:
+Warning	1292	Truncated incorrect max_sp_recursion_depth value: '-1'
 SELECT @@session.max_sp_recursion_depth;
 @@session.max_sp_recursion_depth
 0
@@ -120,6 +126,8 @@ SELECT @@session.max_sp_recursion_depth;
 @@session.max_sp_recursion_depth
 255
 SET @@session.max_sp_recursion_depth = -001;
+Warnings:
+Warning	1292	Truncated incorrect max_sp_recursion_depth value: '-1'
 SELECT @@session.max_sp_recursion_depth;
 @@session.max_sp_recursion_depth
 0

=== modified file 'mysql-test/suite/sys_vars/r/myisam_data_pointer_size_basic.result'
--- a/mysql-test/suite/sys_vars/r/myisam_data_pointer_size_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/myisam_data_pointer_size_basic.result	2009-02-27 20:43:43 +0000
@@ -48,7 +48,7 @@ ERROR HY000: Variable 'myisam_data_point
 '#------------------FN_DYNVARS_093_05-----------------------#'
 SET @@global.myisam_data_pointer_size = -1;
 Warnings:
-Warning	1292	Truncated incorrect myisam_data_pointer_size value: '0'
+Warning	1292	Truncated incorrect myisam_data_pointer_size value: '-1'
 SELECT @@global.myisam_data_pointer_size;
 @@global.myisam_data_pointer_size
 2

=== modified file 'mysql-test/suite/sys_vars/r/net_buffer_length_basic.result'
--- a/mysql-test/suite/sys_vars/r/net_buffer_length_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/net_buffer_length_basic.result	2009-02-27 20:43:43 +0000
@@ -50,7 +50,7 @@ SELECT @@global.net_buffer_length;
 1024
 SET @@global.net_buffer_length = -1024;
 Warnings:
-Warning	1292	Truncated incorrect net_buffer_length value: '0'
+Warning	1292	Truncated incorrect net_buffer_length value: '-1024'
 SELECT @@global.net_buffer_length;
 @@global.net_buffer_length
 1024

=== modified file 'mysql-test/suite/sys_vars/r/net_read_timeout_basic.result'
--- a/mysql-test/suite/sys_vars/r/net_read_timeout_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/net_read_timeout_basic.result	2009-02-27 20:43:43 +0000
@@ -61,7 +61,7 @@ SELECT @@global.net_read_timeout;
 1
 SET @@global.net_read_timeout = -1024;
 Warnings:
-Warning	1292	Truncated incorrect net_read_timeout value: '0'
+Warning	1292	Truncated incorrect net_read_timeout value: '-1024'
 SELECT @@global.net_read_timeout;
 @@global.net_read_timeout
 1
@@ -89,7 +89,7 @@ SELECT @@session.net_read_timeout;
 1
 SET @@session.net_read_timeout = -2;
 Warnings:
-Warning	1292	Truncated incorrect net_read_timeout value: '0'
+Warning	1292	Truncated incorrect net_read_timeout value: '-2'
 SELECT @@session.net_read_timeout;
 @@session.net_read_timeout
 1

=== modified file 'mysql-test/suite/sys_vars/r/net_write_timeout_basic.result'
--- a/mysql-test/suite/sys_vars/r/net_write_timeout_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/net_write_timeout_basic.result	2009-02-27 20:43:43 +0000
@@ -61,7 +61,7 @@ SELECT @@global.net_write_timeout;
 1
 SET @@global.net_write_timeout = -1024;
 Warnings:
-Warning	1292	Truncated incorrect net_write_timeout value: '0'
+Warning	1292	Truncated incorrect net_write_timeout value: '-1024'
 SELECT @@global.net_write_timeout;
 @@global.net_write_timeout
 1
@@ -89,7 +89,7 @@ SELECT @@session.net_write_timeout;
 1
 SET @@session.net_write_timeout = -2;
 Warnings:
-Warning	1292	Truncated incorrect net_write_timeout value: '0'
+Warning	1292	Truncated incorrect net_write_timeout value: '-2'
 SELECT @@session.net_write_timeout;
 @@session.net_write_timeout
 1

=== modified file 'mysql-test/suite/sys_vars/r/optimizer_prune_level_basic.result'
--- a/mysql-test/suite/sys_vars/r/optimizer_prune_level_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/optimizer_prune_level_basic.result	2009-02-27 20:43:43 +0000
@@ -81,6 +81,8 @@ ERROR 42000: Incorrect argument type to 
 SET @@global.optimizer_prune_level = FELSE;
 ERROR 42000: Incorrect argument type to variable 'optimizer_prune_level'
 SET @@global.optimizer_prune_level = -1024;
+Warnings:
+Warning	1292	Truncated incorrect optimizer_prune_level value: '-1024'
 SELECT @@global.optimizer_prune_level;
 @@global.optimizer_prune_level
 0
@@ -107,6 +109,8 @@ ERROR 42000: Incorrect argument type to 
 SET @@session.optimizer_prune_level = 'OFN';
 ERROR 42000: Incorrect argument type to variable 'optimizer_prune_level'
 SET @@session.optimizer_prune_level = -2;
+Warnings:
+Warning	1292	Truncated incorrect optimizer_prune_level value: '-2'
 SELECT @@session.optimizer_prune_level;
 @@session.optimizer_prune_level
 0

=== modified file 'mysql-test/suite/sys_vars/r/optimizer_search_depth_basic.result'
--- a/mysql-test/suite/sys_vars/r/optimizer_search_depth_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/optimizer_search_depth_basic.result	2009-02-27 20:43:43 +0000
@@ -72,6 +72,8 @@ SELECT @@global.optimizer_search_depth;
 @@global.optimizer_search_depth
 63
 SET @@global.optimizer_search_depth = -1;
+Warnings:
+Warning	1292	Truncated incorrect optimizer_search_depth value: '-1'
 SELECT @@global.optimizer_search_depth;
 @@global.optimizer_search_depth
 0
@@ -98,6 +100,8 @@ SELECT @@session.optimizer_search_depth;
 @@session.optimizer_search_depth
 63
 SET @@session.optimizer_search_depth = -2;
+Warnings:
+Warning	1292	Truncated incorrect optimizer_search_depth value: '-2'
 SELECT @@session.optimizer_search_depth;
 @@session.optimizer_search_depth
 0

=== modified file 'mysql-test/suite/sys_vars/r/preload_buffer_size_basic.result'
--- a/mysql-test/suite/sys_vars/r/preload_buffer_size_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/preload_buffer_size_basic.result	2009-02-27 20:43:43 +0000
@@ -77,7 +77,7 @@ SELECT @@global.preload_buffer_size;
 1024
 SET @@global.preload_buffer_size = -1;
 Warnings:
-Warning	1292	Truncated incorrect preload_buffer_size value: '0'
+Warning	1292	Truncated incorrect preload_buffer_size value: '-1'
 SELECT @@global.preload_buffer_size;
 @@global.preload_buffer_size
 1024
@@ -111,7 +111,7 @@ SELECT @@session.preload_buffer_size;
 1024
 SET @@session.preload_buffer_size = -2;
 Warnings:
-Warning	1292	Truncated incorrect preload_buffer_size value: '0'
+Warning	1292	Truncated incorrect preload_buffer_size value: '-2'
 SELECT @@session.preload_buffer_size;
 @@session.preload_buffer_size
 1024

=== modified file 'mysql-test/suite/sys_vars/r/read_buffer_size_basic.result'
--- a/mysql-test/suite/sys_vars/r/read_buffer_size_basic.result	2009-01-22 10:14:16 +0000
+++ b/mysql-test/suite/sys_vars/r/read_buffer_size_basic.result	2009-02-27 20:43:43 +0000
@@ -81,7 +81,7 @@ SELECT @@global.read_buffer_size= 8200 O
 1
 SET @@global.read_buffer_size = -1024;
 Warnings:
-Warning	1292	Truncated incorrect read_buffer_size value: '0'
+Warning	1292	Truncated incorrect read_buffer_size value: '-1024'
 SELECT @@global.read_buffer_size= 8200 OR @@global.read_buffer_size= 8228 ;
 @@global.read_buffer_size= 8200 OR @@global.read_buffer_size= 8228
 1
@@ -109,7 +109,7 @@ SELECT @@session.read_buffer_size= 8200 
 1
 SET @@session.read_buffer_size = -2;
 Warnings:
-Warning	1292	Truncated incorrect read_buffer_size value: '0'
+Warning	1292	Truncated incorrect read_buffer_size value: '-2'
 SELECT @@session.read_buffer_size= 8200 OR @@session.read_buffer_size= 8228 ;
 @@session.read_buffer_size= 8200 OR @@session.read_buffer_size= 8228
 1

=== modified file 'mysql-test/suite/sys_vars/r/read_rnd_buffer_size_basic.result'
--- a/mysql-test/suite/sys_vars/r/read_rnd_buffer_size_basic.result	2009-01-22 10:14:16 +0000
+++ b/mysql-test/suite/sys_vars/r/read_rnd_buffer_size_basic.result	2009-02-27 20:43:43 +0000
@@ -83,7 +83,7 @@ SELECT @@global.read_rnd_buffer_size= 82
 1
 SET @@global.read_rnd_buffer_size = -1024;
 Warnings:
-Warning	1292	Truncated incorrect read_rnd_buffer_size value: '0'
+Warning	1292	Truncated incorrect read_rnd_buffer_size value: '-1024'
 SELECT @@global.read_rnd_buffer_size= 8200 OR @@global.read_rnd_buffer_size= 8228;
 @@global.read_rnd_buffer_size= 8200 OR @@global.read_rnd_buffer_size= 8228
 1
@@ -111,7 +111,7 @@ SELECT @@session.read_rnd_buffer_size= 8
 1
 SET @@session.read_rnd_buffer_size = -2;
 Warnings:
-Warning	1292	Truncated incorrect read_rnd_buffer_size value: '0'
+Warning	1292	Truncated incorrect read_rnd_buffer_size value: '-2'
 SELECT @@session.read_rnd_buffer_size= 8200 OR @@session.read_rnd_buffer_size= 8228;
 @@session.read_rnd_buffer_size= 8200 OR @@session.read_rnd_buffer_size= 8228
 1

=== modified file 'mysql-test/suite/sys_vars/r/slave_net_timeout_basic.result'
--- a/mysql-test/suite/sys_vars/r/slave_net_timeout_basic.result	2009-01-29 16:59:46 +0000
+++ b/mysql-test/suite/sys_vars/r/slave_net_timeout_basic.result	2009-02-27 20:43:43 +0000
@@ -58,13 +58,13 @@ ERROR HY000: Variable 'slave_net_timeout
 '#------------------FN_DYNVARS_146_05-----------------------#'
 SET @@global.slave_net_timeout = -1;
 Warnings:
-Warning	1292	Truncated incorrect slave_net_timeout value: '0'
+Warning	1292	Truncated incorrect slave_net_timeout value: '-1'
 SELECT @@global.slave_net_timeout;
 @@global.slave_net_timeout
 1
 SET @@global.slave_net_timeout = -2147483648;
 Warnings:
-Warning	1292	Truncated incorrect slave_net_timeout value: '0'
+Warning	1292	Truncated incorrect slave_net_timeout value: '-2147483648'
 SELECT @@global.slave_net_timeout;
 @@global.slave_net_timeout
 1

=== modified file 'mysql-test/suite/sys_vars/r/slow_launch_time_basic.result'
--- a/mysql-test/suite/sys_vars/r/slow_launch_time_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/slow_launch_time_basic.result	2009-02-27 20:43:43 +0000
@@ -36,6 +36,8 @@ SELECT @@global.slow_launch_time;
 65536
 '#--------------------FN_DYNVARS_150_04-------------------------#'
 SET @@global.slow_launch_time = -1;
+Warnings:
+Warning	1292	Truncated incorrect slow_launch_time value: '-1'
 SELECT @@global.slow_launch_time;
 @@global.slow_launch_time
 0
@@ -57,6 +59,8 @@ SELECT @@global.slow_launch_time;
 @@global.slow_launch_time
 31536000
 SET @@global.slow_launch_time = -1024;
+Warnings:
+Warning	1292	Truncated incorrect slow_launch_time value: '-1024'
 SELECT @@global.slow_launch_time;
 @@global.slow_launch_time
 0

=== modified file 'mysql-test/suite/sys_vars/r/table_definition_cache_basic.result'
--- a/mysql-test/suite/sys_vars/r/table_definition_cache_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/table_definition_cache_basic.result	2009-02-27 20:43:43 +0000
@@ -45,7 +45,7 @@ SELECT @@global.table_definition_cache;
 256
 SET @@global.table_definition_cache = -1024;
 Warnings:
-Warning	1292	Truncated incorrect table_definition_cache value: '0'
+Warning	1292	Truncated incorrect table_definition_cache value: '-1024'
 SELECT @@global.table_definition_cache;
 @@global.table_definition_cache
 256

=== modified file 'mysql-test/suite/sys_vars/r/table_lock_wait_timeout_basic.result'
--- a/mysql-test/suite/sys_vars/r/table_lock_wait_timeout_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/table_lock_wait_timeout_basic.result	2009-02-27 20:43:43 +0000
@@ -37,13 +37,13 @@ SELECT @@global.table_lock_wait_timeout 
 '#--------------------FN_DYNVARS_001_04-------------------------#'
 SET @@global.table_lock_wait_timeout = -1;
 Warnings:
-Warning	1292	Truncated incorrect table_lock_wait_timeout value: '0'
+Warning	1292	Truncated incorrect table_lock_wait_timeout value: '-1'
 SET @@global.table_lock_wait_timeout= 100000000000;
 Warnings:
 Warning	1292	Truncated incorrect table_lock_wait_timeout value: '100000000000'
 SET @@global.table_lock_wait_timeout= -1024;
 Warnings:
-Warning	1292	Truncated incorrect table_lock_wait_timeout value: '0'
+Warning	1292	Truncated incorrect table_lock_wait_timeout value: '-1024'
 SET @@global.table_lock_wait_timeout= 0;
 Warnings:
 Warning	1292	Truncated incorrect table_lock_wait_timeout value: '0'

=== modified file 'mysql-test/suite/sys_vars/r/table_open_cache_basic.result'
--- a/mysql-test/suite/sys_vars/r/table_open_cache_basic.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/table_open_cache_basic.result	2009-02-27 20:43:43 +0000
@@ -39,7 +39,7 @@ SELECT @@global.table_open_cache ;
 '#--------------------FN_DYNVARS_001_04-------------------------#'
 SET @@global.table_open_cache  = -1;
 Warnings:
-Warning	1292	Truncated incorrect table_open_cache value: '0'
+Warning	1292	Truncated incorrect table_open_cache value: '-1'
 SELECT @@global.table_open_cache  ;
 @@global.table_open_cache
 1
@@ -51,7 +51,7 @@ SELECT @@global.table_open_cache ;
 524288
 SET @@global.table_open_cache = -1024;
 Warnings:
-Warning	1292	Truncated incorrect table_open_cache value: '0'
+Warning	1292	Truncated incorrect table_open_cache value: '-1024'
 SELECT @@global.table_open_cache ;
 @@global.table_open_cache
 1

=== modified file 'mysql-test/t/lock.test'
--- a/mysql-test/t/lock.test	2007-08-02 09:59:02 +0000
+++ b/mysql-test/t/lock.test	2009-03-05 14:22:33 +0000
@@ -214,4 +214,34 @@ create view v_bug5719 as select * from t
 --echo
 drop table t2, t3;
 
+--echo #
+--echo # Bug#39843 DELETE requires write access to table in subquery in where clause
+--echo #
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+CREATE TABLE t1 (
+table1_rowid SMALLINT NOT NULL
+);
+CREATE TABLE t2 (
+table2_rowid SMALLINT NOT NULL
+);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+LOCK TABLES t1 WRITE, t2 READ;
+--echo # Sub-select should not try to aquire a write lock.
+DELETE FROM t1 
+WHERE EXISTS 
+( 
+SELECT 'x' 
+FROM t2
+WHERE t1.table1_rowid = t2.table2_rowid
+) ;
+--echo # While implementing the patch we didn't break old behavior;
+--echo # The following sub-select should still requires a write lock:
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+SELECT * FROM t1 WHERE 1 IN (SELECT * FROM t2 FOR UPDATE);
+UNLOCK TABLES;
+DROP TABLE t1,t2;
+
 --echo End of 5.1 tests.

=== modified file 'mysql-test/t/merge.test'
--- a/mysql-test/t/merge.test	2009-02-12 10:25:12 +0000
+++ b/mysql-test/t/merge.test	2009-03-04 09:18:07 +0000
@@ -1496,4 +1496,22 @@ UNLOCK TABLES;
 --echo # drop the created tables
 DROP TABLE t1, t2, t3;
 
+#
+# Bug #41305 server crashes when inserting duplicate row into a merge table
+#
+--echo # insert duplicate value in child table while merge table doesn't have key
+create table t1 (
+        col1 int(10),
+        primary key (col1)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+CREATE TABLE m1 (
+  col1 int(10) NOT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(t1);
+
+insert into m1 (col1) values (1);
+--error ER_DUP_ENTRY
+insert into m1 (col1) values (1);
+
+drop table m1, t1;
 --echo End of 5.1 tests

=== modified file 'mysql-test/t/strict.test'
--- a/mysql-test/t/strict.test	2008-12-01 04:17:52 +0000
+++ b/mysql-test/t/strict.test	2009-03-05 11:20:01 +0000
@@ -1163,11 +1163,11 @@ set @@sql_mode= @org_mode;
 # Bug #13934 Silent truncation of table comments
 #
 set @@sql_mode='traditional';
---error 1105
+--error ER_TOO_LONG_TABLE_COMMENT
 create table t1 (i int)
 comment '123456789*123456789*123456789*123456789*123456789*
          123456789*123456789*123456789*123456789*123456789*';
---error 1105
+--error ER_TOO_LONG_FIELD_COMMENT
 create table t1 (
 i int comment
 '123456789*123456789*123456789*123456789*

=== modified file 'mysql-test/t/variables.test'
--- a/mysql-test/t/variables.test	2009-03-05 11:34:02 +0000
+++ b/mysql-test/t/variables.test	2009-03-06 15:11:34 +0000
@@ -1123,8 +1123,44 @@ SET @@global.thread_stack= 7;
 #
 
 #
+# Bug #40657 - assertion with out of range variables and traditional sql_mode
+#
+
+SELECT @@global.expire_logs_days INTO @old_eld;
+
+SET GLOBAL expire_logs_days = -1;
+--echo needs to've been adjusted (0)
+SELECT @@global.expire_logs_days;
+
+SET GLOBAL expire_logs_days = 11;
+SET @old_mode=@@sql_mode;
+SET SESSION sql_mode = 'TRADITIONAL';
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL expire_logs_days = 100;
+--echo needs to be unchanged (11)
+SELECT @@global.expire_logs_days;
+SET SESSION sql_mode = @old_mode;
+
+SET GLOBAL expire_logs_days = 100;
+--echo needs to've been adjusted (99)
+SELECT @@global.expire_logs_days;
+
+SET GLOBAL expire_logs_days = 11;
+SET GLOBAL expire_logs_days = 99;
+--echo needs to pass with no warnings (99)
+SELECT @@global.expire_logs_days;
+
+# cleanup
+SET GLOBAL expire_logs_days = @old_eld;
+
+
+#
 # Bug#41030 Wrong meta data (incorrect fieldlen)
 #
+
 --enable_metadata
 select @@storage_engine;
 --disable_metadata
+
+
+--echo End of 5.1 tests

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2009-01-23 12:22:05 +0000
+++ b/sql/log.cc	2009-03-05 09:48:03 +0000
@@ -4650,10 +4650,14 @@ bool flush_error_log()
       uchar buf[IO_SIZE];
 
       freopen(err_temp,"a+",stderr);
+      setbuf(stderr, NULL);
       (void) my_delete(err_renamed, MYF(0));
       my_rename(log_error_file,err_renamed,MYF(0));
       if (freopen(log_error_file,"a+",stdout))
+      {
         freopen(log_error_file,"a+",stderr);
+        setbuf(stderr, NULL);
+      }
 
       if ((fd = my_open(err_temp, O_RDONLY, MYF(0))) >= 0)
       {
@@ -4669,7 +4673,10 @@ bool flush_error_log()
 #else
    my_rename(log_error_file,err_renamed,MYF(0));
    if (freopen(log_error_file,"a+",stdout))
+   {
      freopen(log_error_file,"a+",stderr);
+     setbuf(stderr, NULL);
+   }
    else
      result= 1;
 #endif

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2009-02-25 08:49:02 +0000
+++ b/sql/mysqld.cc	2009-03-05 09:48:03 +0000
@@ -3703,7 +3703,10 @@ static int init_server_components()
 #ifndef EMBEDDED_LIBRARY
       if (freopen(log_error_file, "a+", stdout))
 #endif
+      {
         freopen(log_error_file, "a+", stderr);
+        setbuf(stderr, NULL);
+      }
     }
   }
 
@@ -4331,6 +4334,7 @@ we force server id to 2, but this MySQL 
   {
     freopen(log_error_file,"a+",stdout);
     freopen(log_error_file,"a+",stderr);
+    setbuf(stderr, NULL);
     FreeConsole();				// Remove window
   }
 #endif

=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc	2009-03-05 18:39:02 +0000
+++ b/sql/set_var.cc	2009-03-06 15:11:34 +0000
@@ -135,8 +135,6 @@ static int check_max_delayed_threads(THD
 static void fix_thd_mem_root(THD *thd, enum_var_type type);
 static void fix_trans_mem_root(THD *thd, enum_var_type type);
 static void fix_server_id(THD *thd, enum_var_type type);
-static ulonglong fix_unsigned(THD *, ulonglong, const struct my_option *);
-static bool get_unsigned(THD *thd, set_var *var);
 bool throw_bounds_warning(THD *thd, bool fixed, bool unsignd,
                           const char *name, longlong val);
 static KEY_CACHE *create_key_cache(const char *name, uint length);
@@ -1371,6 +1369,19 @@ static void fix_server_id(THD *thd, enum
 }
 
 
+/**
+  Throw warning (error in STRICT mode) if value for variable needed bounding.
+  Only call from check(), not update(), because an error in update() would be
+  bad mojo. Plug-in interface also uses this.
+
+  @param thd      thread handle
+  @param fixed    did we have to correct the value? (throw warn/err if so)
+  @param unsignd  is value's type unsigned?
+  @param name     variable's name
+  @param val      variable's value
+
+  @retval         TRUE on error, FALSE otherwise (warning or OK)
+ */
 bool throw_bounds_warning(THD *thd, bool fixed, bool unsignd,
                           const char *name, longlong val)
 {
@@ -1396,26 +1407,127 @@ bool throw_bounds_warning(THD *thd, bool
   return FALSE;
 }
 
-static ulonglong fix_unsigned(THD *thd, ulonglong num,
+
+/**
+  check an unsigned user-supplied value for a systemvariable against bounds.
+
+  TODO: This is a wrapper function to call clipping from within an update()
+        function.  Calling bounds from within update() is fair game in theory,
+        but we can only send warnings from in there, not errors, and besides,
+        it violates our model of separating check from update phase.
+        To avoid breaking out of the server with an ASSERT() in strict mode,
+        we pretend we're not in strict mode when we go through here. Bug#43233
+        was opened to remind us to replace this kludge with The Right Thing,
+        which of course is to do the check in the actual check phase, and then
+        throw an error or warning accordingly.
+
+  @param thd             thread handle
+  @param num             the value to limit
+  @param option_limits   the bounds-record, or NULL if none
+ */
+static void bound_unsigned(THD *thd, ulonglong *num,
                               const struct my_option *option_limits)
 {
-  my_bool fixed= FALSE;
-  ulonglong out= getopt_ull_limit_value(num, option_limits, &fixed);
+  if (option_limits)
+  {
+    my_bool   fixed     = FALSE;
+    ulonglong unadjusted= *num;
 
-  throw_bounds_warning(thd, fixed, TRUE, option_limits->name, (longlong) num);
-  return out;
+    *num= getopt_ull_limit_value(unadjusted, option_limits, &fixed);
+
+    if (fixed)
+    {
+      ulong ssm= thd->variables.sql_mode;
+      thd->variables.sql_mode&= ~MODE_STRICT_ALL_TABLES;
+      throw_bounds_warning(thd, fixed, TRUE, option_limits->name, unadjusted);
+      thd->variables.sql_mode= ssm;
+    }
+  }
 }
 
-static bool get_unsigned(THD *thd, set_var *var)
-{
+
+/**
+  Get unsigned system-variable.
+  Negative value does not wrap around, but becomes zero.
+  Check user-supplied value for a systemvariable against bounds.
+  If we needed to adjust the value, throw a warning or error depending
+  on SQL-mode.
+
+  @param thd             thread handle
+  @param var             the system-variable to get
+  @param user_max        a limit given with --maximum-variable-name=... or 0
+  @param var_type        function will bound on systems where necessary.
+
+  @retval                TRUE on error, FALSE otherwise (warning or OK)
+ */
+static bool get_unsigned(THD *thd, set_var *var, ulonglong user_max,
+                         ulong var_type)
+{
+  int                     warnings= 0;
+  ulonglong               unadjusted;
+  const struct my_option *limits= var->var->option_limits;
+  struct my_option        fallback;
+
+  /* get_unsigned() */
   if (var->value->unsigned_flag)
     var->save_result.ulonglong_value= (ulonglong) var->value->val_int();
   else
   {
     longlong v= var->value->val_int();
     var->save_result.ulonglong_value= (ulonglong) ((v < 0) ? 0 : v);
+    if (v < 0)
+    {
+      warnings++;
+      if (throw_bounds_warning(thd, TRUE, FALSE, var->var->name, v))
+        return TRUE;  /* warning was promoted to error, give up */
+    }
   }
-  return 0;
+
+  unadjusted= var->save_result.ulonglong_value;
+
+  /* max, if any */
+
+  if ((user_max > 0) && (unadjusted > user_max))
+  {
+    var->save_result.ulonglong_value= user_max;
+
+    if ((warnings == 0) && throw_bounds_warning(thd, TRUE, TRUE,
+                                                var->var->name,
+                                                (longlong) unadjusted))
+      return TRUE;
+
+    warnings++;
+  }
+
+  /*
+    if the sysvar doesn't have a proper bounds record but the check
+    function would like bounding to ULONG where its size differs from
+    that of ULONGLONG, we make up a bogus limits record here and let
+    the usual suspects handle the actual limiting.
+  */
+
+  if (!limits && var_type != GET_ULL)
+  {
+    bzero(&fallback, sizeof(fallback));
+    fallback.var_type= var_type;
+    limits= &fallback;
+  }
+
+  /* fix_unsigned() */
+  if (limits)
+  {
+    my_bool   fixed;
+
+    var->save_result.ulonglong_value= getopt_ull_limit_value(var->save_result.
+                                                             ulonglong_value,
+							     limits, &fixed);
+
+    if ((warnings == 0) && throw_bounds_warning(thd, fixed, TRUE, limits->name,
+                                                (longlong) unadjusted))
+      return TRUE;
+  }
+
+  return FALSE;
 }
 
 
@@ -1429,29 +1541,13 @@ sys_var_long_ptr(sys_var_chain *chain, c
 
 bool sys_var_long_ptr_global::check(THD *thd, set_var *var)
 {
-  return get_unsigned(thd, var);
+  return get_unsigned(thd, var, 0, GET_ULONG);
 }
 
 bool sys_var_long_ptr_global::update(THD *thd, set_var *var)
 {
-  ulonglong tmp= var->save_result.ulonglong_value;
   pthread_mutex_lock(guard);
-  if (option_limits)
-    *value= (ulong) fix_unsigned(thd, tmp, option_limits);
-  else
-  {
-#if SIZEOF_LONG < SIZEOF_LONG_LONG
-    /* Avoid overflows on 32 bit systems */
-    if (tmp > ULONG_MAX)
-    {
-      tmp= ULONG_MAX;
-      throw_bounds_warning(thd, TRUE, TRUE, name,
-                           (longlong) var->save_result.ulonglong_value);
-    }
-#endif
-    *value= (ulong) tmp;
-  }
-
+  *value= (ulong) var->save_result.ulonglong_value;
   pthread_mutex_unlock(guard);
   return 0;
 }
@@ -1471,10 +1567,8 @@ bool sys_var_ulonglong_ptr::update(THD *
 {
   ulonglong tmp= var->save_result.ulonglong_value;
   pthread_mutex_lock(&LOCK_global_system_variables);
-  if (option_limits)
-    *value= (ulonglong) fix_unsigned(thd, tmp, option_limits);
-  else
-    *value= (ulonglong) tmp;
+  bound_unsigned(thd, &tmp, option_limits);
+  *value= (ulonglong) tmp;
   pthread_mutex_unlock(&LOCK_global_system_variables);
   return 0;
 }
@@ -1524,36 +1618,18 @@ uchar *sys_var_enum_const::value_ptr(THD
 
 bool sys_var_thd_ulong::check(THD *thd, set_var *var)
 {
-  return (get_unsigned(thd, var) ||
-          (check_func && (*check_func)(thd, var)));
+  if (get_unsigned(thd, var, max_system_variables.*offset, GET_ULONG))
+    return TRUE;
+  DBUG_ASSERT(var->save_result.ulonglong_value <= ULONG_MAX);
+  return ((check_func && (*check_func)(thd, var)));
 }
 
 bool sys_var_thd_ulong::update(THD *thd, set_var *var)
 {
-  ulonglong tmp= var->save_result.ulonglong_value;
-
-  /* Don't use bigger value than given with --maximum-variable-name=.. */
-  if (tmp > max_system_variables.*offset)
-  {
-    throw_bounds_warning(thd, TRUE, TRUE, name, (longlong) tmp);
-    tmp= max_system_variables.*offset;
-  }
-
-  if (option_limits)
-    tmp= fix_unsigned(thd, tmp, option_limits);
-#if SIZEOF_LONG < SIZEOF_LONG_LONG
-  else if (tmp > ULONG_MAX)
-  {
-    tmp= ULONG_MAX;
-    throw_bounds_warning(thd, TRUE, TRUE, name, (longlong) var->save_result.ulonglong_value);
-  }
-#endif
-
-  DBUG_ASSERT(tmp <= ULONG_MAX);
   if (var->type == OPT_GLOBAL)
-    global_system_variables.*offset= (ulong) tmp;
+    global_system_variables.*offset= (ulong) var->save_result.ulonglong_value;
   else
-    thd->variables.*offset= (ulong) tmp;
+    thd->variables.*offset= (ulong) var->save_result.ulonglong_value;
 
   return 0;
 }
@@ -1591,8 +1667,8 @@ bool sys_var_thd_ha_rows::update(THD *th
   if ((ha_rows) tmp > max_system_variables.*offset)
     tmp= max_system_variables.*offset;
 
-  if (option_limits)
-    tmp= (ha_rows) fix_unsigned(thd, tmp, option_limits);
+  bound_unsigned(thd, &tmp, option_limits);
+
   if (var->type == OPT_GLOBAL)
   {
     /* Lock is needed to make things safe on 32 bit systems */
@@ -1633,27 +1709,21 @@ uchar *sys_var_thd_ha_rows::value_ptr(TH
 
 bool sys_var_thd_ulonglong::check(THD *thd, set_var *var)
 {
-  return get_unsigned(thd, var);
+  return get_unsigned(thd, var, max_system_variables.*offset, GET_ULL);
 }
 
 bool sys_var_thd_ulonglong::update(THD *thd,  set_var *var)
 {
-  ulonglong tmp= var->save_result.ulonglong_value;
-
-  if (tmp > max_system_variables.*offset)
-    tmp= max_system_variables.*offset;
-
-  if (option_limits)
-    tmp= fix_unsigned(thd, tmp, option_limits);
   if (var->type == OPT_GLOBAL)
   {
     /* Lock is needed to make things safe on 32 bit systems */
     pthread_mutex_lock(&LOCK_global_system_variables);
-    global_system_variables.*offset= (ulonglong) tmp;
+    global_system_variables.*offset= (ulonglong)
+                                     var->save_result.ulonglong_value;
     pthread_mutex_unlock(&LOCK_global_system_variables);
   }
   else
-    thd->variables.*offset= (ulonglong) tmp;
+    thd->variables.*offset= (ulonglong) var->save_result.ulonglong_value;
   return 0;
 }
 
@@ -2285,10 +2355,10 @@ bool sys_var_key_buffer_size::update(THD
     goto end;
   }
 
-  key_cache->param_buff_size=
-    (ulonglong) fix_unsigned(thd, tmp, option_limits);
+  bound_unsigned(thd, &tmp, option_limits);
+  key_cache->param_buff_size= (ulonglong) tmp;
 
-  /* If key cache didn't existed initialize it, else resize it */
+  /* If key cache didn't exist initialize it, else resize it */
   key_cache->in_init= 1;
   pthread_mutex_unlock(&LOCK_global_system_variables);
 
@@ -2314,7 +2384,7 @@ end:
 */
 bool sys_var_key_cache_long::update(THD *thd, set_var *var)
 {
-  ulong tmp= (ulong) var->value->val_int();
+  ulonglong tmp= var->value->val_int();
   LEX_STRING *base_name= &var->base;
   bool error= 0;
 
@@ -2339,8 +2409,8 @@ bool sys_var_key_cache_long::update(THD 
   if (key_cache->in_init)
     goto end;
 
-  *((ulong*) (((char*) key_cache) + offset))=
-    (ulong) fix_unsigned(thd, tmp, option_limits);
+  bound_unsigned(thd, &tmp, option_limits);
+  *((ulong*) (((char*) key_cache) + offset))= (ulong) tmp;
 
   /*
     Don't create a new key cache if it didn't exist

=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt	2009-02-26 14:01:57 +0000
+++ b/sql/share/errmsg.txt	2009-03-05 11:20:01 +0000
@@ -6169,3 +6169,11 @@ ER_CONFLICT_FN_PARSE_ERROR
         eng "Error in parsing conflict function. Message: %-.64s"
 ER_EXCEPTIONS_WRITE_ERROR
         eng "Write to exceptions table failed. Message: %-.128s""
+
+ER_TOO_LONG_TABLE_COMMENT
+  eng "Comment for table '%-.64s' is too long (max = %lu)"
+  por "Coment�o para a tabela '%-.64s' �ongo demais (max = %lu)"
+
+ER_TOO_LONG_FIELD_COMMENT
+  eng "Comment for field '%-.64s' is too long (max = %lu)"
+  por "Coment�o para o campo '%-.64s' �ongo demais (max = %lu)"

=== modified file 'sql/sql_cache.cc'
--- a/sql/sql_cache.cc	2009-02-19 21:09:35 +0000
+++ b/sql/sql_cache.cc	2009-03-06 10:19:02 +0000
@@ -418,6 +418,43 @@ TYPELIB query_cache_type_typelib=
   array_elements(query_cache_type_names)-1,"", query_cache_type_names, NULL
 };
 
+
+/**
+  Helper function for determine if a SELECT statement has a SQL_NO_CACHE
+  directive.
+  
+  @param sql A pointer to the first white space character after SELECT
+  
+  @return
+   @retval TRUE The character string contains SQL_NO_CACHE
+   @retval FALSE No directive found.
+*/
+ 
+static bool has_no_cache_directive(char *sql)
+{
+  int i=0;
+  while (sql[i] == ' ')
+    ++i;
+    
+  if (my_toupper(system_charset_info, sql[i])    == 'S' &&
+      my_toupper(system_charset_info, sql[i+1])  == 'Q' &&
+      my_toupper(system_charset_info, sql[i+2])  == 'L' &&
+      my_toupper(system_charset_info, sql[i+3])  == '_' &&
+      my_toupper(system_charset_info, sql[i+4])  == 'N' &&
+      my_toupper(system_charset_info, sql[i+5])  == 'O' &&
+      my_toupper(system_charset_info, sql[i+6])  == '_' &&
+      my_toupper(system_charset_info, sql[i+7])  == 'C' &&
+      my_toupper(system_charset_info, sql[i+8])  == 'A' &&
+      my_toupper(system_charset_info, sql[i+9])  == 'C' &&
+      my_toupper(system_charset_info, sql[i+10]) == 'H' &&
+      my_toupper(system_charset_info, sql[i+11]) == 'E' &&
+      my_toupper(system_charset_info, sql[i+12]) == ' ')
+    return TRUE;
+  
+  return FALSE;       
+}
+
+
 /*****************************************************************************
  Query_cache_block_table method(s)
 *****************************************************************************/
@@ -1233,6 +1270,16 @@ Query_cache::send_result_to_client(THD *
       DBUG_PRINT("qcache", ("The statement is not a SELECT; Not cached"));
       goto err;
     }
+    
+    if (query_length > 20 && has_no_cache_directive(&sql[i+6]))
+    {
+      /*
+        We do not increase 'refused' statistics here since it will be done
+        later when the query is parsed.
+      */
+      DBUG_PRINT("qcache", ("The statement has a SQL_NO_CACHE directive"));
+      goto err;
+    }
   }
 
   STRUCT_LOCK(&structure_guard_mutex);

=== modified file 'sql/sql_lex.cc'
--- a/sql/sql_lex.cc	2009-01-05 16:10:20 +0000
+++ b/sql/sql_lex.cc	2009-03-05 14:22:33 +0000
@@ -1559,6 +1559,7 @@ void st_select_lex::init_query()
   exclude_from_table_unique_test= no_wrap_view_item= FALSE;
   nest_level= 0;
   link_next= 0;
+  lock_option= TL_READ_DEFAULT;
 }
 
 void st_select_lex::init_select()

=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h	2009-01-15 18:11:25 +0000
+++ b/sql/sql_lex.h	2009-03-05 14:22:33 +0000
@@ -688,6 +688,15 @@ public:
   int cur_pos_in_select_list;
 
   List<udf_func>     udf_list;                  /* udf function calls stack */
+
+  /**
+    Per sub-query locking strategy.
+    Note: This variable might interfer with the corresponding statement-level
+    variable Lex::lock_option because on how different parser rules depend
+    on eachother.
+  */
+  thr_lock_type lock_option;
+
   /* 
     This is a copy of the original JOIN USING list that comes from
     the parser. The parser :

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2009-03-05 10:23:46 +0000
+++ b/sql/sql_parse.cc	2009-03-06 09:52:43 +0000
@@ -5580,6 +5580,14 @@ void mysql_reset_thd_for_next_command(TH
 }
 
 
+/**
+  Resets the lex->current_select object.
+  @note It is assumed that lex->current_select != NULL
+
+  This function is a wrapper around select_lex->init_select() with an added
+  check for the special situation when using INTO OUTFILE and LOAD DATA.
+*/
+
 void
 mysql_init_select(LEX *lex)
 {
@@ -5594,6 +5602,18 @@ mysql_init_select(LEX *lex)
 }
 
 
+/**
+  Used to allocate a new SELECT_LEX object on the current thd mem_root and
+  link it into the relevant lists.
+
+  This function is always followed by mysql_init_select.
+
+  @see mysql_init_select
+
+  @retval TRUE An error occurred
+  @retval FALSE The new SELECT_LEX was successfully allocated.
+*/
+
 bool
 mysql_new_select(LEX *lex, bool move_down)
 {
@@ -6411,7 +6431,6 @@ void st_select_lex::set_lock_for_tables(
   DBUG_ENTER("set_lock_for_tables");
   DBUG_PRINT("enter", ("lock_type: %d  for_update: %d", lock_type,
 		       for_update));
-
   for (TABLE_LIST *tables= (TABLE_LIST*) table_list.first;
        tables;
        tables= tables->next_local)

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2009-02-16 11:38:15 +0000
+++ b/sql/sql_yacc.yy	2009-03-05 14:22:33 +0000
@@ -6489,7 +6489,8 @@ select_option:
           {
             if (check_simple_select())
               MYSQL_YYABORT;
-            Lex->lock_option= TL_READ_HIGH_PRIORITY;
+            Lex->lock_option=  TL_READ_HIGH_PRIORITY;
+            Lex->current_select->lock_option= TL_READ_HIGH_PRIORITY;
           }
         | DISTINCT         { Select->options|= SELECT_DISTINCT; }
         | SQL_SMALL_RESULT { Select->options|= SELECT_SMALL_RESULT; }
@@ -6535,6 +6536,7 @@ select_lock_type:
           {
             LEX *lex=Lex;
             lex->current_select->set_lock_for_tables(TL_WRITE);
+            lex->current_select->lock_option= TL_WRITE;
             lex->safe_to_cache_query=0;
           }
         | LOCK_SYM IN_SYM SHARE_SYM MODE_SYM
@@ -6542,6 +6544,7 @@ select_lock_type:
             LEX *lex=Lex;
             lex->current_select->
               set_lock_for_tables(TL_READ_WITH_SHARED_LOCKS);
+            lex->current_select->lock_option= TL_READ_WITH_SHARED_LOCKS;
             lex->safe_to_cache_query=0;
           }
         ;
@@ -12909,6 +12912,18 @@ subselect_start:
 subselect_end:
           {
             LEX *lex=Lex;
+            /*
+              Set the required lock level for the tables associated with the
+              current sub-select. This will overwrite previous lock options set
+              using st_select_lex::add_table_to_list in any of the following
+              rules: single_multi, table_wild_one, load_data, table_alias_ref,
+              table_factor.
+              The default lock level is TL_READ_DEFAULT but it can be modified
+              with query options specific for a certain (sub-)SELECT.
+            */
+            lex->current_select->
+              set_lock_for_tables(lex->current_select->lock_option);
+
             lex->pop_context();
             SELECT_LEX *child= lex->current_select;
             lex->current_select = lex->current_select->return_after_parsing();

=== modified file 'sql/unireg.cc'
--- a/sql/unireg.cc	2009-01-26 15:27:51 +0000
+++ b/sql/unireg.cc	2009-03-05 11:20:01 +0000
@@ -229,16 +229,16 @@ bool mysql_create_frm(THD *thd, const ch
                                               create_info->comment.length, 60);
   if (tmp_len < create_info->comment.length)
   {
-    (void) my_snprintf(buff, sizeof(buff), "Too long comment for table '%s'",
-                       table);
     if ((thd->variables.sql_mode &
          (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)))
     {
-      my_message(ER_UNKNOWN_ERROR, buff, MYF(0));
+      my_error(ER_TOO_LONG_TABLE_COMMENT, MYF(0), table, tmp_len);
       goto err;
     }
     push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
-                        ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR), buff);
+                        ER_TOO_LONG_TABLE_COMMENT,
+                        ER(ER_TOO_LONG_TABLE_COMMENT),
+                        table, tmp_len);
     create_info->comment.length= tmp_len;
   }
 
@@ -613,17 +613,16 @@ static bool pack_header(uchar *forminfo,
                                                      255);
     if (tmp_len < field->comment.length)
     {
-      char buff[128];
-      (void) my_snprintf(buff,sizeof(buff), "Too long comment for field '%s'",
-                         field->field_name);
       if ((current_thd->variables.sql_mode &
 	   (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)))
       {
-        my_message(ER_UNKNOWN_ERROR, buff, MYF(0));
+        my_error(ER_TOO_LONG_FIELD_COMMENT, MYF(0), field->field_name, tmp_len);
 	DBUG_RETURN(1);
       }
       push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
-                          ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR), buff);
+                          ER_TOO_LONG_FIELD_COMMENT,
+                          ER(ER_TOO_LONG_FIELD_COMMENT),
+                          field->field_name, tmp_len);
       field->comment.length= tmp_len;
     }
 

=== modified file 'storage/myisammrg/ha_myisammrg.cc'
--- a/storage/myisammrg/ha_myisammrg.cc	2009-02-12 11:12:07 +0000
+++ b/storage/myisammrg/ha_myisammrg.cc	2009-03-04 09:18:07 +0000
@@ -872,6 +872,16 @@ int ha_myisammrg::info(uint flag)
     table->s->crashed= 1;
 #endif
   stats.data_file_length= mrg_info.data_file_length;
+  if (mrg_info.errkey >= table_share->keys) 
+  {
+    /*
+     If value of errkey is higher than the number of keys
+     on the table set errkey to MAX_KEY. This will be
+     treated as unknown key case and error message generator
+     won't try to locate key causing segmentation fault.
+    */
+    mrg_info.errkey= MAX_KEY;
+  }
   errkey= mrg_info.errkey;
   table->s->keys_in_use.set_prefix(table->s->keys);
   stats.mean_rec_length= mrg_info.reclength;

Thread
bzr commit into mysql-5.1-bugteam branch (zhenxing.he:2837) Bug#37416Bug#39843 Bug#40363 Bug#40657 Bug#41305 Bug#41465 Bug#42790He Zhenxing9 Mar