mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge
This commit is contained in:
@ -1987,8 +1987,8 @@ next:
|
||||
("convert merged to materialization to resolve the conflict"));
|
||||
derived->change_refs_to_fields();
|
||||
derived->set_materialized_derived();
|
||||
goto retry;
|
||||
}
|
||||
goto retry;
|
||||
}
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
@ -5753,6 +5753,32 @@ bool lock_tables(THD *thd, TABLE_LIST *tables, uint count,
|
||||
has_write_table_with_auto_increment_and_select(tables))
|
||||
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_WRITE_AUTOINC_SELECT);
|
||||
|
||||
/*
|
||||
INSERT...ON DUPLICATE KEY UPDATE on a table with more than one unique keys
|
||||
can be unsafe.
|
||||
*/
|
||||
uint unique_keys= 0;
|
||||
for (TABLE_LIST *query_table= tables; query_table && unique_keys <= 1;
|
||||
query_table= query_table->next_global)
|
||||
if(query_table->table)
|
||||
{
|
||||
uint keys= query_table->table->s->keys, i= 0;
|
||||
unique_keys= 0;
|
||||
for (KEY* keyinfo= query_table->table->s->key_info;
|
||||
i < keys && unique_keys <= 1; i++, keyinfo++)
|
||||
{
|
||||
if (keyinfo->flags & HA_NOSAME)
|
||||
unique_keys++;
|
||||
}
|
||||
if (!query_table->placeholder() &&
|
||||
query_table->lock_type >= TL_WRITE_ALLOW_WRITE &&
|
||||
unique_keys > 1 && thd->lex->sql_command == SQLCOM_INSERT &&
|
||||
/* Duplicate key update is not supported by INSERT DELAYED */
|
||||
thd->command != COM_DELAYED_INSERT &&
|
||||
thd->lex->duplicates == DUP_UPDATE)
|
||||
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_INSERT_TWO_KEYS);
|
||||
}
|
||||
|
||||
/* We have to emulate LOCK TABLES if we are statement needs prelocking. */
|
||||
if (thd->lex->requires_prelocking())
|
||||
{
|
||||
|
Reference in New Issue
Block a user