From 99a0ace460b9452f1ea547fd1c4dc082afcd1b08 Mon Sep 17 00:00:00 2001 From: Gleb Shchepa Date: Sat, 3 Apr 2010 00:30:22 +0400 Subject: [PATCH 1/8] Bug #40625: Concat fails on DOUBLE values in a Stored Procedure, while DECIMAL works Selecting of the CONCAT(......) result into a user variable may return wrong data. Item_func_concat::val_str contains a number of memory allocation-saving tricks. One of them concatenates strings inplace inserting the value of one string at the beginning of the other string. However, this trick didn't care about strings those points to the same data buffer: this is possible when a CONCAT() parameter is a stored procedure variable - Item_sp_variable::val_str() uses the intermediate Item_sp_variable::str_value field, where it may store a reference to an external buffer. The Item_func_concat::val_str function has been modified to take into account val_str functions (such as Item_sp_variable::val_str) that return a pointer to an internal Item member variable that may reference to a buffer provided. --- mysql-test/r/func_concat.result | 18 ++++++++++++++++++ mysql-test/t/func_concat.test | 20 ++++++++++++++++++++ sql/item_strfunc.cc | 2 +- 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/func_concat.result b/mysql-test/r/func_concat.result index c4c2b46c6c2..fae8979a6e7 100644 --- a/mysql-test/r/func_concat.result +++ b/mysql-test/r/func_concat.result @@ -130,4 +130,22 @@ SELECT @query; @query abcde,0,1234 DROP PROCEDURE p1; +# +# Bug #40625: Concat fails on DOUBLE values in a Stored Procedure, +# while DECIMAL works +# +CREATE PROCEDURE p1() +BEGIN +DECLARE v1 DOUBLE(10,3); +SET v1= 100; +SET @s = CONCAT('########################################', 40 , v1); +SELECT @s; +END;// +CALL p1(); +@s +########################################40100.000 +CALL p1(); +@s +########################################40100.000 +DROP PROCEDURE p1; # End of 5.1 tests diff --git a/mysql-test/t/func_concat.test b/mysql-test/t/func_concat.test index e24b4354b61..e56d1121808 100644 --- a/mysql-test/t/func_concat.test +++ b/mysql-test/t/func_concat.test @@ -124,4 +124,24 @@ SELECT @query; DROP PROCEDURE p1; +--echo # +--echo # Bug #40625: Concat fails on DOUBLE values in a Stored Procedure, +--echo # while DECIMAL works +--echo # + +DELIMITER //; +CREATE PROCEDURE p1() +BEGIN + DECLARE v1 DOUBLE(10,3); + SET v1= 100; + SET @s = CONCAT('########################################', 40 , v1); + SELECT @s; +END;// +DELIMITER ;// + +CALL p1(); +CALL p1(); + +DROP PROCEDURE p1; + --echo # End of 5.1 tests diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 66308215d0b..b53172d631a 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -324,7 +324,7 @@ String *Item_func_concat::val_str(String *str) } else if (str->alloced_length() >= res->length()+res2->length()) { - if (str == res2) + if (str->ptr() == res2->ptr()) str->replace(0,0,*res); else { From 416f32050ada4ef1c7ad38a180aca888315cd569 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Mon, 5 Apr 2010 16:10:26 +0500 Subject: [PATCH 2/8] Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355 The problem is that we can not use make_cond_for_table(). This function relies on used_tables() condition which is not set properly for subqueries. As result subquery is not filtered out. The fix is to use remove_eq_conds() function instead of make_cond_for_table() func. 'remove_eq_conds()' algorithm relies on const_item() value and it allows to handle subqueries in right way. --- mysql-test/r/having.result | 48 ++++++++++++++++++++++++++++++++++++-- mysql-test/t/having.test | 45 +++++++++++++++++++++++++++++++++++ sql/sql_select.cc | 10 ++++---- 3 files changed, 96 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result index 95893510987..54293e9d02e 100644 --- a/mysql-test/r/having.result +++ b/mysql-test/r/having.result @@ -472,7 +472,7 @@ HAVING (table2.f2 = 8 AND table1.f1 >= 6); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING noticed after reading const tables Warnings: -Note 1003 select `test`.`table1`.`f1` AS `f1`,'7' AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = '9')) group by `test`.`table1`.`f1`,'7' having (('7' = 8) and (`test`.`table1`.`f1` >= 6)) +Note 1003 select `test`.`table1`.`f1` AS `f1`,'7' AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = '9')) group by `test`.`table1`.`f1`,'7' having 0 EXPLAIN EXTENDED SELECT table1.f1, table2.f2 FROM t1 AS table1 @@ -483,6 +483,50 @@ HAVING (table2.f2 = 8); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING noticed after reading const tables Warnings: -Note 1003 select `test`.`table1`.`f1` AS `f1`,'7' AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = '9')) group by `test`.`table1`.`f1`,'7' having ('7' = 8) +Note 1003 select `test`.`table1`.`f1` AS `f1`,'7' AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = '9')) group by `test`.`table1`.`f1`,'7' having 0 DROP TABLE t1; +# +# Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355 +# +CREATE TABLE t1(f1 INT, f2 INT); +INSERT INTO t1 VALUES (10,8); +CREATE TABLE t2 (f1 INT); +INSERT INTO t2 VALUES (5); +SELECT COUNT(f1) FROM t2 +HAVING (7, 9) IN (SELECT f1, MIN(f2) FROM t1); +COUNT(f1) +DROP TABLE t1, t2; +CREATE TABLE t1 (f1 INT, f2 VARCHAR(1)); +INSERT INTO t1 VALUES (16,'f'); +INSERT INTO t1 VALUES (16,'f'); +CREATE TABLE t2 (f1 INT, f2 VARCHAR(1)); +INSERT INTO t2 VALUES (13,'f'); +INSERT INTO t2 VALUES (20,'f'); +CREATE TABLE t3 (f1 INT, f2 VARCHAR(1)); +INSERT INTO t3 VALUES (7,'f'); +SELECT t1.f2 FROM t1 +STRAIGHT_JOIN (t2 JOIN t3 ON t3.f2 = t2.f2 ) ON t3 .f2 = t2 .f2 +HAVING ('v', 'i') NOT IN (SELECT f2, MIN(f2) FROM t1) +ORDER BY f2; +f2 +f +f +f +f +DROP TABLES t1,t2,t3; +# +# Bug#52340 Segfault: read_cached_record (tab=0x94a2634) at sql_select.cc:14411 +# +CREATE TABLE t1 (f1 INT, f2 VARCHAR(1)); +INSERT INTO t1 VALUES (16,'d'); +CREATE TABLE t2 (f1 INT, f2 VARCHAR(1)); +INSERT INTO t2 VALUES (13,'e'); +INSERT INTO t2 VALUES (20,'d'); +SELECT MAX(t2.f2) FROM t2 JOIN t1 ON t1.f2 +HAVING ('e' , 'd') IN +(SELECT ts1.f2, ts2.f2 FROM t2 ts1 JOIN t2 ts2 ON ts1.f1) +ORDER BY t1.f2; +MAX(t2.f2) +NULL +DROP TABLE t1,t2; End of 5.0 tests diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test index b68ba69b975..65bf9518a5c 100644 --- a/mysql-test/t/having.test +++ b/mysql-test/t/having.test @@ -498,4 +498,49 @@ HAVING (table2.f2 = 8); DROP TABLE t1; +--echo # +--echo # Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355 +--echo # +CREATE TABLE t1(f1 INT, f2 INT); +INSERT INTO t1 VALUES (10,8); +CREATE TABLE t2 (f1 INT); +INSERT INTO t2 VALUES (5); + +SELECT COUNT(f1) FROM t2 +HAVING (7, 9) IN (SELECT f1, MIN(f2) FROM t1); + +DROP TABLE t1, t2; + +CREATE TABLE t1 (f1 INT, f2 VARCHAR(1)); +INSERT INTO t1 VALUES (16,'f'); +INSERT INTO t1 VALUES (16,'f'); +CREATE TABLE t2 (f1 INT, f2 VARCHAR(1)); +INSERT INTO t2 VALUES (13,'f'); +INSERT INTO t2 VALUES (20,'f'); +CREATE TABLE t3 (f1 INT, f2 VARCHAR(1)); +INSERT INTO t3 VALUES (7,'f'); + +SELECT t1.f2 FROM t1 +STRAIGHT_JOIN (t2 JOIN t3 ON t3.f2 = t2.f2 ) ON t3 .f2 = t2 .f2 +HAVING ('v', 'i') NOT IN (SELECT f2, MIN(f2) FROM t1) +ORDER BY f2; + +DROP TABLES t1,t2,t3; + +--echo # +--echo # Bug#52340 Segfault: read_cached_record (tab=0x94a2634) at sql_select.cc:14411 +--echo # +CREATE TABLE t1 (f1 INT, f2 VARCHAR(1)); +INSERT INTO t1 VALUES (16,'d'); +CREATE TABLE t2 (f1 INT, f2 VARCHAR(1)); +INSERT INTO t2 VALUES (13,'e'); +INSERT INTO t2 VALUES (20,'d'); + +SELECT MAX(t2.f2) FROM t2 JOIN t1 ON t1.f2 +HAVING ('e' , 'd') IN +(SELECT ts1.f2, ts2.f2 FROM t2 ts1 JOIN t2 ts2 ON ts1.f1) +ORDER BY t1.f2; + +DROP TABLE t1,t2; + --echo End of 5.0 tests diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 545f1cb6636..a426f4b68a1 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1125,13 +1125,13 @@ JOIN::optimize() elements may be lost during further having condition transformation in JOIN::exec. */ - if (having && !having->with_sum_func) + if (having && const_table_map) { - COND *const_cond= make_cond_for_table(having, const_table_map, 0); - DBUG_EXECUTE("where", print_where(const_cond, "const_having_cond", - QT_ORDINARY);); - if (const_cond && !const_cond->val_int()) + having->update_used_tables(); + having= remove_eq_conds(thd, having, &having_value); + if (having_value == Item::COND_FALSE) { + having= new Item_int((longlong) 0,1); zero_result_cause= "Impossible HAVING noticed after reading const tables"; DBUG_RETURN(0); } From e08507670486606bef7a9e462fa61bdf16340e12 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Tue, 6 Apr 2010 10:58:45 +0300 Subject: [PATCH 3/8] changed the version back --- .bzr-mysql/default.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index f79c1cd6319..557df1b1ffe 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] post_commit_to = "commits@lists.mysql.com" post_push_to = "commits@lists.mysql.com" -tree_name = "mysql-5.0" +tree_name = "mysql-5.0-bugteam" From 35f6b544c46026b9283cb3a06d874c84e8bbee8b Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Tue, 6 Apr 2010 12:26:59 +0500 Subject: [PATCH 4/8] Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817 We should disable const subselect item evaluation because subselect transformation does not happen in view_prepare_mode and thus val_...() methods can not be called. --- mysql-test/r/ctype_ucs.result | 8 ++++++++ mysql-test/r/view.result | 8 ++++++++ mysql-test/t/ctype_ucs.test | 9 +++++++++ mysql-test/t/view.test | 9 +++++++++ sql/item.cc | 11 ++++++++++- sql/item_subselect.cc | 15 +++++++++++++++ sql/item_subselect.h | 1 + 7 files changed, 60 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index abb21b7cee7..c9dcaf0f09c 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -1230,4 +1230,12 @@ SELECT HEX(DAYNAME(19700101)); HEX(DAYNAME(19700101)) 0427043504420432043504400433 SET character_set_connection=latin1; +# +# Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817 +# +CREATE TABLE t1 (a CHAR(1) CHARSET ascii, b CHAR(1) CHARSET latin1); +CREATE VIEW v1 AS SELECT 1 from t1 +WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1')); +DROP VIEW v1; +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index fa6f1939592..0aec44b70f1 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -3874,6 +3874,14 @@ CREATE VIEW v1 AS SELECT 1 FROM t1 WHERE ROW(1,1) >= ROW(1, (SELECT 1 FROM t1 WHERE f1 >= ANY ( SELECT '1' ))); DROP VIEW v1; DROP TABLE t1; +# +# Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817 +# +CREATE TABLE t1 (a CHAR(1) CHARSET latin1, b CHAR(1) CHARSET utf8); +CREATE VIEW v1 AS SELECT 1 from t1 +WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1')); +DROP VIEW v1; +DROP TABLE t1; # ----------------------------------------------------------------- # -- End of 5.1 tests. # ----------------------------------------------------------------- diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index 310576b9478..fd10ee3fdd6 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -732,4 +732,13 @@ SELECT HEX(MONTHNAME(19700101)); SELECT HEX(DAYNAME(19700101)); SET character_set_connection=latin1; +--echo # +--echo # Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817 +--echo # +CREATE TABLE t1 (a CHAR(1) CHARSET ascii, b CHAR(1) CHARSET latin1); +CREATE VIEW v1 AS SELECT 1 from t1 +WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1')); +DROP VIEW v1; +DROP TABLE t1; + --echo End of 5.0 tests diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 1d0796469f2..3736f53b288 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -3916,6 +3916,15 @@ ROW(1,1) >= ROW(1, (SELECT 1 FROM t1 WHERE f1 >= ANY ( SELECT '1' ))); DROP VIEW v1; DROP TABLE t1; +--echo # +--echo # Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817 +--echo # +CREATE TABLE t1 (a CHAR(1) CHARSET latin1, b CHAR(1) CHARSET utf8); +CREATE VIEW v1 AS SELECT 1 from t1 +WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1')); +DROP VIEW v1; +DROP TABLE t1; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.1 tests. --echo # ----------------------------------------------------------------- diff --git a/sql/item.cc b/sql/item.cc index 10da20beebe..3407d2fecd4 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1713,7 +1713,16 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname, if (!(conv= (*arg)->safe_charset_converter(coll.collation)) && ((*arg)->collation.repertoire == MY_REPERTOIRE_ASCII)) - conv= new Item_func_conv_charset(*arg, coll.collation, 1); + { + /* + We should disable const subselect item evaluation because + subselect transformation does not happen in view_prepare_mode + and thus val_...() methods can not be called for const items. + */ + bool resolve_const= ((*arg)->type() == Item::SUBSELECT_ITEM && + thd->lex->view_prepare_mode) ? FALSE : TRUE; + conv= new Item_func_conv_charset(*arg, coll.collation, resolve_const); + } if (!conv) { diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index f89ca2d7955..f3fcbc4db68 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -122,6 +122,21 @@ void Item_subselect::cleanup() DBUG_VOID_RETURN; } + +/* + We cannot use generic Item::safe_charset_converter() because + Subselect transformation does not happen in view_prepare_mode + and thus we can not evaluate val_...() for const items. +*/ + +Item *Item_subselect::safe_charset_converter(CHARSET_INFO *tocs) +{ + Item_func_conv_charset *conv= + new Item_func_conv_charset(this, tocs, thd->lex->view_prepare_mode ? 0 : 1); + return conv->safe ? conv : NULL; +} + + void Item_singlerow_subselect::cleanup() { DBUG_ENTER("Item_singlerow_subselect::cleanup"); diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 467e9b22637..3806e68e377 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -126,6 +126,7 @@ public: virtual void reset_value_registration() {} enum_parsing_place place() { return parsing_place; } bool walk(Item_processor processor, bool walk_subquery, uchar *arg); + Item *safe_charset_converter(CHARSET_INFO *tocs); /** Get the SELECT_LEX structure associated with this Item. From 327d3f3d58d5aa572f5cbe9f517b4fb290f4117a Mon Sep 17 00:00:00 2001 From: Omer BarNir Date: Tue, 6 Apr 2010 11:06:34 -0700 Subject: [PATCH 5/8] Updates to test files in the 'engines' suite following changes in 5.1.46 --- mysql-test/suite/engines/funcs/t/disabled.def | 6 +++++- mysql-test/suite/engines/iuds/r/insert_year.result | 4 ++-- .../suite/engines/iuds/r/update_delete_calendar.result | 3 --- mysql-test/suite/engines/iuds/t/disabled.def | 7 +++++++ mysql-test/suite/engines/iuds/t/insert_number.test | 5 +++++ .../suite/engines/iuds/t/update_delete_calendar.test | 5 +++++ 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/mysql-test/suite/engines/funcs/t/disabled.def b/mysql-test/suite/engines/funcs/t/disabled.def index 76b45ca76bf..2aca7006b4e 100644 --- a/mysql-test/suite/engines/funcs/t/disabled.def +++ b/mysql-test/suite/engines/funcs/t/disabled.def @@ -1,3 +1,7 @@ # List of disabled tests # test name : comment -#rpl_redirect : Fails due to bug#49978 +rpl_redirect : Fails due to bug#49978 +crash_manycolumns_string : Bug#50495 'Row size too large' for plugin, but works for built-in innodb +ix_unique_lob : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value +ix_unique_string_length : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value + diff --git a/mysql-test/suite/engines/iuds/r/insert_year.result b/mysql-test/suite/engines/iuds/r/insert_year.result index a365375b390..69d1139c037 100644 --- a/mysql-test/suite/engines/iuds/r/insert_year.result +++ b/mysql-test/suite/engines/iuds/r/insert_year.result @@ -986,7 +986,7 @@ c1 c2 c3 c4 2155 2155 1998-12-26 1998-12-26 11:30:45 SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t2; total_rows min_value max(c2) -20 1901 2155 +20 0 2155 SELECT * FROM t2 WHERE c3 = '1998-12-11'; c1 c2 c3 c4 1990 1990 1998-12-11 1998-12-11 11:30:45 @@ -1400,7 +1400,7 @@ c1 c2 c3 c4 2155 2155 1998-12-26 1998-12-26 11:30:45 SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t2; total_rows min_value max(c2) -20 1901 2155 +20 0 2155 SELECT * FROM t2 WHERE c3 = '1998-12-11'; c1 c2 c3 c4 1990 1990 1998-12-11 1998-12-11 11:30:45 diff --git a/mysql-test/suite/engines/iuds/r/update_delete_calendar.result b/mysql-test/suite/engines/iuds/r/update_delete_calendar.result index a04585dfd72..e2dd83e03b4 100644 --- a/mysql-test/suite/engines/iuds/r/update_delete_calendar.result +++ b/mysql-test/suite/engines/iuds/r/update_delete_calendar.result @@ -791,9 +791,6 @@ Warning 1292 Truncated incorrect datetime value: '2009-01-10 23:60:59' SELECT count(*) FROM t1 WHERE c2='2001-01-11 23:59:60' /* returns 0 */; count(*) 0 -Warnings: -Warning 1292 Incorrect datetime value: '2001-01-11 23:59:60' for column 'c2' at row 1 -Warning 1292 Incorrect datetime value: '2001-01-11 23:59:60' for column 'c2' at row 1 SELECT * FROM t1 WHERE c1='0000-00-00 00:00:00' OR c2='0000-00-00 00:00:00'; c1 c2 c3 0000-00-00 00:00:00 0000-00-00 00:00:00 6 diff --git a/mysql-test/suite/engines/iuds/t/disabled.def b/mysql-test/suite/engines/iuds/t/disabled.def index e69de29bb2d..2aca7006b4e 100644 --- a/mysql-test/suite/engines/iuds/t/disabled.def +++ b/mysql-test/suite/engines/iuds/t/disabled.def @@ -0,0 +1,7 @@ +# List of disabled tests +# test name : comment +rpl_redirect : Fails due to bug#49978 +crash_manycolumns_string : Bug#50495 'Row size too large' for plugin, but works for built-in innodb +ix_unique_lob : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value +ix_unique_string_length : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value + diff --git a/mysql-test/suite/engines/iuds/t/insert_number.test b/mysql-test/suite/engines/iuds/t/insert_number.test index 8c5283fa8b7..b55bd8dc98a 100644 --- a/mysql-test/suite/engines/iuds/t/insert_number.test +++ b/mysql-test/suite/engines/iuds/t/insert_number.test @@ -7812,10 +7812,15 @@ SELECT * FROM t2 ORDER BY c1,c6 LIMIT 2; SELECT * FROM t2 ORDER BY c1,c6 DESC LIMIT 2; ## ref type access + +# Bug#52283 : Remove the following --disable_warnings +# command when the bug is fixed +--disable_warnings SELECT * FROM t2 WHERE c1 = 18446744073709551616 ORDER BY c1,c6; SELECT * FROM t2 WHERE c1 = 18446744073709551616 ORDER BY c1,c6 LIMIT 2; SELECT * FROM t2 WHERE c1 = 18446744073709551616 ORDER BY c1,c6 DESC; SELECT * FROM t2 WHERE c1 = 18446744073709551616 ORDER BY c1,c6 DESC LIMIT 2; +--enable_warnings ## Range access, ordered ## SELECT * FROM t2 WHERE c1 <> 18446744073709551616 ORDER BY c1,c6; diff --git a/mysql-test/suite/engines/iuds/t/update_delete_calendar.test b/mysql-test/suite/engines/iuds/t/update_delete_calendar.test index aa695953ce1..c6a22511766 100644 --- a/mysql-test/suite/engines/iuds/t/update_delete_calendar.test +++ b/mysql-test/suite/engines/iuds/t/update_delete_calendar.test @@ -300,7 +300,12 @@ INSERT INTO t1 VALUES('2001-01-09','2001-01-10',6),('2001-01-11','2001-01-12',7) UPDATE t1 SET c1='2001-01-09 24:59:59',c2='2009-01-10 23:60:59' WHERE c1='2001-01-09'; UPDATE t1 SET c2='2001-01-11 23:59:60' WHERE c1='2001-01-11'; SELECT count(*) FROM t1 WHERE c1='2001-01-09 24:59:59' AND c2='2009-01-10 23:60:59'; + +# Bug#52283 : Remove the following --disable_warnings +# command when the bug is fixed +--disable_warnings SELECT count(*) FROM t1 WHERE c2='2001-01-11 23:59:60' /* returns 0 */; +--enable_warnings --sorted_result SELECT * FROM t1 WHERE c1='0000-00-00 00:00:00' OR c2='0000-00-00 00:00:00'; From 24a9fb555c6c471222598688fcaf8d5405fea531 Mon Sep 17 00:00:00 2001 From: Omer BarNir Date: Wed, 7 Apr 2010 11:28:28 -0700 Subject: [PATCH 6/8] Correction to the disabled.def file in engines/iuds that got overwritten by mistake in previous push --- mysql-test/suite/engines/iuds/t/disabled.def | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/mysql-test/suite/engines/iuds/t/disabled.def b/mysql-test/suite/engines/iuds/t/disabled.def index 2aca7006b4e..f45104cc984 100644 --- a/mysql-test/suite/engines/iuds/t/disabled.def +++ b/mysql-test/suite/engines/iuds/t/disabled.def @@ -1,7 +1 @@ -# List of disabled tests -# test name : comment -rpl_redirect : Fails due to bug#49978 -crash_manycolumns_string : Bug#50495 'Row size too large' for plugin, but works for built-in innodb -ix_unique_lob : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value -ix_unique_string_length : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value - +insert_calendar : Bug #52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value From 17a21c4f35812eba71a44e906e18ec947517cf35 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 9 Apr 2010 14:47:18 +0300 Subject: [PATCH 7/8] Bug #47095: Can't open_files_limit really be larger than 65535? Several problems addressed: 1. The maximum value for --open_files_limit on non-windows boxes is now raised to UINT_MAX (the maximum possible without significant changes in the code). The maximum value on windows is kept to be 2048 due to a known limitation (bug 24509). 2. mysqld_safe now supports --open_files_limit=xx in addition to --open-files-limit=xx 3. mysqld_safe always passes through --open[_-]files[_-]limit to the underlying mysqld. It used to pass it through only if it the user running the script has access to the root directory or there was an --user argument specified. 4. Fixed a prototype in my_file.c to match its counterpart in the other #ifdef branch. --- include/my_global.h | 2 +- mysys/my_file.c | 2 +- scripts/mysqld_safe.sh | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/my_global.h b/include/my_global.h index 779152203be..e4e53aca20a 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -751,7 +751,7 @@ typedef SOCKET_SIZE_TYPE size_socket; #endif #define MY_NFILE 64 /* This is only used to save filenames */ #ifndef OS_FILE_LIMIT -#define OS_FILE_LIMIT 65535 +#define OS_FILE_LIMIT UINT_MAX #endif /* #define EXT_IN_LIBNAME */ diff --git a/mysys/my_file.c b/mysys/my_file.c index 44bacf55307..d37da975c37 100644 --- a/mysys/my_file.c +++ b/mysys/my_file.c @@ -72,7 +72,7 @@ static uint set_max_open_files(uint max_file_limit) } #else -static int set_max_open_files(uint max_file_limit) +static uint set_max_open_files(uint max_file_limit) { /* We don't know the limit. Return best guess */ return min(max_file_limit, OS_FILE_LIMIT); diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 23b5efcaf2b..e4e5f1a1510 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -183,6 +183,7 @@ parse_arguments() { ;; --nice=*) niceness="$val" ;; --open-files-limit=*) open_files="$val" ;; + --open_files_limit=*) open_files="$val" ;; --skip-kill-mysqld*) KILL_MYSQLD=0 ;; --syslog) want_syslog=1 ;; --skip-syslog) want_syslog=0 ;; @@ -397,10 +398,14 @@ then if test -n "$open_files" then ulimit -n $open_files - append_arg_to_args "--open-files-limit=$open_files" fi fi +if test -n "$open_files" +then + append_arg_to_args "--open-files-limit=$open_files" +fi + safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@}} # Make sure that directory for $safe_mysql_unix_port exists mysql_unix_port_dir=`dirname $safe_mysql_unix_port` From 9d59b2705a696545d12f849e01ad40f95b17f1cb Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Fri, 9 Apr 2010 14:57:11 -0300 Subject: [PATCH 8/8] Backport revision alik@sun.com-20100223131824-comthndat57kx8s5: Add ignore pattern for valgrind messages. --- mysql-test/include/mtr_warnings.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index 291c4c1cbe6..9dc64952979 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -182,6 +182,8 @@ INSERT INTO global_suppressions VALUES ("==[0-9]*== For more details"), /* This comes with innodb plugin tests */ ("==[0-9]*== Warning: set address range perms: large range"), + /* valgrind-3.5.0 dumps this */ + ("==[0-9]*== Command: "), /* valgrind warnings: invalid file descriptor -1 in syscall write()/read(). Bug #50414 */