diff options
author | evgen@moonbone.local <> | 2005-10-25 20:04:12 +0400 |
---|---|---|
committer | evgen@moonbone.local <> | 2005-10-25 20:04:12 +0400 |
commit | 8cb0dff9049a0783bc98c13fc43d322029cac613 (patch) | |
tree | c02babc6eea474c8c1c524a69234536b7eafae07 /sql/item.cc | |
parent | 3042591a9f2b6c72340572fa0e3feab371638ee9 (diff) | |
download | mariadb-git-8cb0dff9049a0783bc98c13fc43d322029cac613.tar.gz |
Fix bug#13392 Wrong VALUES() behaviour in INSERT SELECT with ON DUPLICATE
VALUES() can only refer to table insert going to.
But Item_insert_value::fix_fields() were passing to it's arg full table list,
This results in finding second column which shouldn't be found, and
failing with error about ambiguous field.
Item_insert_value::fix_fields() now passes only first table of full table
list.
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc index b2a1e44cfcc..642a0ccf1b4 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2796,8 +2796,14 @@ bool Item_insert_value::fix_fields(THD *thd, Item **items) { DBUG_ASSERT(fixed == 0); + st_table_list *orig_next_table= table_list->next; + table_list->next= 0; if (!arg->fixed && arg->fix_fields(thd, table_list, &arg)) + { + table_list->next= orig_next_table; return 1; + } + table_list->next= orig_next_table; if (arg->type() == REF_ITEM) { @@ -2809,6 +2815,7 @@ bool Item_insert_value::fix_fields(THD *thd, arg= ref->ref[0]; } Item_field *field_arg= (Item_field *)arg; + if (field_arg->field->table->insert_values) { Field *def_field= (Field*) sql_alloc(field_arg->field->size_of()); |