diff options
author | unknown <gkodinov@mysql.com> | 2006-06-21 13:03:06 +0300 |
---|---|---|
committer | unknown <gkodinov@mysql.com> | 2006-06-21 13:03:06 +0300 |
commit | b92ad63f995d9cd301dc9ebbad241a834e2d9ed0 (patch) | |
tree | ef3a7f7c8b8fc35254fc283ad145010517bc59e3 | |
parent | 2346733139a5286a5d6596f4c086c985e03b8b4f (diff) | |
parent | b7e27e80d9dc065d2ecc49aad371a71ad3a824a4 (diff) | |
download | mariadb-git-b92ad63f995d9cd301dc9ebbad241a834e2d9ed0.tar.gz |
merge of the changes for bug #18080
mysql-test/t/insert_select.test:
Auto merged
mysql-test/r/insert_select.result:
manual merge
-rw-r--r-- | mysql-test/r/insert_select.result | 5 | ||||
-rw-r--r-- | mysql-test/t/insert_select.test | 9 | ||||
-rw-r--r-- | sql/sql_parse.cc | 9 |
3 files changed, 14 insertions, 9 deletions
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result index 2cfbb51441d..49d9c3594db 100644 --- a/mysql-test/r/insert_select.result +++ b/mysql-test/r/insert_select.result @@ -690,3 +690,8 @@ CREATE TABLE t1 (a int PRIMARY KEY); INSERT INTO t1 values (1), (2); INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1; DROP TABLE t1; +CREATE TABLE t1 (x int, y int); +CREATE TABLE t2 (z int, y int); +CREATE TABLE t3 (a int, b int); +INSERT INTO t3 (SELECT x, y FROM t1 JOIN t2 USING (y) WHERE z = 1); +DROP TABLE IF EXISTS t1,t2,t3; diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test index 0b9a0e86ba9..05953a1fd49 100644 --- a/mysql-test/t/insert_select.test +++ b/mysql-test/t/insert_select.test @@ -238,3 +238,12 @@ INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1; DROP TABLE t1; # End of 4.1 tests + +# +# Bug #18080: INSERT ... SELECT ... JOIN results in ambiguous field list error +# +CREATE TABLE t1 (x int, y int); +CREATE TABLE t2 (z int, y int); +CREATE TABLE t3 (a int, b int); +INSERT INTO t3 (SELECT x, y FROM t1 JOIN t2 USING (y) WHERE z = 1); +DROP TABLE IF EXISTS t1,t2,t3; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ba5c2ebf484..28b2abfc883 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3333,15 +3333,6 @@ end_with_restore_list: &lex->value_list, lex->duplicates, lex->ignore))) { - /* - Skip first table, which is the table we are inserting in. - Below we set context.table_list again because the call above to - mysql_insert_select_prepare() calls resolve_in_table_list_only(), - which in turn resets context.table_list and - context.first_name_resolution_table. - */ - select_lex->context.table_list= - select_lex->context.first_name_resolution_table= second_table; res= handle_select(thd, lex, result, OPTION_SETUP_TABLES_DONE); /* Invalidate the table in the query cache if something changed |