Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1994 05/06/23 01:02:43 evgen@stripped +7 -0
Bug #9728 fix merge
sql/sql_yacc.yy
1.401 05/06/23 01:02:41 evgen@stripped +1 -1
Manual merge
sql/sql_parse.cc
1.458 05/06/23 01:02:41 evgen@stripped +0 -3
Manual merge
sql/sql_base.cc
1.257 05/06/23 01:02:40 evgen@stripped +2 -4
Manual merge
sql/item.h
1.144 05/06/23 00:56:00 evgen@stripped +2 -2
Auto merged
sql/item.cc
1.141 05/06/23 00:56:00 evgen@stripped +0 -0
Auto merged
mysql-test/t/insert_select.test
1.21 05/06/23 00:56:00 evgen@stripped +0 -0
Auto merged
mysql-test/r/insert_select.result
1.29 05/06/23 00:56:00 evgen@stripped +0 -0
Auto merged
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: evgen
# Host: moonbone.local
# Root: /work/mysql-5.0-merge/RESYNC
--- 1.140/sql/item.cc 2005-06-22 13:11:18 +04:00
+++ 1.141/sql/item.cc 2005-06-23 00:56:00 +04:00
@@ -338,6 +338,7 @@
place == IN_HAVING)
thd->lex->current_select->select_n_having_items++;
}
+ item_flags= 0;
}
/*
@@ -358,7 +359,8 @@
unsigned_flag(item->unsigned_flag),
with_sum_func(item->with_sum_func),
fixed(item->fixed),
- collation(item->collation)
+ collation(item->collation),
+ item_flags(item->item_flags)
{
next= thd->free_list; // Put in free list
thd->free_list= this;
--- 1.143/sql/item.h 2005-06-22 04:45:41 +04:00
+++ 1.144/sql/item.h 2005-06-23 00:56:00 +04:00
@@ -225,6 +225,11 @@
typedef void (*Cond_traverser) (const Item *item, void *arg);
+/*
+ See comments for sql_yacc.yy: insert_update_elem rule
+ */
+#define MY_ITEM_PREFER_1ST_TABLE 1
+
class Item {
Item(const Item &); /* Prevent use of these */
void operator=(Item &);
@@ -272,6 +277,7 @@
my_bool is_autogenerated_name; /* indicate was name of this Item
autogenerated or set by user */
DTCollation collation;
+ uint8 item_flags; /* Flags on how item should be processed */
// alloc & destruct is done as start of select using sql_alloc
Item();
@@ -583,6 +589,11 @@
{
cleanup();
delete this;
+ }
+ virtual bool set_flags_processor(byte *args)
+ {
+ this->item_flags|= *((uint8*)args);
+ return false;
}
virtual bool is_splocal() { return 0; } /* Needed for error checking */
--- 1.256/sql/sql_base.cc 2005-06-21 18:18:22 +04:00
+++ 1.257/sql/sql_base.cc 2005-06-23 01:02:40 +04:00
@@ -2756,9 +2756,9 @@
return (Field*) not_found_field;
return (Field*) 0;
}
-
bool allow_rowid= tables && !tables->next_local; // Only one table
- for (; tables ; tables= tables->next_local)
+ uint table_idx= 0;
+ for (; tables ; tables= tables->next_local, table_idx++)
{
if (!tables->table && !tables->ancestor)
{
@@ -2793,7 +2793,9 @@
my_error(ER_NON_UNIQ_ERROR, MYF(0), 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)
--- 1.400/sql/sql_yacc.yy 2005-06-21 21:30:44 +04:00
+++ 1.401/sql/sql_yacc.yy 2005-06-23 01:02:41 +04:00
@@ -6120,9 +6120,24 @@
simple_ident_nospvar equal expr_or_default
{
LEX *lex= Lex;
+ uint8 tmp= MY_ITEM_PREFER_1ST_TABLE;
if (lex->update_list.push_back($1) ||
lex->value_list.push_back($3))
YYABORT;
+ /*
+ INSERT INTO a1(a) SELECT b1.a FROM b1 ON DUPLICATE KEY
+ UPDATE a= a + b1.b
+
+ Set MY_ITEM_PREFER_1ST_TABLE flag to $1 and $3 items
+ to prevent find_field_in_tables() doing further item searching
+ if it finds item occurence in first table in insert_table_list.
+ This allows to avoid ambiguity in resolving 'a' field in
+ example above.
+ */
+ $1->walk(&Item::set_flags_processor,
+ (byte *) &tmp);
+ $3->walk(&Item::set_flags_processor,
+ (byte *) &tmp);
};
opt_low_priority:
--- 1.28/mysql-test/r/insert_select.result 2005-06-22 21:01:12 +04:00
+++ 1.29/mysql-test/r/insert_select.result 2005-06-23 00:56:00 +04:00
@@ -634,3 +634,18 @@
1 2
2 1
drop table t1, t2;
+create table t1 (a int unique);
+create table t2 (a int, b int);
+insert into t1 values (1),(2);
+insert into t2 values (1,2);
+select * from t1;
+a
+1
+2
+insert into t1 select t2.a from t2 on duplicate key update a= a + t2.b;
+select * from t1;
+a
+2
+3
+drop table t1;
+drop table t2;
--- 1.20/mysql-test/t/insert_select.test 2005-06-22 21:01:12 +04:00
+++ 1.21/mysql-test/t/insert_select.test 2005-06-23 00:56:00 +04:00
@@ -173,3 +173,17 @@
insert into t2(ff1) select f1 from t1 on duplicate key update ff2=ff2+1;
select * from t2;
drop table t1, t2;
+#
+# BUGS #9728 - 'Decreased functionality in "on duplicate key update"'
+# #8147 - 'a column proclaimed ambigous in INSERT ... SELECT .. ON
+# DUPLICATE'
+#
+create table t1 (a int unique);
+create table t2 (a int, b int);
+insert into t1 values (1),(2);
+insert into t2 values (1,2);
+select * from t1;
+insert into t1 select t2.a from t2 on duplicate key update a= a + t2.b;
+select * from t1;
+drop table t1;
+drop table t2;
| Thread |
|---|
| • bk commit into 5.0 tree (evgen:1.1994) BUG#9728 | eugene | 23 Jun |