From: Sergey Glukhov Date: April 12 2011 10:31am Subject: bzr commit into mysql-trunk branch (sergey.glukhov:3350) List-Archive: http://lists.mysql.com/commits/135247 Message-Id: <201104121031.p3CAVNmZ020232@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit #At file:///home/gluh/MySQL/mysql-trunk/ based on revid:sven.sandberg@stripped 3350 Sergey Glukhov 2011-04-12 [merge] 5.5 -> trunk merge @ mysql-test/include/func_in.inc 5.5 -> trunk merge @ mysql-test/r/func_group.result 5.5 -> trunk merge @ mysql-test/r/func_in_icp.result 5.5 -> trunk merge @ mysql-test/r/func_in_icp_mrr.result 5.5 -> trunk merge @ mysql-test/r/func_in_mrr.result 5.5 -> trunk merge @ mysql-test/r/func_in_mrr_cost.result 5.5 -> trunk merge @ mysql-test/r/func_in_none.result 5.5 -> trunk merge @ mysql-test/t/func_group.test 5.5 -> trunk merge @ sql/field.cc 5.5 -> trunk merge @ sql/item_cmpfunc.cc 5.5 -> trunk merge @ sql/item_sum.cc 5.5 -> trunk merge modified: mysql-test/include/func_in.inc mysql-test/r/func_group.result mysql-test/r/func_in_icp.result mysql-test/r/func_in_icp_mrr.result mysql-test/r/func_in_mrr.result mysql-test/r/func_in_mrr_cost.result mysql-test/r/func_in_none.result mysql-test/t/func_group.test sql/field.cc sql/item_cmpfunc.cc sql/item_sum.cc === modified file 'mysql-test/include/func_in.inc' --- a/mysql-test/include/func_in.inc 2011-01-14 08:20:08 +0000 +++ b/mysql-test/include/func_in.inc 2011-04-12 10:31:30 +0000 @@ -598,4 +598,15 @@ SELECT * FROM t1 DROP TABLE t1,subq; +--echo # +--echo # Bug #11766270 59343: YEAR(4): INCORRECT RESULT AND VALGRIND WARNINGS WITH MIN/MAX, UNION +--echo # + +CREATE TABLE t1(f1 YEAR(4)); +INSERT INTO t1 VALUES (0000),(2001); +--enable_metadata +(SELECT MAX(f1) FROM t1) UNION (SELECT MAX(f1) FROM t1); +--disable_metadata +DROP TABLE t1; + --echo End of 5.1 tests === modified file 'mysql-test/r/func_group.result' --- a/mysql-test/r/func_group.result 2011-04-02 19:42:50 +0000 +++ b/mysql-test/r/func_group.result 2011-04-12 10:31:30 +0000 @@ -1746,6 +1746,17 @@ MAX(LENGTH(a)) LENGTH(MAX(a)) MIN(a) MAX 20 20 18446668621106209655 18446668621106209655 18446668621106209655 18446668621106209655 DROP TABLE t1; # +# Bug #11766270 59343: YEAR(4): INCORRECT RESULT AND VALGRIND WARNINGS WITH MIN/MAX, UNION +# +CREATE TABLE t1(f1 YEAR(4)); +INSERT INTO t1 VALUES (0000),(2001); +(SELECT MAX(f1) FROM t1) UNION (SELECT MAX(f1) FROM t1); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def MAX(f1) MAX(f1) 13 4 4 Y 32864 0 63 +MAX(f1) +2001 +DROP TABLE t1; +# End of 5.1 tests # # Bug#52123 Assertion failed: aggregator == aggr->Aggrtype(), === modified file 'mysql-test/r/func_in_icp.result' --- a/mysql-test/r/func_in_icp.result 2011-01-14 08:20:08 +0000 +++ b/mysql-test/r/func_in_icp.result 2011-04-12 10:31:30 +0000 @@ -806,5 +806,16 @@ WHERE 1+NULL NOT IN (SELECT i FROM subq WHERE subq.pk = t1.pk); pk i DROP TABLE t1,subq; +# +# Bug #11766270 59343: YEAR(4): INCORRECT RESULT AND VALGRIND WARNINGS WITH MIN/MAX, UNION +# +CREATE TABLE t1(f1 YEAR(4)); +INSERT INTO t1 VALUES (0000),(2001); +(SELECT MAX(f1) FROM t1) UNION (SELECT MAX(f1) FROM t1); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def MAX(f1) MAX(f1) 13 4 4 Y 32864 0 63 +MAX(f1) +2001 +DROP TABLE t1; End of 5.1 tests set optimizer_switch=default; === modified file 'mysql-test/r/func_in_icp_mrr.result' --- a/mysql-test/r/func_in_icp_mrr.result 2011-01-14 08:20:08 +0000 +++ b/mysql-test/r/func_in_icp_mrr.result 2011-04-12 10:31:30 +0000 @@ -806,5 +806,16 @@ WHERE 1+NULL NOT IN (SELECT i FROM subq WHERE subq.pk = t1.pk); pk i DROP TABLE t1,subq; +# +# Bug #11766270 59343: YEAR(4): INCORRECT RESULT AND VALGRIND WARNINGS WITH MIN/MAX, UNION +# +CREATE TABLE t1(f1 YEAR(4)); +INSERT INTO t1 VALUES (0000),(2001); +(SELECT MAX(f1) FROM t1) UNION (SELECT MAX(f1) FROM t1); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def MAX(f1) MAX(f1) 13 4 4 Y 32864 0 63 +MAX(f1) +2001 +DROP TABLE t1; End of 5.1 tests set optimizer_switch=default; === modified file 'mysql-test/r/func_in_mrr.result' --- a/mysql-test/r/func_in_mrr.result 2011-01-14 08:20:08 +0000 +++ b/mysql-test/r/func_in_mrr.result 2011-04-12 10:31:30 +0000 @@ -806,5 +806,16 @@ WHERE 1+NULL NOT IN (SELECT i FROM subq WHERE subq.pk = t1.pk); pk i DROP TABLE t1,subq; +# +# Bug #11766270 59343: YEAR(4): INCORRECT RESULT AND VALGRIND WARNINGS WITH MIN/MAX, UNION +# +CREATE TABLE t1(f1 YEAR(4)); +INSERT INTO t1 VALUES (0000),(2001); +(SELECT MAX(f1) FROM t1) UNION (SELECT MAX(f1) FROM t1); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def MAX(f1) MAX(f1) 13 4 4 Y 32864 0 63 +MAX(f1) +2001 +DROP TABLE t1; End of 5.1 tests set optimizer_switch=default; === modified file 'mysql-test/r/func_in_mrr_cost.result' --- a/mysql-test/r/func_in_mrr_cost.result 2011-01-14 08:20:08 +0000 +++ b/mysql-test/r/func_in_mrr_cost.result 2011-04-12 10:31:30 +0000 @@ -806,5 +806,16 @@ WHERE 1+NULL NOT IN (SELECT i FROM subq WHERE subq.pk = t1.pk); pk i DROP TABLE t1,subq; +# +# Bug #11766270 59343: YEAR(4): INCORRECT RESULT AND VALGRIND WARNINGS WITH MIN/MAX, UNION +# +CREATE TABLE t1(f1 YEAR(4)); +INSERT INTO t1 VALUES (0000),(2001); +(SELECT MAX(f1) FROM t1) UNION (SELECT MAX(f1) FROM t1); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def MAX(f1) MAX(f1) 13 4 4 Y 32864 0 63 +MAX(f1) +2001 +DROP TABLE t1; End of 5.1 tests set optimizer_switch=default; === modified file 'mysql-test/r/func_in_none.result' --- a/mysql-test/r/func_in_none.result 2011-01-14 08:20:08 +0000 +++ b/mysql-test/r/func_in_none.result 2011-04-12 10:31:30 +0000 @@ -805,5 +805,16 @@ WHERE 1+NULL NOT IN (SELECT i FROM subq WHERE subq.pk = t1.pk); pk i DROP TABLE t1,subq; +# +# Bug #11766270 59343: YEAR(4): INCORRECT RESULT AND VALGRIND WARNINGS WITH MIN/MAX, UNION +# +CREATE TABLE t1(f1 YEAR(4)); +INSERT INTO t1 VALUES (0000),(2001); +(SELECT MAX(f1) FROM t1) UNION (SELECT MAX(f1) FROM t1); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def MAX(f1) MAX(f1) 13 4 4 Y 32864 0 63 +MAX(f1) +2001 +DROP TABLE t1; End of 5.1 tests set optimizer_switch=default; === modified file 'mysql-test/t/func_group.test' --- a/mysql-test/t/func_group.test 2011-04-02 19:42:50 +0000 +++ b/mysql-test/t/func_group.test 2011-04-12 10:31:30 +0000 @@ -1129,6 +1129,18 @@ SELECT MAX(LENGTH(a)), LENGTH(MAX(a)), M DROP TABLE t1; --echo # +--echo # Bug #11766270 59343: YEAR(4): INCORRECT RESULT AND VALGRIND WARNINGS WITH MIN/MAX, UNION +--echo # + +CREATE TABLE t1(f1 YEAR(4)); +INSERT INTO t1 VALUES (0000),(2001); +--enable_metadata +(SELECT MAX(f1) FROM t1) UNION (SELECT MAX(f1) FROM t1); +--disable_metadata +DROP TABLE t1; + + +--echo # --echo End of 5.1 tests ### === modified file 'sql/field.cc' --- a/sql/field.cc 2011-04-04 08:47:25 +0000 +++ b/sql/field.cc 2011-04-12 10:31:30 +0000 @@ -5380,6 +5380,7 @@ double Field_year::val_real(void) longlong Field_year::val_int(void) { ASSERT_COLUMN_MARKED_FOR_READ; + DBUG_ASSERT(field_length == 2 || field_length == 4); int tmp= (int) ptr[0]; if (field_length != 4) tmp%=100; // Return last 2 char @@ -5392,6 +5393,7 @@ longlong Field_year::val_int(void) String *Field_year::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { + DBUG_ASSERT(field_length < 5); val_buffer->alloc(5); val_buffer->length(field_length); char *to=(char*) val_buffer->ptr(); === modified file 'sql/item_cmpfunc.cc' --- a/sql/item_cmpfunc.cc 2011-03-22 11:44:40 +0000 +++ b/sql/item_cmpfunc.cc 2011-04-12 10:31:30 +0000 @@ -4152,13 +4152,11 @@ void Item_func_in::fix_length_and_dec() uint j=0; for (uint i=1 ; i < arg_count ; i++) { - if (!args[i]->null_value) // Skip NULL values - { - array->set(j,args[i]); - j++; - } - else - have_null= 1; + array->set(j,args[i]); + if (!args[i]->null_value) // Skip NULL values + j++; + else + have_null= 1; } if ((array->used_count= j)) array->sort(); === modified file 'sql/item_sum.cc' --- a/sql/item_sum.cc 2011-04-01 14:04:52 +0000 +++ b/sql/item_sum.cc 2011-04-12 10:31:30 +0000 @@ -1142,17 +1142,13 @@ Item_sum_hybrid::fix_fields(THD *thd, It switch (hybrid_type= item->result_type()) { case INT_RESULT: - max_length= 20; - break; case DECIMAL_RESULT: + case STRING_RESULT: max_length= item->max_length; break; case REAL_RESULT: max_length= float_length(decimals); break; - case STRING_RESULT: - max_length= item->max_length; - break; case ROW_RESULT: default: DBUG_ASSERT(0); No bundle (reason: revision is a merge (you can force generation of a bundle with env var BZR_FORCE_BUNDLE=1)).