diff options
author | unknown <ingo@mysql.com> | 2005-12-07 19:52:26 +0100 |
---|---|---|
committer | unknown <ingo@mysql.com> | 2005-12-07 19:52:26 +0100 |
commit | f6cac54bf6598b2063a2cb1477994f22e86e78f6 (patch) | |
tree | 08b2239db39cadbbb81f584e0abeac0bf7993598 /sql/sql_parse.cc | |
parent | 966ab524a336bb22088d4adbb7db7a090762551e (diff) | |
download | mariadb-git-f6cac54bf6598b2063a2cb1477994f22e86e78f6.tar.gz |
BUG#5390 - problems with merge tables
Problem #1: INSERT...SELECT, Version for 4.1.
INSERT ... SELECT with the same table on both sides (hidden
below a MERGE table) does now work by buffering the select result.
The duplicate detection works now after open_and_lock_tables()
on the locks.
I did not find a test case that failed without the change in
sql_update.cc. I made the change anyway as it should in theory
fix a possible MERGE table problem with multi-table update.
libmysqld/ha_blackhole.cc:
BUG#5390 - problems with merge tables
No idea, how the symlink change made it into my patch.
mysql-test/r/create.result:
BUG#5390 - problems with merge tables
Removed a duplicate test.
mysql-test/r/merge.result:
BUG#5390 - problems with merge tables
Problem #1: INSERT...SELECT, Version for 4.1.
Added test results.
mysql-test/t/create.test:
BUG#5390 - problems with merge tables
Removed a duplicate test.
mysql-test/t/merge.test:
BUG#5390 - problems with merge tables
Problem #1: INSERT...SELECT, Version for 4.1.
Added tests.
sql/lock.cc:
BUG#5390 - problems with merge tables
Problem #1: INSERT...SELECT, Version for 4.1.
Added a new function to find a duplicate lock in a list of tables.
sql/mysql_priv.h:
BUG#5390 - problems with merge tables
Problem #1: INSERT...SELECT, Version for 4.1.
Added a declaration for the new function.
sql/sql_parse.cc:
BUG#5390 - problems with merge tables
Problem #1: INSERT...SELECT, Version for 4.1.
Changed the duplicate tables detection for INSERT ... SELECT
to use the new function, which does also work for MERGE tables.
sql/sql_update.cc:
BUG#5390 - problems with merge tables
Problem #1: INSERT...SELECT, Version for 4.1.
Changed the duplicate tables detection for UPDATE
to use the new function, which does also work for MERGE tables.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index fbca542dc24..90de630da60 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2897,16 +2897,17 @@ unsent_create_error: if (unit->select_limit_cnt < select_lex->select_limit) unit->select_limit_cnt= HA_POS_ERROR; // No limit - if (find_real_table_in_list(tables->next, tables->db, tables->real_name)) + if ((res= open_and_lock_tables(thd, tables))) + break; + + insert_table= tables->table; + /* MERGE sub-tables can only be detected after open. */ + if (mysql_lock_have_duplicate(thd, insert_table, tables->next)) { /* Using same table for INSERT and SELECT */ select_lex->options |= OPTION_BUFFER_RESULT; } - if ((res= open_and_lock_tables(thd, tables))) - break; - - insert_table= tables->table; /* Skip first table, which is the table we are inserting in */ select_lex->table_list.first= (byte*) first_local_table->next; tables= (TABLE_LIST *) select_lex->table_list.first; |