From 4155d1405ec0585910dc22afaee4e0a8dec8c7e0 Mon Sep 17 00:00:00 2001 From: "aelkin@mysql.com" <> Date: Wed, 22 Feb 2006 17:07:18 +0200 Subject: [PATCH] BUG#17265 Assertion failure in rpl_row_view01. To quote Timour review lines: The actual cause of the bug is that sql_base.cc:setup_wild() sets "select_lex->with_wild = 0" (in the end of the function) once it expands all wild-cards, and wild-card expansion is done during the prepare phase. During this phase we replace all "*" with the corresponding items, which for views happen to be references to references. When we do execute, select_lex->with_wild = 0, and all "*" are already replaced by the corresponding items, which in the case of views need to be dereferenced first. Fixed by refining the assert. Regression test for the bug is rpl_row_view01, as was reported. --- sql/item.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sql/item.cc b/sql/item.cc index fbdb217f5df..367452444d2 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -5116,9 +5116,9 @@ bool Item_direct_view_ref::eq(const Item *item, bool binary_cmp) const if (item_ref->ref_type() == VIEW_REF) { Item *item_ref_ref= *(item_ref->ref); - DBUG_ASSERT((*ref)->type() == FIELD_ITEM && - (item_ref_ref->type() == FIELD_ITEM)); - return (*ref == item_ref_ref); + DBUG_ASSERT((*ref)->real_item()->type() == FIELD_ITEM && + (item_ref_ref->real_item()->type() == FIELD_ITEM)); + return ((*ref)->real_item() == item_ref_ref->real_item()); } } return FALSE;