From 38e664cf6460c4bfe586ad9d12b9f421acf48ebc Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 24 Jan 2005 17:17:19 +0200 Subject: fixed way of forward reference detection to support literal constant (BUG#8025) mysql-test/r/subselect.result: Forward reference detection mysql-test/t/subselect.test: Forward reference detection sql/item.cc: now forward reference is detected via ref_pointer_array, because some literal constants are 'fixed' just after creation sql/sql_base.cc: fill ref_pointer_array with zerows for forward reference detection. --- sql/item.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sql/item.cc') diff --git a/sql/item.cc b/sql/item.cc index 640cc17411f..412cf315d4a 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1482,12 +1482,13 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) } else if (refer != (Item **)not_found_item) { - if (!(*refer)->fixed) + if (!last->ref_pointer_array[counter]) { my_error(ER_ILLEGAL_REFERENCE, MYF(0), name, "forward reference in item list"); return -1; } + DBUG_ASSERT((*refer)->fixed); /* Here, a subset of actions performed by Item_ref::set_properties is not enough. So we pass ptr to NULL into Item_[direct]_ref @@ -2173,12 +2174,13 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) mark_as_dependent(thd, last, thd->lex->current_select, fld); return 0; } - if (!(*ref)->fixed) + if (!last->ref_pointer_array[counter]) { my_error(ER_ILLEGAL_REFERENCE, MYF(0), name, "forward reference in item list"); return -1; } + DBUG_ASSERT((*ref)->fixed); mark_as_dependent(thd, last, thd->lex->current_select, this); if (place == IN_HAVING) -- cgit v1.2.1