summaryrefslogtreecommitdiff
path: root/sql/item_row.cc
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2006-04-07 22:26:25 +0400
committerunknown <konstantin@mysql.com>2006-04-07 22:26:25 +0400
commit9b6e83f4b83abcd33c8cf20b95d3e3f4e7a7851a (patch)
tree08a1e94cef7b86ac1d24825210056d138d5029b4 /sql/item_row.cc
parent00cfd1a75f97eefcd9bfd64c63ee84cd33c2f648 (diff)
downloadmariadb-git-9b6e83f4b83abcd33c8cf20b95d3e3f4e7a7851a.tar.gz
A fix and a test case for Bug#16248 "WHERE (col1,col2) IN ((?,?))
gives wrong results". Implement previously missing Item_row::cleanup. The bug is not repeatable in 5.0, probably due to a coincidence: the problem is present in 5.0 as well. mysql-test/r/ps.result: Update the result file (Bug#16248) mysql-test/t/ps.test: Add a test case for Bug#16248 "WHERE (col1,col2) IN ((?,?)) gives wrong results" sql/item_row.cc: Implement Item_row::cleanup(): we should reset used_tables_cache before reexecution of a prepared statement. In case ROW arguments contain a placeholder, used_tables_cache has PARAM_TABLE bit set in statement prepare. As a result, when executing a statement, the condition push down algorithm (make_cond_for_table) would think that the WHERE clause belongs to the non-existent PARAM_TABLE and wouldn't attach the WHERE clause to any of the real tables, effectively optimizing the clause away. sql/item_row.h: Remove a never used member 'array_holder'. Add declaration for Item_row::cleanup.
Diffstat (limited to 'sql/item_row.cc')
-rw-r--r--sql/item_row.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/sql/item_row.cc b/sql/item_row.cc
index 12d202a1699..493eefc9ff0 100644
--- a/sql/item_row.cc
+++ b/sql/item_row.cc
@@ -26,7 +26,7 @@
*/
Item_row::Item_row(List<Item> &arg):
- Item(), used_tables_cache(0), array_holder(1), const_item_cache(1), with_null(0)
+ Item(), used_tables_cache(0), const_item_cache(1), with_null(0)
{
//TODO: think placing 2-3 component items in item (as it done for function)
@@ -85,6 +85,20 @@ bool Item_row::fix_fields(THD *thd, TABLE_LIST *tabl, Item **ref)
}
+void Item_row::cleanup()
+{
+ DBUG_ENTER("Item_row::cleanup");
+
+ Item::cleanup();
+ /* Reset to the original values */
+ used_tables_cache= 0;
+ const_item_cache= 1;
+ with_null= 0;
+
+ DBUG_VOID_RETURN;
+}
+
+
void Item_row::split_sum_func(THD *thd, Item **ref_pointer_array,
List<Item> &fields)
{