diff options
author | unknown <bell@sanja.is.com.ua> | 2003-11-02 15:52:40 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2003-11-02 15:52:40 +0200 |
commit | a0aceafb86e57549dd38ef2e745ade3b6e7057cf (patch) | |
tree | 40bca0c30623658294a6358beb5ffca6a128a6a6 /sql | |
parent | 52600e88c051a79126cc9083c955a31668fd75a3 (diff) | |
parent | 87ce2aa098dcc1a8f3511ff07260638c83bf62c0 (diff) | |
download | mariadb-git-a0aceafb86e57549dd38ef2e745ade3b6e7057cf.tar.gz |
merge
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item.cc | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/sql/item.cc b/sql/item.cc index 7c7cad7c290..9caea3cee4c 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -796,6 +796,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) if (!field) // If field is not checked { TABLE_LIST *where= 0; + bool upward_lookup= 0; Field *tmp= (Field *)not_found_field; if ((tmp= find_field_in_tables(thd, this, tables, &where, 0)) == not_found_field) @@ -825,6 +826,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) sl; sl= (prev_unit= sl->master_unit())->outer_select()) { + upward_lookup= 1; table_list= (last= sl)->get_table_list(); if (sl->resolve_mode == SELECT_LEX::INSERT_MODE && table_list) { @@ -869,8 +871,14 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) return 1; else if (tmp == not_found_field && refer == (Item **)not_found_item) { - // call to return error code - find_field_in_tables(thd, this, tables, &where, 1); + if (upward_lookup) + // We can't say exactly what absend table or field + my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0), + full_name(), thd->where); + else + // Call to report error + find_field_in_tables(thd, this, tables, &where, 1); + return -1; } else if (refer != (Item **)not_found_item) @@ -1381,6 +1389,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) if (!ref) { TABLE_LIST *where= 0, *table_list; + bool upward_lookup= 0; SELECT_LEX_UNIT *prev_unit= thd->lex.current_select->master_unit(); SELECT_LEX *sl= prev_unit->outer_select(); /* @@ -1399,6 +1408,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) REPORT_ALL_ERRORS))) == (Item **)not_found_item) { + upward_lookup= 1; Field *tmp= (Field*) not_found_field; /* We can't find table field in table list of current select, @@ -1457,11 +1467,16 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) return -1; else if (ref == (Item **)not_found_item && tmp == not_found_field) { - // Call to report error - find_item_in_list(this, - *(thd->lex.current_select->get_item_list()), - &counter, - REPORT_ALL_ERRORS); + if (upward_lookup) + // We can't say exactly what absend (table or field) + my_printf_error(ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR), MYF(0), + full_name(), thd->where); + else + // Call to report error + find_item_in_list(this, + *(thd->lex.current_select->get_item_list()), + &counter, + REPORT_ALL_ERRORS); ref= 0; return 1; } |