1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

Bug#4118: multi-table UPDATE takes WRITE lock on read table

Ensures that WRITE lock is not obtained on all tables referenced.
This commit is contained in:
antony@ltantony.rdg.cyberkinetica.homeunix.net
2004-10-03 00:20:47 +01:00
parent 5cf8e9d769
commit 2973a047ea
7 changed files with 155 additions and 33 deletions

View File

@@ -1927,21 +1927,26 @@ mysql_execute_command(void)
send_error(&thd->net,ER_WRONG_VALUE_COUNT);
DBUG_VOID_RETURN;
}
if (select_lex->table_list.elements == 1)
if (check_one_table_access(thd, UPDATE_ACL, tables, 0))
goto error; /* purecov: inspected */
res= mysql_update(thd,tables,
select_lex->item_list,
lex->value_list,
select_lex->where,
(ORDER *) select_lex->order_list.first,
select_lex->select_limit,
lex->duplicates);
break;
case SQLCOM_MULTI_UPDATE:
if (check_db_used(thd,tables))
goto error;
if (select_lex->item_list.elements != lex->value_list.elements)
{
if (check_one_table_access(thd, UPDATE_ACL, tables, 0))
goto error; /* purecov: inspected */
res= mysql_update(thd,tables,
select_lex->item_list,
lex->value_list,
select_lex->where,
(ORDER *) select_lex->order_list.first,
select_lex->select_limit,
lex->duplicates);
send_error(&thd->net,ER_WRONG_VALUE_COUNT);
DBUG_VOID_RETURN;
}
else
{
const char *msg= 0;
TABLE_LIST *table;