From: Date: December 14 2006 6:08am Subject: bk commit into 5.0 tree (igor:1.2349) BUG#25027 List-Archive: http://lists.mysql.com/commits/16926 X-Bug: 25027 Message-Id: <20061214050831.B1EDDA8DF1@olga.mysql.com> Below is the list of changes that have just been committed into a local 5.0 repository of igor. When igor 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, 2006-12-13 21:08:25-08:00, igor@stripped +5 -0 Fixed bug #25027. Blocked evaluation of constant objects of the classes Item_func_is_null and Item_is_not_null_test at the prepare phase in the cases when the objects used subqueries. mysql-test/r/ps.result@stripped, 2006-12-13 21:08:23-08:00, igor@stripped +7 -0 Extended test case for bug #25027. mysql-test/t/ps.test@stripped, 2006-12-13 21:08:23-08:00, igor@stripped +5 -0 Extended test case for bug #25027. sql/item_cmpfunc.cc@stripped, 2006-12-13 21:08:23-08:00, igor@stripped +3 -3 Fixed bug #25027. Blocked evaluation of constant objects of the classes Item_func_is_null and Item_is_not_null_test at the prepare phase in the cases when the objects used subqueries. sql/item_cmpfunc.h@stripped, 2006-12-13 21:08:23-08:00, igor@stripped +2 -1 Fixed bug #25027. Blocked evaluation of constant objects of the classes Item_func_is_null and Item_is_not_null_test at the prepare phase in the cases when the objects used subqueries. sql/sql_lex.cc@stripped, 2006-12-13 21:08:23-08:00, igor@stripped +1 -0 Returned back the assertion in st_select_lex_unit::set_limit, removed by the previous commit for this bug. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: igor # Host: olga.mysql.com # Root: /home/igor/dev-opt/mysql-5.0-opt-bug25027 --- 1.226/sql/item_cmpfunc.cc 2006-12-13 21:08:31 -08:00 +++ 1.227/sql/item_cmpfunc.cc 2006-12-13 21:08:31 -08:00 @@ -2990,7 +2990,7 @@ Handle optimization if the argument can't be null This has to be here because of the test in update_used_tables(). */ - if (!used_tables_cache) + if (!used_tables_cache && !with_subselect) return cached_value; return args[0]->is_null() ? 1: 0; } @@ -2999,7 +2999,7 @@ { DBUG_ASSERT(fixed == 1); DBUG_ENTER("Item_is_not_null_test::val_int"); - if (!used_tables_cache) + if (!used_tables_cache && !with_subselect) { owner->was_null|= (!cached_value); DBUG_PRINT("info", ("cached :%ld", (long) cached_value)); @@ -3026,7 +3026,7 @@ else { args[0]->update_used_tables(); - if (!(used_tables_cache=args[0]->used_tables())) + if (!(used_tables_cache=args[0]->used_tables()) && !with_subselect) { /* Remember if the value is always NULL or never NULL */ cached_value= (longlong) !args[0]->is_null(); --- 1.134/sql/item_cmpfunc.h 2006-12-13 21:08:31 -08:00 +++ 1.135/sql/item_cmpfunc.h 2006-12-13 21:08:31 -08:00 @@ -1028,7 +1028,8 @@ else { args[0]->update_used_tables(); - if ((const_item_cache= !(used_tables_cache= args[0]->used_tables()))) + if ((const_item_cache= !(used_tables_cache= args[0]->used_tables())) && + !with_subselect) { /* Remember if the value is always NULL or never NULL */ cached_value= (longlong) args[0]->is_null(); --- 1.207/sql/sql_lex.cc 2006-12-13 21:08:31 -08:00 +++ 1.208/sql/sql_lex.cc 2006-12-13 21:08:31 -08:00 @@ -1903,6 +1903,7 @@ { ha_rows select_limit_val; + DBUG_ASSERT(! thd->stmt_arena->is_stmt_prepare()); select_limit_val= (ha_rows)(sl->select_limit ? sl->select_limit->val_uint() : HA_POS_ERROR); offset_limit_cnt= (ha_rows)(sl->offset_limit ? sl->offset_limit->val_uint() : --- 1.84/mysql-test/r/ps.result 2006-12-13 21:08:31 -08:00 +++ 1.85/mysql-test/r/ps.result 2006-12-13 21:08:31 -08:00 @@ -1528,5 +1528,12 @@ 1 2 DEALLOCATE PREPARE stmt; +PREPARE stmt FROM 'SELECT a FROM t1 WHERE (SELECT b FROM t2 limit ?) IS NULL'; +SET @arg=1; +EXECUTE stmt USING @arg; +a +1 +2 +DEALLOCATE PREPARE stmt; DROP TABLE t1,t2; End of 5.0 tests. --- 1.81/mysql-test/t/ps.test 2006-12-13 21:08:31 -08:00 +++ 1.82/mysql-test/t/ps.test 2006-12-13 21:08:31 -08:00 @@ -1577,8 +1577,13 @@ PREPARE stmt FROM 'SELECT a FROM t1 WHERE (SELECT b FROM t2) IS NULL'; EXECUTE stmt; +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM 'SELECT a FROM t1 WHERE (SELECT b FROM t2 limit ?) IS NULL'; +SET @arg=1; +EXECUTE stmt USING @arg; DEALLOCATE PREPARE stmt; + DROP TABLE t1,t2; --echo End of 5.0 tests.