MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:antony Date:August 3 2007 4:15pm
Subject:bk commit into 5.1 tree (antony:1.2569) BUG#10516
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of antony. When antony does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-08-03 09:14:49-07:00, antony@stripped +20 -0
  Bug#10516
    "getopt_ull_limit_value() does not show warnings or errors"
    Alter code so that when getopt_ull_limit_value() is used, there
    are checks performed to validate that the value is in range and
    to emit errors or warnings accordingly.
    New test: strict_variables

  mysql-test/r/cache_innodb.result@stripped, 2007-08-03 09:14:42-07:00, antony@stripped +2 -0
    change in results due to new warnings
    ---
    change in results due to new warnings

  mysql-test/r/delayed.result@stripped, 2007-08-03 09:14:42-07:00, antony@stripped +16 -0
    change in results due to new warnings

  mysql-test/r/index_merge_myisam.result@stripped, 2007-08-03 09:14:42-07:00, antony@stripped +2 -0
    change in results due to new warnings

  mysql-test/r/innodb_mysql.result@stripped, 2007-08-03 09:14:42-07:00, antony@stripped +2 -0
    change in results due to new warnings

  mysql-test/r/key_cache.result@stripped, 2007-08-03 09:14:42-07:00, antony@stripped +2 -0
    change in results due to new warnings

  mysql-test/r/packet.result@stripped, 2007-08-03 09:14:43-07:00, antony@stripped +8 -0
    change in results due to new warnings

  mysql-test/r/ps.result@stripped, 2007-08-03 09:14:43-07:00, antony@stripped +4 -0
    change in results due to new warnings

  mysql-test/r/query_cache.result@stripped, 2007-08-03 09:14:43-07:00, antony@stripped +10 -0
    change in results due to new warnings

  mysql-test/r/query_cache_ps_no_prot.result@stripped, 2007-08-03 09:14:43-07:00, antony@stripped +8 -0
    change in results due to new warnings

  mysql-test/r/sp.result@stripped, 2007-08-03 09:14:43-07:00, antony@stripped +2 -0
    change in results due to new warnings

  mysql-test/r/strict_variables.result@stripped, 2007-08-03 09:14:45-07:00, antony@stripped +110 -0
    New BitKeeper file ``mysql-test/r/strict_variables.result''

  mysql-test/r/strict_variables.result@stripped, 2007-08-03 09:14:45-07:00, antony@stripped +0 -0

  mysql-test/r/subselect.result@stripped, 2007-08-03 09:14:43-07:00, antony@stripped +4 -0
    change in results due to new warnings

  mysql-test/r/type_bit.result@stripped, 2007-08-03 09:14:44-07:00, antony@stripped +2 -0
    change in results due to new warnings

  mysql-test/r/type_bit_innodb.result@stripped, 2007-08-03 09:14:44-07:00, antony@stripped +2 -0
    change in results due to new warnings

  mysql-test/r/union.result@stripped, 2007-08-03 09:14:44-07:00, antony@stripped +2 -0
    change in results due to new warnings

  mysql-test/r/variables.result@stripped, 2007-08-03 09:14:44-07:00, antony@stripped +50 -0
    change in results due to new warnings

  mysql-test/t/strict_variables.test@stripped, 2007-08-03 09:14:45-07:00, antony@stripped +135 -0
    New BitKeeper file ``mysql-test/t/strict_variables.test''

  mysql-test/t/strict_variables.test@stripped, 2007-08-03 09:14:45-07:00, antony@stripped +0 -0

  sql/set_var.cc@stripped, 2007-08-03 09:14:44-07:00, antony@stripped +141 -31
    bug10516
      whenever getopt_ull_limit_value() is used, ensure that the value
      is checked and that warnings or errors are emitted as required.

  sql/set_var.h@stripped, 2007-08-03 09:14:44-07:00, antony@stripped +4 -0
    bug10516
      implement check() methods on some classes

  sql/sql_parse.cc@stripped, 2007-08-03 09:14:45-07:00, antony@stripped +1 -0
    reset value of thd->row_count for SET statements

diff -Nrup a/mysql-test/r/cache_innodb.result b/mysql-test/r/cache_innodb.result
--- a/mysql-test/r/cache_innodb.result	2006-11-21 12:32:49 -08:00
+++ b/mysql-test/r/cache_innodb.result	2007-08-03 09:14:42 -07:00
@@ -135,6 +135,8 @@ SHOW VARIABLES LIKE 'have_query_cache';
 Variable_name	Value
 have_query_cache	YES
 SET GLOBAL query_cache_size = 200000;
+Warnings:
+Warning	1264	Out of range value for column 'query_cache_size' at row 0
 flush status;
 SET @@autocommit=1;
 SET SESSION STORAGE_ENGINE = InnoDB;
diff -Nrup a/mysql-test/r/delayed.result b/mysql-test/r/delayed.result
--- a/mysql-test/r/delayed.result	2007-03-20 09:55:13 -07:00
+++ b/mysql-test/r/delayed.result	2007-08-03 09:14:42 -07:00
@@ -109,12 +109,20 @@ c1
 DROP TABLE t1;
 SET             @@auto_increment_offset=
 @bug20627_old_auto_increment_offset;
+Warnings:
+Warning	1264	Out of range value for column 'auto_increment_offset' at row 0
 SET             @@auto_increment_increment=
 @bug20627_old_auto_increment_increment;
+Warnings:
+Warning	1264	Out of range value for column 'auto_increment_increment' at row 0
 SET             @@session.auto_increment_offset=
 @bug20627_old_session_auto_increment_offset;
+Warnings:
+Warning	1264	Out of range value for column 'auto_increment_offset' at row 0
 SET             @@session.auto_increment_increment=
 @bug20627_old_session_auto_increment_increment;
+Warnings:
+Warning	1264	Out of range value for column 'auto_increment_increment' at row 0
 SET @bug20830_old_auto_increment_offset=
 @@auto_increment_offset= 2;
 SET @bug20830_old_auto_increment_increment=
@@ -237,12 +245,20 @@ SUM(c1)
 DROP TABLE t1;
 SET             @@auto_increment_offset=
 @bug20830_old_auto_increment_offset;
+Warnings:
+Warning	1264	Out of range value for column 'auto_increment_offset' at row 0
 SET             @@auto_increment_increment=
 @bug20830_old_auto_increment_increment;
+Warnings:
+Warning	1264	Out of range value for column 'auto_increment_increment' at row 0
 SET             @@session.auto_increment_offset=
 @bug20830_old_session_auto_increment_offset;
+Warnings:
+Warning	1264	Out of range value for column 'auto_increment_offset' at row 0
 SET             @@session.auto_increment_increment=
 @bug20830_old_session_auto_increment_increment;
+Warnings:
+Warning	1264	Out of range value for column 'auto_increment_increment' at row 0
 CREATE TABLE t1(a BIT);
 INSERT DELAYED INTO t1 VALUES(1);
 FLUSH TABLE t1;
diff -Nrup a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result
--- a/mysql-test/r/index_merge_myisam.result	2007-07-18 08:08:02 -07:00
+++ b/mysql-test/r/index_merge_myisam.result	2007-08-03 09:14:42 -07:00
@@ -342,6 +342,8 @@ create table t4 (a int);
 insert into t4 values (1),(4),(3);
 set @save_join_buffer_size=@@join_buffer_size;
 set join_buffer_size= 4000;
+Warnings:
+Warning	1264	Out of range value for column 'join_buffer_size' at row 0
 explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
 from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
 where (A.key1 < 500000 or A.key2 < 3)
diff -Nrup a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result
--- a/mysql-test/r/innodb_mysql.result	2007-07-25 13:23:36 -07:00
+++ b/mysql-test/r/innodb_mysql.result	2007-08-03 09:14:42 -07:00
@@ -672,6 +672,8 @@ INSERT INTO t1(b,c) SELECT b,c FROM t2;
 UPDATE t2 SET c='2007-01-03';
 INSERT INTO t1(b,c) SELECT b,c FROM t2;
 set @@sort_buffer_size=8192;
+Warnings:
+Warning	1264	Out of range value for column 'sort_buffer_size' at row 0
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 3072
diff -Nrup a/mysql-test/r/key_cache.result b/mysql-test/r/key_cache.result
--- a/mysql-test/r/key_cache.result	2007-06-07 01:39:10 -07:00
+++ b/mysql-test/r/key_cache.result	2007-08-03 09:14:42 -07:00
@@ -276,6 +276,8 @@ Variable_name	Value
 Key_blocks_unused	KEY_BLOCKS_UNUSED
 set global keycache2.key_buffer_size=0;
 set global keycache3.key_buffer_size=100;
+Warnings:
+Warning	1264	Out of range value for column 'key_buffer_size' at row 0
 set global keycache3.key_buffer_size=0;
 create table t1 (mytext text, FULLTEXT (mytext));
 insert t1 values ('aaabbb');
diff -Nrup a/mysql-test/r/packet.result b/mysql-test/r/packet.result
--- a/mysql-test/r/packet.result	2004-07-21 09:27:42 -07:00
+++ b/mysql-test/r/packet.result	2007-08-03 09:14:43 -07:00
@@ -1,7 +1,15 @@
 set global max_allowed_packet=100;
+Warnings:
+Warning	1264	Out of range value for column 'max_allowed_packet' at row 0
 set max_allowed_packet=100;
+Warnings:
+Warning	1264	Out of range value for column 'max_allowed_packet' at row 0
 set global net_buffer_length=100;
+Warnings:
+Warning	1264	Out of range value for column 'net_buffer_length' at row 0
 set net_buffer_length=100;
+Warnings:
+Warning	1264	Out of range value for column 'net_buffer_length' at row 0
 SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
 len
 1024
diff -Nrup a/mysql-test/r/ps.result b/mysql-test/r/ps.result
--- a/mysql-test/r/ps.result	2007-06-28 10:34:47 -07:00
+++ b/mysql-test/r/ps.result	2007-08-03 09:14:43 -07:00
@@ -803,10 +803,14 @@ select @@max_prepared_stmt_count;
 @@max_prepared_stmt_count
 16382
 set global max_prepared_stmt_count=-1;
+Warnings:
+Warning	1264	Out of range value for column 'max_prepared_stmt_count' at row 0
 select @@max_prepared_stmt_count;
 @@max_prepared_stmt_count
 0
 set global max_prepared_stmt_count=10000000000000000;
+Warnings:
+Warning	1264	Out of range value for column 'max_prepared_stmt_count' at row 0
 select @@max_prepared_stmt_count;
 @@max_prepared_stmt_count
 1048576
diff -Nrup a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
--- a/mysql-test/r/query_cache.result	2007-07-16 13:59:16 -07:00
+++ b/mysql-test/r/query_cache.result	2007-08-03 09:14:43 -07:00
@@ -559,6 +559,8 @@ AAA
 drop table t1;
 create table t1 (a int);
 set GLOBAL query_cache_size=1000;
+Warnings:
+Warning	1264	Out of range value for column 'query_cache_size' at row 0
 show global variables like "query_cache_size";
 Variable_name	Value
 query_cache_size	0
@@ -1395,6 +1397,8 @@ set GLOBAL query_cache_type=1;
 set GLOBAL query_cache_limit=10000;
 set GLOBAL query_cache_min_res_unit=0;
 set GLOBAL query_cache_size= 100000;
+Warnings:
+Warning	1264	Out of range value for column 'query_cache_size' at row 0
 reset query cache;
 set LOCAL default_week_format = 0;
 select week('2007-01-04');
@@ -1485,12 +1489,16 @@ set GLOBAL query_cache_limit=default;
 set GLOBAL query_cache_min_res_unit=default;
 set GLOBAL query_cache_size= default;
 set GLOBAL query_cache_size=1000000;
+Warnings:
+Warning	1264	Out of range value for column 'query_cache_size' at row 0
 create table t1 (a char);
 insert into t1 values ('c');
 a
 drop table t1;
 set GLOBAL query_cache_size= default;
 set GLOBAL query_cache_size=1000000;
+Warnings:
+Warning	1264	Out of range value for column 'query_cache_size' at row 0
 create table t1 (a char);
 insert into t1 values ('c');
 a
@@ -1501,6 +1509,8 @@ set GLOBAL query_cache_type=1;
 set GLOBAL query_cache_limit=10000;
 set GLOBAL query_cache_min_res_unit=0;
 set GLOBAL query_cache_size= 100000;
+Warnings:
+Warning	1264	Out of range value for column 'query_cache_size' at row 0
 flush tables;
 drop table if exists t1, t2;
 create table t1 (a int);
diff -Nrup a/mysql-test/r/query_cache_ps_no_prot.result b/mysql-test/r/query_cache_ps_no_prot.result
--- a/mysql-test/r/query_cache_ps_no_prot.result	2007-06-23 10:16:48 -07:00
+++ b/mysql-test/r/query_cache_ps_no_prot.result	2007-08-03 09:14:43 -07:00
@@ -2,6 +2,8 @@
 ---- switch to connection default ----
 set @initial_query_cache_size = @@global.query_cache_size;
 set @@global.query_cache_size=100000;
+Warnings:
+Warning	1264	Out of range value for column 'query_cache_size' at row 0
 flush status;
 drop table if exists t1;
 create table t1(c1 int);
@@ -212,6 +214,8 @@ Variable_name	Value
 Qcache_hits	16
 ---- switch to connection default ----
 set global query_cache_size=100000;
+Warnings:
+Warning	1264	Out of range value for column 'query_cache_size' at row 0
 execute stmt1;
 c1
 10
@@ -298,6 +302,8 @@ prepare stmt1 from "select * from t1 whe
 prepare stmt3 from "select * from t1 where c1=10";
 ---- switch to connection default ----
 set global query_cache_size=100000;
+Warnings:
+Warning	1264	Out of range value for column 'query_cache_size' at row 0
 show status like 'Qcache_hits';
 Variable_name	Value
 Qcache_hits	21
@@ -345,6 +351,8 @@ Qcache_hits	21
 set global query_cache_size=0;
 prepare stmt1 from "select * from t1 where c1=?";
 set global query_cache_size=100000;
+Warnings:
+Warning	1264	Out of range value for column 'query_cache_size' at row 0
 show status like 'Qcache_hits';
 Variable_name	Value
 Qcache_hits	21
diff -Nrup a/mysql-test/r/sp.result b/mysql-test/r/sp.result
--- a/mysql-test/r/sp.result	2007-07-25 17:12:30 -07:00
+++ b/mysql-test/r/sp.result	2007-08-03 09:14:43 -07:00
@@ -3155,6 +3155,8 @@ return @x;
 end|
 set @qcs1 = @@query_cache_size|
 set global query_cache_size = 100000|
+Warnings:
+Warning	1264	Out of range value for column 'query_cache_size' at row 0
 set @x = 1|
 insert into t1 values ("qc", 42)|
 select bug9902() from t1|
diff -Nrup a/mysql-test/r/strict_variables.result b/mysql-test/r/strict_variables.result
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/r/strict_variables.result	2007-08-03 09:14:45 -07:00
@@ -0,0 +1,110 @@
+set @org_mode=@@sql_mode;
+set @@sql_mode='ansi,traditional';
+select @@sql_mode;
+@@sql_mode
+REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
+set GLOBAL max_prepared_stmt_count=-1;
+ERROR 22003: Out of range value for column 'max_prepared_stmt_count' at row 0
+set GLOBAL max_prepared_stmt_count=1048577;
+ERROR 22003: Out of range value for column 'max_prepared_stmt_count' at row 0
+set GLOBAL binlog_cache_size=4095;
+ERROR 22003: Out of range value for column 'binlog_cache_size' at row 0
+set GLOBAL binlog_cache_size=4294967296;
+ERROR 22003: Out of range value for column 'binlog_cache_size' at row 0
+set GLOBAL concurrent_insert=-1;
+ERROR 22003: Out of range value for column 'concurrent_insert' at row 0
+set GLOBAL concurrent_insert=3;
+ERROR 22003: Out of range value for column 'concurrent_insert' at row 0
+set GLOBAL connect_timeout=1;
+ERROR 22003: Out of range value for column 'connect_timeout' at row 0
+set GLOBAL connect_timeout=31536001;
+ERROR 22003: Out of range value for column 'connect_timeout' at row 0
+set GLOBAL delayed_insert_limit=0;
+ERROR 22003: Out of range value for column 'delayed_insert_limit' at row 0
+set GLOBAL delayed_insert_limit=4294967296;
+ERROR 22003: Out of range value for column 'delayed_insert_limit' at row 0
+set GLOBAL delayed_insert_timeout=0;
+ERROR 22003: Out of range value for column 'delayed_insert_timeout' at row 0
+set GLOBAL delayed_insert_timeout=31536001;
+ERROR 22003: Out of range value for column 'delayed_insert_timeout' at row 0
+set GLOBAL delayed_queue_size=0;
+ERROR 22003: Out of range value for column 'delayed_queue_size' at row 0
+set GLOBAL delayed_queue_size=4294967296;
+ERROR 22003: Out of range value for column 'delayed_queue_size' at row 0
+set GLOBAL flush_time=-1;
+ERROR 22003: Out of range value for column 'flush_time' at row 0
+set GLOBAL flush_time=31536001;
+ERROR 22003: Out of range value for column 'flush_time' at row 0
+set GLOBAL max_binlog_size=4095;
+ERROR 22003: Out of range value for column 'max_binlog_size' at row 0
+set GLOBAL max_binlog_size=4294967296;
+ERROR 22003: Out of range value for column 'max_binlog_size' at row 0
+set GLOBAL max_connections=0;
+ERROR 22003: Out of range value for column 'max_connections' at row 0
+set GLOBAL max_connections=100001;
+ERROR 22003: Out of range value for column 'max_connections' at row 0
+set GLOBAL max_connect_errors=0;
+ERROR 22003: Out of range value for column 'max_connect_errors' at row 0
+set GLOBAL max_connect_errors=4294967296;
+ERROR 22003: Out of range value for column 'max_connect_errors' at row 0
+set GLOBAL max_relay_log_size=-1;
+ERROR 22003: Out of range value for column 'max_relay_log_size' at row 0
+set GLOBAL max_relay_log_size=1073741825;
+ERROR 22003: Out of range value for column 'max_relay_log_size' at row 0
+set GLOBAL max_write_lock_count=0;
+ERROR 22003: Out of range value for column 'max_write_lock_count' at row 0
+set GLOBAL max_write_lock_count=4294967296;
+ERROR 22003: Out of range value for column 'max_write_lock_count' at row 0
+set GLOBAL myisam_data_pointer_size=1;
+ERROR 22003: Out of range value for column 'myisam_data_pointer_size' at row 0
+set GLOBAL myisam_data_pointer_size=8;
+ERROR 22003: Out of range value for column 'myisam_data_pointer_size' at row 0
+set GLOBAL query_cache_size=-1;
+ERROR 22003: Out of range value for column 'query_cache_size' at row 0
+set GLOBAL query_cache_size=4294967296;
+ERROR 22003: Out of range value for column 'query_cache_size' at row 0
+set GLOBAL slow_launch_time=-1;
+ERROR 22003: Out of range value for column 'slow_launch_time' at row 0
+set GLOBAL slow_launch_time=31536001;
+ERROR 22003: Out of range value for column 'slow_launch_time' at row 0
+set GLOBAL table_definition_cache=0;
+ERROR 22003: Out of range value for column 'table_definition_cache' at row 0
+set GLOBAL table_definition_cache=524289;
+ERROR 22003: Out of range value for column 'table_definition_cache' at row 0
+set GLOBAL table_open_cache=0;
+ERROR 22003: Out of range value for column 'table_open_cache' at row 0
+set GLOBAL table_open_cache=524289;
+ERROR 22003: Out of range value for column 'table_open_cache' at row 0
+set GLOBAL table_lock_wait_timeout=0;
+ERROR 22003: Out of range value for column 'table_lock_wait_timeout' at row 0
+set GLOBAL table_lock_wait_timeout=1073741825;
+ERROR 22003: Out of range value for column 'table_lock_wait_timeout' at row 0
+set GLOBAL thread_cache_size=-1;
+ERROR 22003: Out of range value for column 'thread_cache_size' at row 0
+set GLOBAL thread_cache_size=16385;
+ERROR 22003: Out of range value for column 'thread_cache_size' at row 0
+set @@max_heap_table_size=16383;
+ERROR 22003: Out of range value for column 'max_heap_table_size' at row 0
+set @@max_heap_table_size=4294967296;
+ERROR 22003: Out of range value for column 'max_heap_table_size' at row 0
+set @@tmp_table_size=1023;
+ERROR 22003: Out of range value for column 'tmp_table_size' at row 0
+set @@tmp_table_size=4294967296;
+ERROR 22003: Out of range value for column 'tmp_table_size' at row 0
+set GLOBAL key_buffer_size=1;
+ERROR 22003: Out of range value for column 'key_buffer_size' at row 0
+set GLOBAL key_buffer_size=4294967296;
+ERROR 22003: Out of range value for column 'key_buffer_size' at row 0
+set GLOBAL key_cache_block_size=511;
+ERROR 22003: Out of range value for column 'key_cache_block_size' at row 0
+set GLOBAL key_cache_block_size=16385;
+ERROR 22003: Out of range value for column 'key_cache_block_size' at row 0
+set GLOBAL key_cache_division_limit=-1;
+ERROR 22003: Out of range value for column 'key_cache_division_limit' at row 0
+set GLOBAL key_cache_division_limit=101;
+ERROR 22003: Out of range value for column 'key_cache_division_limit' at row 0
+set GLOBAL key_cache_age_threshold=99;
+ERROR 22003: Out of range value for column 'key_cache_age_threshold' at row 0
+set GLOBAL key_cache_age_threshold=4294967296;
+ERROR 22003: Out of range value for column 'key_cache_age_threshold' at row 0
+set @@sql_mode=@org_mode;
diff -Nrup a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
--- a/mysql-test/r/subselect.result	2007-06-30 22:50:03 -07:00
+++ b/mysql-test/r/subselect.result	2007-08-03 09:14:43 -07:00
@@ -3666,6 +3666,8 @@ CREATE TABLE t1 (a int, b int auto_incre
 CREATE TABLE t2 (x int auto_increment, y int, z int,
 PRIMARY KEY (x), FOREIGN KEY (y) REFERENCES t1 (b));
 SET SESSION sort_buffer_size = 32 * 1024;
+Warnings:
+Warning	1264	Out of range value for column 'sort_buffer_size' at row 0
 SELECT SQL_NO_CACHE COUNT(*) 
 FROM (SELECT  a, b, (SELECT x FROM t2 WHERE y=b ORDER BY z DESC LIMIT 1) c
 FROM t1) t;
@@ -4101,6 +4103,8 @@ INSERT INTO `t1` VALUES ('asdf','2007-02
 INSERT INTO `t2` VALUES ('abcdefghijk');
 INSERT INTO `t2` VALUES ('asdf');
 SET session sort_buffer_size=8192;
+Warnings:
+Warning	1264	Out of range value for column 'sort_buffer_size' at row 0
 SELECT (SELECT 1 FROM  t1 WHERE t1.a=t2.a ORDER BY t1.b LIMIT 1) AS d1 FROM t2;
 d1
 1
diff -Nrup a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result
--- a/mysql-test/r/type_bit.result	2007-05-29 04:24:10 -07:00
+++ b/mysql-test/r/type_bit.result	2007-08-03 09:14:44 -07:00
@@ -269,6 +269,8 @@ a+0	b+0
 56	379
 68	454
 set @@max_length_for_sort_data=0;
+Warnings:
+Warning	1264	Out of range value for column 'max_length_for_sort_data' at row 0
 select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
 a+0	b+0
 57	135
diff -Nrup a/mysql-test/r/type_bit_innodb.result b/mysql-test/r/type_bit_innodb.result
--- a/mysql-test/r/type_bit_innodb.result	2007-01-18 03:59:33 -08:00
+++ b/mysql-test/r/type_bit_innodb.result	2007-08-03 09:14:44 -07:00
@@ -269,6 +269,8 @@ a+0	b+0
 56	379
 68	454
 set @@max_length_for_sort_data=0;
+Warnings:
+Warning	1264	Out of range value for column 'max_length_for_sort_data' at row 0
 select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
 a+0	b+0
 57	135
diff -Nrup a/mysql-test/r/union.result b/mysql-test/r/union.result
--- a/mysql-test/r/union.result	2007-05-29 05:57:47 -07:00
+++ b/mysql-test/r/union.result	2007-08-03 09:14:44 -07:00
@@ -1305,6 +1305,8 @@ SELECT @tmp_max:= @@max_allowed_packet;
 @tmp_max:= @@max_allowed_packet
 1048576
 SET max_allowed_packet=25000000;
+Warnings:
+Warning	1264	Out of range value for column 'max_allowed_packet' at row 0
 CREATE TABLE t1 (a mediumtext);
 CREATE TABLE t2 (b varchar(20));
 INSERT INTO t1 VALUES ('a');
diff -Nrup a/mysql-test/r/variables.result b/mysql-test/r/variables.result
--- a/mysql-test/r/variables.result	2007-06-06 03:59:18 -07:00
+++ b/mysql-test/r/variables.result	2007-08-03 09:14:44 -07:00
@@ -212,7 +212,11 @@ select * from information_schema.global_
 VARIABLE_NAME	VARIABLE_VALUE
 STORAGE_ENGINE	MRG_MYISAM
 set GLOBAL query_cache_size=100000;
+Warnings:
+Warning	1264	Out of range value for column 'query_cache_size' at row 0
 set GLOBAL myisam_max_sort_file_size=2000000;
+Warnings:
+Warning	1264	Out of range value for column 'myisam_max_sort_file_size' at row 0
 show global variables like 'myisam_max_sort_file_size';
 Variable_name	Value
 myisam_max_sort_file_size	1048576
@@ -254,6 +258,8 @@ NET_READ_TIMEOUT	600
 NET_RETRY_COUNT	10
 NET_WRITE_TIMEOUT	500
 set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
+Warnings:
+Warning	1264	Out of range value for column 'net_buffer_length' at row 0
 show global variables like 'net_%';
 Variable_name	Value
 net_buffer_length	1024
@@ -279,6 +285,8 @@ NET_READ_TIMEOUT	600
 NET_RETRY_COUNT	10
 NET_WRITE_TIMEOUT	500
 set net_buffer_length=1;
+Warnings:
+Warning	1264	Out of range value for column 'net_buffer_length' at row 0
 show variables like 'net_buffer_length';
 Variable_name	Value
 net_buffer_length	1024
@@ -286,6 +294,8 @@ select * from information_schema.session
 VARIABLE_NAME	VARIABLE_VALUE
 NET_BUFFER_LENGTH	1024
 set net_buffer_length=2000000000;
+Warnings:
+Warning	1264	Out of range value for column 'net_buffer_length' at row 0
 show variables like 'net_buffer_length';
 Variable_name	Value
 net_buffer_length	1048576
@@ -322,9 +332,15 @@ TRANSACTION_ALLOC_BLOCK_SIZE	8192
 TRANSACTION_PREALLOC_SIZE	4096
 set @@range_alloc_block_size=1024*16;
 set @@query_alloc_block_size=1024*17+2;
+Warnings:
+Warning	1264	Out of range value for column 'query_alloc_block_size' at row 0
 set @@query_prealloc_size=1024*18;
 set @@transaction_alloc_block_size=1024*20-1;
+Warnings:
+Warning	1264	Out of range value for column 'transaction_alloc_block_size' at row 0
 set @@transaction_prealloc_size=1024*21-1;
+Warnings:
+Warning	1264	Out of range value for column 'transaction_prealloc_size' at row 0
 select @@query_alloc_block_size;
 @@query_alloc_block_size
 17408
@@ -414,6 +430,8 @@ select @@autocommit, @@big_tables;
 @@autocommit	@@big_tables
 1	1
 set global binlog_cache_size=100;
+Warnings:
+Warning	1264	Out of range value for column 'binlog_cache_size' at row 0
 set bulk_insert_buffer_size=100;
 set character set cp1251_koi8;
 set character set default;
@@ -442,17 +460,27 @@ set global flush_time=100;
 set insert_id=1;
 set interactive_timeout=100;
 set join_buffer_size=100;
+Warnings:
+Warning	1264	Out of range value for column 'join_buffer_size' at row 0
 set last_insert_id=1;
 set global local_infile=1;
 set long_query_time=100;
 set low_priority_updates=1;
 set max_allowed_packet=100;
+Warnings:
+Warning	1264	Out of range value for column 'max_allowed_packet' at row 0
 set global max_binlog_cache_size=100;
+Warnings:
+Warning	1264	Out of range value for column 'max_binlog_cache_size' at row 0
 set global max_binlog_size=100;
+Warnings:
+Warning	1264	Out of range value for column 'max_binlog_size' at row 0
 set global max_connect_errors=100;
 set global max_connections=100;
 set global max_delayed_threads=100;
 set max_heap_table_size=100;
+Warnings:
+Warning	1264	Out of range value for column 'max_heap_table_size' at row 0
 set max_join_size=100;
 set max_sort_length=100;
 set max_tmp_tables=100;
@@ -463,17 +491,27 @@ select @@max_user_connections;
 set global max_write_lock_count=100;
 set myisam_sort_buffer_size=100;
 set net_buffer_length=100;
+Warnings:
+Warning	1264	Out of range value for column 'net_buffer_length' at row 0
 set net_read_timeout=100;
 set net_write_timeout=100;
 set global query_cache_limit=100;
 set global query_cache_size=100;
+Warnings:
+Warning	1264	Out of range value for column 'query_cache_size' at row 0
 set global query_cache_type=demand;
 set read_buffer_size=100;
+Warnings:
+Warning	1264	Out of range value for column 'read_buffer_size' at row 0
 set read_rnd_buffer_size=100;
+Warnings:
+Warning	1264	Out of range value for column 'read_rnd_buffer_size' at row 0
 set global rpl_recovery_rank=100;
 set global server_id=100;
 set global slow_launch_time=100;
 set sort_buffer_size=100;
+Warnings:
+Warning	1264	Out of range value for column 'sort_buffer_size' at row 0
 set @@max_sp_recursion_depth=10;
 select @@max_sp_recursion_depth;
 @@max_sp_recursion_depth
@@ -513,6 +551,8 @@ set storage_engine=myisam;
 set global thread_cache_size=100;
 set timestamp=1, timestamp=default;
 set tmp_table_size=100;
+Warnings:
+Warning	1264	Out of range value for column 'tmp_table_size' at row 0
 set tx_isolation="READ-COMMITTED";
 set wait_timeout=100;
 set log_warnings=1;
@@ -543,6 +583,8 @@ create table t2 (a int not null auto_inc
 insert into t1 values(null),(null),(null);
 insert into t2 values(null),(null),(null);
 set global key_buffer_size=100000;
+Warnings:
+Warning	1264	Out of range value for column 'key_buffer_size' at row 0
 select @@key_buffer_size;
 @@key_buffer_size
 98304
@@ -681,6 +723,8 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION
 VARIABLE_NAME	VARIABLE_VALUE
 MYISAM_DATA_POINTER_SIZE	7
 SET GLOBAL table_open_cache=-1;
+Warnings:
+Warning	1264	Out of range value for column 'table_open_cache' at row 0
 SHOW VARIABLES LIKE 'table_open_cache';
 Variable_name	Value
 table_open_cache	1
@@ -802,14 +846,20 @@ ERROR HY000: Variable 'warning_count' is
 set @@global.error_count=1;
 ERROR HY000: Variable 'error_count' is a read only variable
 set @@max_heap_table_size= 4294967296;
+Warnings:
+Warning	1264	Out of range value for column 'max_heap_table_size' at row 0
 select @@max_heap_table_size > 0;
 @@max_heap_table_size > 0
 1
 set global max_heap_table_size= 4294967296;
+Warnings:
+Warning	1264	Out of range value for column 'max_heap_table_size' at row 0
 select @@max_heap_table_size > 0;
 @@max_heap_table_size > 0
 1
 set @@max_heap_table_size= 4294967296;
+Warnings:
+Warning	1264	Out of range value for column 'max_heap_table_size' at row 0
 select @@max_heap_table_size > 0;
 @@max_heap_table_size > 0
 1
diff -Nrup a/mysql-test/t/strict_variables.test b/mysql-test/t/strict_variables.test
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/t/strict_variables.test	2007-08-03 09:14:45 -07:00
@@ -0,0 +1,135 @@
+# Testing of "strict" mode
+
+set @org_mode=@@sql_mode;
+set @@sql_mode='ansi,traditional';
+select @@sql_mode;
+
+# testing class sys_var_ulonglong_ptr
+# no variables to test.
+
+# testing class sys_var_long_ptr_global
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL max_prepared_stmt_count=-1;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL max_prepared_stmt_count=1048577;
+
+# testing class sys_var_long_ptr
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL binlog_cache_size=4095;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL binlog_cache_size=4294967296;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL concurrent_insert=-1;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL concurrent_insert=3;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL connect_timeout=1;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL connect_timeout=31536001;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL delayed_insert_limit=0;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL delayed_insert_limit=4294967296;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL delayed_insert_timeout=0;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL delayed_insert_timeout=31536001;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL delayed_queue_size=0;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL delayed_queue_size=4294967296;
+#expire_logs_days
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL flush_time=-1;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL flush_time=31536001;
+# max_binlog_cache_size
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL max_binlog_size=4095;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL max_binlog_size=4294967296;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL max_connections=0;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL max_connections=100001;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL max_connect_errors=0;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL max_connect_errors=4294967296;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL max_relay_log_size=-1;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL max_relay_log_size=1073741825;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL max_write_lock_count=0;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL max_write_lock_count=4294967296;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL myisam_data_pointer_size=1;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL myisam_data_pointer_size=8;
+#rpl_recovery_rank 
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL query_cache_size=-1;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL query_cache_size=4294967296;
+#server_id 
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL slow_launch_time=-1;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL slow_launch_time=31536001;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL table_definition_cache=0;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL table_definition_cache=524289;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL table_open_cache=0;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL table_open_cache=524289;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL table_lock_wait_timeout=0;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL table_lock_wait_timeout=1073741825;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL thread_cache_size=-1;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL thread_cache_size=16385;
+
+# testing class sys_var_thd_ha_rows
+#--error ER_WARN_DATA_OUT_OF_RANGE
+#set @@max_join_size=-1;
+#--error ER_WARN_DATA_OUT_OF_RANGE
+#set @@max_join_size=4294967296;
+# sql_select_limit 
+
+# testing class sys_var_thd_ulonglong
+--error ER_WARN_DATA_OUT_OF_RANGE
+set @@max_heap_table_size=16383;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set @@max_heap_table_size=4294967296;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set @@tmp_table_size=1023;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set @@tmp_table_size=4294967296;
+
+# testing class sys_var_key_cache_param
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL key_buffer_size=1;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL key_buffer_size=4294967296;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL key_cache_block_size=511;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL key_cache_block_size=16385;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL key_cache_division_limit=-1;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL key_cache_division_limit=101;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL key_cache_age_threshold=99;
+--error ER_WARN_DATA_OUT_OF_RANGE
+set GLOBAL key_cache_age_threshold=4294967296;
+
+# end
+
+set @@sql_mode=@org_mode;
diff -Nrup a/sql/set_var.cc b/sql/set_var.cc
--- a/sql/set_var.cc	2007-07-23 21:01:18 -07:00
+++ b/sql/set_var.cc	2007-08-03 09:14:44 -07:00
@@ -1105,19 +1105,35 @@ sys_var_long_ptr(sys_var_chain *chain, c
 
 bool sys_var_long_ptr_global::check(THD *thd, set_var *var)
 {
-  longlong v= var->value->val_int();
-  var->save_result.ulonglong_value= v < 0 ? 0 : v;
-  return 0;
+  bool result= sys_var_global::check(thd, var);
+  longlong v= (longlong) var->save_result.ulonglong_value;
+  ulonglong tmp= v < 0 ? 0 : v;
+
+  if (option_limits)
+    tmp= (ulong) getopt_ull_limit_value(tmp, option_limits);
+  else
+    tmp= (ulong) tmp;
+
+  if (!result && tmp != var->save_result.ulonglong_value)
+  {
+    if ((result= thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES |
+                                            MODE_STRICT_ALL_TABLES)))
+      my_error(ER_WARN_DATA_OUT_OF_RANGE, MYF(0), name, thd->row_count);
+    else
+      push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 
+                          ER_WARN_DATA_OUT_OF_RANGE,
+                          ER(ER_WARN_DATA_OUT_OF_RANGE), name, thd->row_count);
+  }
+
+  var->save_result.ulonglong_value= tmp;
+  return result;
 }
 
+
 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) getopt_ull_limit_value(tmp, option_limits);
-  else
-    *value= (ulong) tmp;
+  *value= (ulong) var->save_result.ulonglong_value;
   pthread_mutex_unlock(guard);
   return 0;
 }
@@ -1131,19 +1147,37 @@ void sys_var_long_ptr_global::set_defaul
 }
 
 
-bool sys_var_ulonglong_ptr::update(THD *thd, set_var *var)
+bool sys_var_ulonglong_ptr::check(THD *thd, set_var *var)
 {
+  bool result= sys_var::check(thd, var);
   ulonglong tmp= var->save_result.ulonglong_value;
-  pthread_mutex_lock(&LOCK_global_system_variables);
+
   if (option_limits)
-    *value= (ulonglong) getopt_ull_limit_value(tmp, option_limits);
-  else
-    *value= (ulonglong) tmp;
+    tmp= (ulonglong) getopt_ull_limit_value(tmp, option_limits);
+
+  if (!result && tmp != var->save_result.ulonglong_value)
+  {
+    if ((result= thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES |
+                                            MODE_STRICT_ALL_TABLES)))
+      my_error(ER_WARN_DATA_OUT_OF_RANGE, MYF(0), name, thd->row_count);
+    else
+      push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 
+                          ER_WARN_DATA_OUT_OF_RANGE,
+                          ER(ER_WARN_DATA_OUT_OF_RANGE), name, thd->row_count);
+  }
+  var->save_result.ulonglong_value= tmp;
+  return result;
+}
+
+
+bool sys_var_ulonglong_ptr::update(THD *thd, set_var *var)
+{
+  pthread_mutex_lock(&LOCK_global_system_variables);
+  *value= var->save_result.ulonglong_value;
   pthread_mutex_unlock(&LOCK_global_system_variables);
   return 0;
 }
 
-
 void sys_var_ulonglong_ptr::set_default(THD *thd, enum_var_type type)
 {
   pthread_mutex_lock(&LOCK_global_system_variables);
@@ -1179,12 +1213,11 @@ uchar *sys_var_enum::value_ptr(THD *thd,
 
 bool sys_var_thd_ulong::check(THD *thd, set_var *var)
 {
-  return (sys_var_thd::check(thd, var) ||
+  bool rc= (sys_var_thd::check(thd, var) ||
           (check_func && (*check_func)(thd, var)));
-}
+  if (rc)
+    return TRUE;
 
-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=.. */
@@ -1199,10 +1232,29 @@ bool sys_var_thd_ulong::update(THD *thd,
 
   if (option_limits)
     tmp= (ulong) getopt_ull_limit_value(tmp, option_limits);
+
+  if (!rc && tmp != var->save_result.ulonglong_value)
+  {
+    if ((rc= thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES |
+                                        MODE_STRICT_ALL_TABLES)))
+      my_error(ER_WARN_DATA_OUT_OF_RANGE, MYF(0), name, thd->row_count);
+    else
+      push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 
+                          ER_WARN_DATA_OUT_OF_RANGE,
+                          ER(ER_WARN_DATA_OUT_OF_RANGE), name, thd->row_count);
+  }
+
+  var->save_result.ulonglong_value= tmp;
+  return rc;
+}
+
+
+bool sys_var_thd_ulong::update(THD *thd, set_var *var)
+{
   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;
 }
 
@@ -1228,8 +1280,9 @@ uchar *sys_var_thd_ulong::value_ptr(THD 
 }
 
 
-bool sys_var_thd_ha_rows::update(THD *thd, set_var *var)
+bool sys_var_thd_ha_rows::check(THD *thd, set_var *var)
 {
+  sys_var_thd::check(thd, var);
   ulonglong tmp= var->save_result.ulonglong_value;
 
   /* Don't use bigger value than given with --maximum-variable-name=.. */
@@ -1238,15 +1291,25 @@ bool sys_var_thd_ha_rows::update(THD *th
 
   if (option_limits)
     tmp= (ha_rows) getopt_ull_limit_value(tmp, option_limits);
+
+  bool result= (thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES |
+                                           MODE_STRICT_ALL_TABLES)) &&
+                tmp != var->save_result.ulonglong_value;
+  var->save_result.ulonglong_value= tmp;
+  return result;
+}
+
+bool sys_var_thd_ha_rows::update(THD *thd, set_var *var)
+{
   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= (ha_rows) tmp;
+    global_system_variables.*offset= (ha_rows) var->save_result.ulonglong_value;
     pthread_mutex_unlock(&LOCK_global_system_variables);
   }
   else
-    thd->variables.*offset= (ha_rows) tmp;
+    thd->variables.*offset= (ha_rows) var->save_result.ulonglong_value;
   return 0;
 }
 
@@ -1273,8 +1336,9 @@ uchar *sys_var_thd_ha_rows::value_ptr(TH
   return (uchar*) &(thd->variables.*offset);
 }
 
-bool sys_var_thd_ulonglong::update(THD *thd,  set_var *var)
+bool sys_var_thd_ulonglong::check(THD *thd, set_var *var)
 {
+  bool result= sys_var_thd::check(thd, var);
   ulonglong tmp= var->save_result.ulonglong_value;
 
   if (tmp > max_system_variables.*offset)
@@ -1282,15 +1346,34 @@ bool sys_var_thd_ulonglong::update(THD *
 
   if (option_limits)
     tmp= getopt_ull_limit_value(tmp, option_limits);
+
+  if (!result && tmp != var->save_result.ulonglong_value)
+  {
+    if (thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES |
+                                   MODE_STRICT_ALL_TABLES))
+      my_error(ER_WARN_DATA_OUT_OF_RANGE, MYF(0), name, thd->row_count);
+    else
+      push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 
+                          ER_WARN_DATA_OUT_OF_RANGE,
+                          ER(ER_WARN_DATA_OUT_OF_RANGE), name, thd->row_count);
+  }
+  
+  var->save_result.ulonglong_value= tmp;
+  return result;
+}
+
+
+bool sys_var_thd_ulonglong::update(THD *thd,  set_var *var)
+{
   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= var->save_result.ulonglong_value;
     pthread_mutex_unlock(&LOCK_global_system_variables);
   }
   else
-    thd->variables.*offset= (ulonglong) tmp;
+    thd->variables.*offset= var->save_result.ulonglong_value;
   return 0;
 }
 
@@ -1915,6 +1998,35 @@ uchar *sys_var_key_cache_param::value_pt
 }
 
 
+bool sys_var_key_cache_param::check(THD *thd, set_var *var)
+{
+  ulonglong tmp;
+  bool result;
+
+  if (!(result= sys_var::check(thd, var)) &&
+      (tmp= var->save_result.ulonglong_value))
+  {
+    DBUG_ASSERT(option_limits);
+
+    tmp= (ulong) getopt_ull_limit_value(tmp, option_limits);
+
+    if (tmp != var->save_result.ulonglong_value)
+    {
+      if (thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES |
+                                     MODE_STRICT_ALL_TABLES))
+        my_error(ER_WARN_DATA_OUT_OF_RANGE, MYF(0), name, thd->row_count);
+      else
+        push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 
+                            ER_WARN_DATA_OUT_OF_RANGE,
+                            ER(ER_WARN_DATA_OUT_OF_RANGE), name, thd->row_count);
+    }
+    var->save_result.ulonglong_value= tmp;
+  }
+
+  return result;
+}
+    
+
 bool sys_var_key_buffer_size::update(THD *thd, set_var *var)
 {
   ulonglong tmp= var->save_result.ulonglong_value;
@@ -1981,8 +2093,7 @@ bool sys_var_key_buffer_size::update(THD
     goto end;
   }
 
-  key_cache->param_buff_size=
-    (ulonglong) getopt_ull_limit_value(tmp, option_limits);
+  key_cache->param_buff_size= tmp;
 
   /* If key cache didn't existed initialize it, else resize it */
   key_cache->in_init= 1;
@@ -2004,7 +2115,7 @@ end:
 
 bool sys_var_key_cache_long::update(THD *thd, set_var *var)
 {
-  ulong tmp= (ulong) var->value->val_int();
+  ulonglong tmp= var->save_result.ulonglong_value;
   LEX_STRING *base_name= &var->base;
   bool error= 0;
 
@@ -2029,8 +2140,7 @@ bool sys_var_key_cache_long::update(THD 
   if (key_cache->in_init)
     goto end;
 
-  *((ulong*) (((char*) key_cache) + offset))=
-    (ulong) getopt_ull_limit_value(tmp, option_limits);
+  *((ulong*) (((char*) key_cache) + offset))= (ulong) tmp;
 
   /*
     Don't create a new key cache if it didn't exist
diff -Nrup a/sql/set_var.h b/sql/set_var.h
--- a/sql/set_var.h	2007-05-24 09:47:54 -07:00
+++ b/sql/set_var.h	2007-08-03 09:14:44 -07:00
@@ -151,6 +151,7 @@ public:
 		       sys_after_update_func func)
     :sys_var(name_arg,func), value(value_ptr_arg)
   { chain_sys_var(chain); }
+  bool check(THD *thd, set_var *var);
   bool update(THD *thd, set_var *var);
   void set_default(THD *thd, enum_var_type type);
   SHOW_TYPE show_type() { return SHOW_LONGLONG; }
@@ -352,6 +353,7 @@ public:
 		      sys_after_update_func func)
     :sys_var_thd(name_arg,func), offset(offset_arg)
   { chain_sys_var(chain); }
+  bool check(THD *thd, set_var *var);
   bool update(THD *thd, set_var *var);
   void set_default(THD *thd, enum_var_type type);
   SHOW_TYPE show_type() { return SHOW_HA_ROWS; }
@@ -374,6 +376,7 @@ public:
     :sys_var_thd(name_arg, func), offset(offset_arg),
     only_global(only_global_arg)
   { chain_sys_var(chain); }
+  bool check(THD *thd, set_var *var);
   bool update(THD *thd, set_var *var);
   void set_default(THD *thd, enum_var_type type);
   SHOW_TYPE show_type() { return SHOW_LONGLONG; }
@@ -704,6 +707,7 @@ public:
                           size_t offset_arg)
     :sys_var(name_arg), offset(offset_arg)
   { chain_sys_var(chain); }
+  bool check(THD *thd, set_var *var);
   uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
   bool check_default(enum_var_type type) { return 1; }
   bool is_struct() { return 1; }
diff -Nrup a/sql/sql_parse.cc b/sql/sql_parse.cc
--- a/sql/sql_parse.cc	2007-07-23 09:09:45 -07:00
+++ b/sql/sql_parse.cc	2007-08-03 09:14:45 -07:00
@@ -2981,6 +2981,7 @@ end_with_restore_list:
       my_error(ER_RESERVED_SYNTAX, MYF(0), "SET ONE_SHOT");
       goto error;
     }
+    thd->row_count= 0;
     if (!(res= sql_set_variables(thd, lex_var_list)))
     {
       /*
Thread
bk commit into 5.1 tree (antony:1.2569) BUG#10516antony3 Aug
  • Re: bk commit into 5.1 tree (antony:1.2569) BUG#10516Sergei Golubchik8 Aug