Below is the list of changes that have just been committed into a local
4.1 repository of acurtis. When acurtis 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://www.mysql.com/doc/I/n/Installing_source_tree.html
ChangeSet
1.2160 05/02/09 05:27:18 acurtis@stripped +3 -0
Bug#8147
Fix ambigious table error for INSERT..SELECT..UPDATE
sql/sql_parse.cc
1.422 05/02/09 05:27:02 acurtis@stripped +14 -8
Bug#8147
Change order of code - skip insert table before calling
mysql_prepare_insert()
mysql-test/t/insert_update.test
1.11 05/02/09 05:27:02 acurtis@stripped +4 -3
Bug#8147
Alter test for bug
mysql-test/r/insert_update.result
1.11 05/02/09 05:27:01 acurtis@stripped +3 -3
Bug#8147
Alter test for bug
# 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: acurtis
# Host: pcgem.rdg.cyberkinetica.com
# Root: /var/db/bk/work-acurtis/bug8147
--- 1.421/sql/sql_parse.cc 2005-02-02 16:21:09 +00:00
+++ 1.422/sql/sql_parse.cc 2005-02-09 05:27:02 +00:00
@@ -2768,18 +2768,23 @@
select_lex->options |= OPTION_BUFFER_RESULT;
}
- if (!(res= open_and_lock_tables(thd, tables)) &&
- !(res= mysql_prepare_insert(thd, tables, first_local_table,
- tables->table, lex->field_list, 0,
+ if ((res= open_and_lock_tables(thd, tables)))
+ break;
+
+ TABLE *table= tables->table;
+ /* Skip first table, which is the table we are inserting in */
+ tables= (TABLE_LIST *)
+ lex->select_lex.table_list.first= (byte*) first_local_table->next;
+ first_local_table->next= 0;
+
+ if (!(res= mysql_prepare_insert(thd, tables, first_local_table,
+ table, lex->field_list, 0,
lex->update_list, lex->value_list,
lex->duplicates)) &&
- (result= new select_insert(tables->table, &lex->field_list,
+ (result= new select_insert(table, &lex->field_list,
&lex->update_list, &lex->value_list,
lex->duplicates, lex->ignore)))
{
- TABLE *table= tables->table;
- /* Skip first table, which is the table we are inserting in */
- lex->select_lex.table_list.first= (byte*) first_local_table->next;
/*
insert/replace from SELECT give its SELECT_LEX for SELECT,
and item_list belong to SELECT
@@ -2787,7 +2792,6 @@
lex->select_lex.resolve_mode= SELECT_LEX::SELECT_MODE;
res= handle_select(thd, lex, result);
/* revert changes for SP */
- lex->select_lex.table_list.first= (byte*) first_local_table;
lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE;
delete result;
table->insert_values= 0;
@@ -2796,6 +2800,8 @@
}
else
res= -1;
+ first_local_table->next= tables;
+ lex->select_lex.table_list.first= (byte*) first_local_table;
break;
}
case SQLCOM_TRUNCATE:
--- 1.10/mysql-test/r/insert_update.result 2004-12-13 12:26:18 +00:00
+++ 1.11/mysql-test/r/insert_update.result 2005-02-09 05:27:01 +00:00
@@ -140,10 +140,10 @@
5 6 130
TRUNCATE TABLE t1;
INSERT t1 VALUES (1,2,10), (3,4,20);
-CREATE TABLE t2 (x INT, y INT, z INT, d INT);
+CREATE TABLE t2 (a INT, b INT, c INT, d INT);
INSERT t2 VALUES (5,6,30,1), (7,4,40,1), (8,9,60,1);
INSERT t2 VALUES (2,1,11,2), (7,4,40,2);
-INSERT t1 SELECT x,y,z FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=c+100;
+INSERT t1 SELECT a,b,c FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=c+100;
SELECT * FROM t1;
a b c
1 2 10
@@ -157,7 +157,7 @@
3 4 120
5 0 30
8 9 60
-INSERT t1 SELECT x,y,z FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
+INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
SELECT *, VALUES(a) FROM t1;
a b c VALUES(a)
1 2 10 NULL
--- 1.10/mysql-test/t/insert_update.test 2004-12-13 12:26:18 +00:00
+++ 1.11/mysql-test/t/insert_update.test 2005-02-09 05:27:02 +00:00
@@ -68,14 +68,15 @@
SELECT * FROM t1;
TRUNCATE TABLE t1;
INSERT t1 VALUES (1,2,10), (3,4,20);
-CREATE TABLE t2 (x INT, y INT, z INT, d INT);
+CREATE TABLE t2 (a INT, b INT, c INT, d INT);
+# column names deliberately clash with columns in t1 (Bug#8147)
INSERT t2 VALUES (5,6,30,1), (7,4,40,1), (8,9,60,1);
INSERT t2 VALUES (2,1,11,2), (7,4,40,2);
-INSERT t1 SELECT x,y,z FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=c+100;
+INSERT t1 SELECT a,b,c FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=c+100;
SELECT * FROM t1;
INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0;
SELECT * FROM t1;
-INSERT t1 SELECT x,y,z FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
+INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
SELECT *, VALUES(a) FROM t1;
DROP TABLE t1;
DROP TABLE t2;
| Thread |
|---|
| • bk commit into 4.1 tree (acurtis:1.2160) | antony | 9 Feb |