mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Fixed for Bug #39248 Maria: INSERT ON DUPLICATE KEY UPDATE gives error if using a view
The bug was that prepared statements didn't downgrade TL_WRITE_CONCURRENT properly mysql-test/r/maria.result: Added test case mysql-test/t/maria.test: Added test case sql/mysql_priv.h: Make upgrade_lock_type() global sql/sql_base.cc: Fixed indentation sql/sql_insert.cc: Make upgrade_lock_type() global sql/sql_prepare.cc: Call upgrade_lock_type_for_insert() to get right lock to use sql/sql_view.cc: Indentation fix
This commit is contained in:
@@ -387,10 +387,9 @@ void prepare_triggers_for_insert_stmt(TABLE *table)
|
||||
downgrade the lock in handler::store_lock() method.
|
||||
*/
|
||||
|
||||
static
|
||||
void upgrade_lock_type(THD *thd, thr_lock_type *lock_type,
|
||||
enum_duplicates duplic,
|
||||
bool is_multi_insert)
|
||||
void upgrade_lock_type_for_insert(THD *thd, thr_lock_type *lock_type,
|
||||
enum_duplicates duplic,
|
||||
bool is_multi_insert)
|
||||
{
|
||||
if (duplic == DUP_UPDATE ||
|
||||
duplic == DUP_REPLACE && *lock_type == TL_WRITE_CONCURRENT_INSERT)
|
||||
@@ -587,8 +586,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
|
||||
Upgrade lock type if the requested lock is incompatible with
|
||||
the current connection mode or table operation.
|
||||
*/
|
||||
upgrade_lock_type(thd, &table_list->lock_type, duplic,
|
||||
values_list.elements > 1);
|
||||
upgrade_lock_type_for_insert(thd, &table_list->lock_type, duplic,
|
||||
values_list.elements > 1);
|
||||
|
||||
/*
|
||||
We can't write-delayed into a table locked with LOCK TABLES:
|
||||
|
Reference in New Issue
Block a user