From: Tor Didriksen Date: October 18 2011 1:45pm Subject: bzr push into mysql-trunk branch (tor.didriksen:3507 to 3508) Bug#12582849 List-Archive: http://lists.mysql.com/commits/141494 X-Bug: 12582849 Message-Id: <201110181345.p9IDjwfK024295@acsmt357.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3508 Tor Didriksen 2011-10-18 Bug#12582849 ASSERTION FAILURE IN __CXA_PURE_VIRTUAL/ITEM_COND::FIX_FIELDS This is a variant of earlier bugs: 12603457 and 12603141: Sometimes Item_field objects are wrapped in Item_ref objects. These must be stripped off when saving conditions in in 'prep_where'. @ mysql-test/r/ps.result New test case. @ mysql-test/t/ps.test New test case. @ sql/sql_lex.cc Fix garbled comment. modified: mysql-test/r/ps.result mysql-test/t/ps.test sql/item_cmpfunc.cc sql/sql_lex.cc 3507 chuck.bell@stripped 2011-10-18 [merge] Merge with BUG#12968815, BUG#12968567 for mysql_plugin client. modified: client/mysql_plugin.c mysql-test/r/mysql_plugin.result mysql-test/t/mysql_plugin.test === modified file 'mysql-test/r/ps.result' --- a/mysql-test/r/ps.result 2011-08-03 11:29:20 +0000 +++ b/mysql-test/r/ps.result 2011-10-18 13:45:29 +0000 @@ -3748,6 +3748,61 @@ NULL DEALLOCATE PREPARE stmt; DROP TABLE t1, t2; # +# Bug#12582849 +# ASSERTION FAILURE IN __CXA_PURE_VIRTUAL/ITEM_COND::FIX_FIELDS +# +CREATE TABLE t1 ( +pk INTEGER AUTO_INCREMENT, +col_int_nokey INTEGER, +col_int_key INTEGER, +col_varchar_key VARCHAR(1), +col_varchar_nokey VARCHAR(1), +PRIMARY KEY (pk), +KEY (col_int_key), +KEY (col_varchar_key, col_int_key) +); +INSERT INTO t1 ( +col_int_key, col_int_nokey, +col_varchar_key, col_varchar_nokey +) VALUES +(4, 2, 'v', 'v'), +(62, 150, 'v', 'v'); +CREATE TABLE t2 ( +pk INTEGER AUTO_INCREMENT, +col_int_nokey INTEGER, +col_int_key INTEGER, +col_varchar_key VARCHAR(1), +col_varchar_nokey VARCHAR(1), +PRIMARY KEY (pk), +KEY (col_int_key), +KEY (col_varchar_key, col_int_key) +); +INSERT INTO t2 ( +col_int_key, col_int_nokey, +col_varchar_key, col_varchar_nokey +) VALUES +(8, NULL, 'x', 'x'), +(7, 8, 'd', 'd'); +PREPARE stmt FROM ' +SELECT + ( SELECT MAX( SQ1_alias2 .col_int_nokey ) AS SQ1_field1 + FROM ( t2 AS SQ1_alias1 RIGHT JOIN t1 AS SQ1_alias2 + ON ( SQ1_alias2.col_varchar_key = SQ1_alias1.col_varchar_nokey ) + ) + WHERE SQ1_alias2.pk < alias1.col_int_nokey OR alias1.pk + ) AS field1 +FROM ( t1 AS alias1 JOIN t2 AS alias2 ON alias2.pk ) +GROUP BY field1 +'; +EXECUTE stmt; +field1 +150 +EXECUTE stmt; +field1 +150 +DEALLOCATE PREPARE stmt; +DROP TABLE t1, t2; +# # Bug#12661349 assert in protocol::end_statement # # Note: This test case should be run with --ps-protocol === modified file 'mysql-test/t/ps.test' --- a/mysql-test/t/ps.test 2011-07-01 08:17:29 +0000 +++ b/mysql-test/t/ps.test 2011-10-18 13:45:29 +0000 @@ -3352,6 +3352,70 @@ EXECUTE stmt; DEALLOCATE PREPARE stmt; DROP TABLE t1, t2; +--echo # +--echo # Bug#12582849 +--echo # ASSERTION FAILURE IN __CXA_PURE_VIRTUAL/ITEM_COND::FIX_FIELDS +--echo # + +CREATE TABLE t1 ( + pk INTEGER AUTO_INCREMENT, + col_int_nokey INTEGER, + col_int_key INTEGER, + + col_varchar_key VARCHAR(1), + col_varchar_nokey VARCHAR(1), + + PRIMARY KEY (pk), + KEY (col_int_key), + KEY (col_varchar_key, col_int_key) +); + +INSERT INTO t1 ( + col_int_key, col_int_nokey, + col_varchar_key, col_varchar_nokey +) VALUES +(4, 2, 'v', 'v'), +(62, 150, 'v', 'v'); + +CREATE TABLE t2 ( + pk INTEGER AUTO_INCREMENT, + col_int_nokey INTEGER, + col_int_key INTEGER, + + col_varchar_key VARCHAR(1), + col_varchar_nokey VARCHAR(1), + + PRIMARY KEY (pk), + KEY (col_int_key), + KEY (col_varchar_key, col_int_key) +); + +INSERT INTO t2 ( + col_int_key, col_int_nokey, + col_varchar_key, col_varchar_nokey +) VALUES +(8, NULL, 'x', 'x'), +(7, 8, 'd', 'd'); + +PREPARE stmt FROM ' +SELECT + ( SELECT MAX( SQ1_alias2 .col_int_nokey ) AS SQ1_field1 + FROM ( t2 AS SQ1_alias1 RIGHT JOIN t1 AS SQ1_alias2 + ON ( SQ1_alias2.col_varchar_key = SQ1_alias1.col_varchar_nokey ) + ) + WHERE SQ1_alias2.pk < alias1.col_int_nokey OR alias1.pk + ) AS field1 +FROM ( t1 AS alias1 JOIN t2 AS alias2 ON alias2.pk ) +GROUP BY field1 +'; + +EXECUTE stmt; +EXECUTE stmt; + +DEALLOCATE PREPARE stmt; + +DROP TABLE t1, t2; + ########################################################################### === modified file 'sql/item_cmpfunc.cc' --- a/sql/item_cmpfunc.cc 2011-09-08 12:48:08 +0000 +++ b/sql/item_cmpfunc.cc 2011-10-18 13:45:29 +0000 @@ -4380,7 +4380,7 @@ void Item_cond::copy_andor_arguments(THD { List_iterator_fast li(item->list); while (Item *it= li++) - list.push_back(it->copy_andor_structure(thd)); + list.push_back(it->real_item()->copy_andor_structure(thd)); } === modified file 'sql/sql_lex.cc' --- a/sql/sql_lex.cc 2011-10-18 10:23:09 +0000 +++ b/sql/sql_lex.cc 2011-10-18 13:45:29 +0000 @@ -3116,9 +3116,9 @@ static void fix_prepare_info_in_table_li The passed WHERE and HAVING are to be saved for the future executions. This function saves it, and returns a copy which can be thrashed during this execution of the statement. By saving/thrashing here we mean only + AND/OR trees. We also save the chain of ORDER::next in group_list, in case the list is modified by remove_const(). - AND/OR trees. The function also calls fix_prepare_info_in_table_list that saves all ON expressions. */ No bundle (reason: useless for push emails).