summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2005-06-22 07:18:42 +0400
committerunknown <evgen@moonbone.local>2005-06-22 07:18:42 +0400
commita6c7fb455ae6114ae53be58c49d4ef7dbdcd5e3e (patch)
treeda44d153c0a60ceb5f7abf6e089ae58aca2d0274 /sql/sql_base.cc
parentd785fc60ab902842bf68bfb827120b8015700a98 (diff)
downloadmariadb-git-a6c7fb455ae6114ae53be58c49d4ef7dbdcd5e3e.tar.gz
Fix bug #9728 decreased functionality in "on duplicate key update"
Remove changes made by bug fix #8147. They strips list of insert_table_list to only insert table, which results in error reported in bug #9728. Added flag to Item to resolve ambigous fields reported in bug #8147. sql/item.h: Fix bug#9728 decreased functionality in "on duplicate key update". sql/item.cc: Fix bug#9728 decreased functionality in "on duplicate key update" sql/sql_parse.cc: Fix bug#9728 decreased functionality in "on duplicate key update" sql/sql_base.cc: Fix bug#9728 decreased functionality in "on duplicate key update". sql/sql_yacc.yy: Fix bug#9728 decreased functionality in "on duplicate key update" mysql-test/t/insert_select.test: Test case for bug#9728 Decreased functionality in "on duplicate key update". mysql-test/r/insert_select.result: Test case for bug#9728 Decreased functionality in "on duplicate key update".
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index e3c0efb83b8..84c03bee917 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -2086,7 +2086,8 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
return (Field*) 0;
}
bool allow_rowid= tables && !tables->next; // Only one table
- for (; tables ; tables=tables->next)
+ uint table_idx= 0;
+ for (; tables ; tables=tables->next, table_idx++)
{
if (!tables->table)
{
@@ -2114,7 +2115,9 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
name,thd->where);
return (Field*) 0;
}
- found=field;
+ found= field;
+ if (table_idx == 0 && item->item_flags & MY_ITEM_PREFER_1ST_TABLE)
+ break;
}
}
if (found)