summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorunknown <ingo@mysql.com>2005-12-20 16:35:05 +0100
committerunknown <ingo@mysql.com>2005-12-20 16:35:05 +0100
commit5113bdffd0d17cb40bb0917d80128de9ded94730 (patch)
tree054204a3a6a6de4e2b1d33e79355f2bbf4c60c57 /sql/sql_base.cc
parent5213f5894a043b74f12d2be1a43e30de3d5e6b69 (diff)
downloadmariadb-git-5113bdffd0d17cb40bb0917d80128de9ded94730.tar.gz
BUG#5390 - problems with merge tables
Problem #1: INSERT...SELECT, Version for 5.0. Extended the unique table check by a check of lock data. Merge sub-tables cannot be detected by doing name checks only. 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 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 Added tests. sql/lock.cc: BUG#5390 - problems with merge tables Problem #1: INSERT...SELECT, Version for 5.0. 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 5.0. Added the thread handle to unique_table(). Added a declaration for the new function. sql/sql_base.cc: BUG#5390 - problems with merge tables Problem #1: INSERT...SELECT, Version for 5.0. Added the thread handle to unique_table(). Added a call to the new mysql_lock_have_duplicate(), which needs the thread handle, to unique_table(). sql/sql_delete.cc: BUG#5390 - problems with merge tables Problem #1: INSERT...SELECT, Version for 5.0. Added the thread handle to unique_table(). sql/sql_insert.cc: BUG#5390 - problems with merge tables Problem #1: INSERT...SELECT, Version for 5.0. Added the thread handle to unique_table(). sql/sql_load.cc: BUG#5390 - problems with merge tables Problem #1: INSERT...SELECT, Version for 5.0. Added the thread handle to unique_table(). sql/sql_parse.cc: BUG#5390 - problems with merge tables Problem #1: INSERT...SELECT, Version for 5.0. Added the thread handle to unique_table(). sql/sql_update.cc: BUG#5390 - problems with merge tables Problem #1: INSERT...SELECT, Version for 5.0. Added the thread handle to unique_table(). Replaced a call to find_table_in_local_list() by the newly extended unique_table().
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 0e1c1525c9e..92aab055aac 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -698,6 +698,7 @@ TABLE_LIST *find_table_in_list(TABLE_LIST *table,
SYNOPSIS
unique_table()
+ thd thread handle
table table which should be checked
table_list list of tables
@@ -723,7 +724,7 @@ TABLE_LIST *find_table_in_list(TABLE_LIST *table,
0 if table is unique
*/
-TABLE_LIST* unique_table(TABLE_LIST *table, TABLE_LIST *table_list)
+TABLE_LIST* unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list)
{
TABLE_LIST *res;
const char *d_name, *t_name;
@@ -758,9 +759,10 @@ TABLE_LIST* unique_table(TABLE_LIST *table, TABLE_LIST *table_list)
DBUG_PRINT("info", ("real table: %s.%s", d_name, t_name));
for (;;)
{
- if (!(res= find_table_in_global_list(table_list, d_name, t_name)) ||
- (!res->table || res->table != table->table) &&
- (res->select_lex && !res->select_lex->exclude_from_table_unique_test))
+ if (((! (res= find_table_in_global_list(table_list, d_name, t_name))) &&
+ (! (res= mysql_lock_have_duplicate(thd, table, table_list)))) ||
+ ((!res->table || res->table != table->table) &&
+ res->select_lex && !res->select_lex->exclude_from_table_unique_test))
break;
/*
If we found entry of this table or or table of SELECT which already