mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-16102 Wrong ER_DUP_ENTRY upon ADD UNIQUE KEY on versioned table
* ignore CHECK constraint for historical rows; * FOREIGN KEY test case. TODO: MDEV-16301 IB: use real table name for error messages on ALTER Closes tempesta-tech/mariadb#491 Closes #748
This commit is contained in:
committed by
Sergei Golubchik
parent
b5184c7efb
commit
7c0779da7c
@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2016, MariaDB Corporation
|
||||
Copyright (c) 2016, 2018, MariaDB Corporation
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -209,6 +209,35 @@ bool Alter_info::supports_lock(THD *thd, enum_alter_inplace_result result,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Alter_info::vers_prohibited(THD *thd) const
|
||||
{
|
||||
if (thd->slave_thread ||
|
||||
thd->variables.vers_alter_history != VERS_ALTER_HISTORY_ERROR)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (flags & (
|
||||
ALTER_PARSER_ADD_COLUMN |
|
||||
ALTER_PARSER_DROP_COLUMN |
|
||||
ALTER_CHANGE_COLUMN |
|
||||
ALTER_COLUMN_ORDER))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (flags & ALTER_ADD_INDEX)
|
||||
{
|
||||
List_iterator_fast<Key> key_it(const_cast<List<Key> &>(key_list));
|
||||
Key *key;
|
||||
while ((key= key_it++))
|
||||
{
|
||||
if (key->type == Key::PRIMARY || key->type == Key::UNIQUE)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Alter_table_ctx::Alter_table_ctx()
|
||||
: datetime_field(NULL), error_if_not_empty(false),
|
||||
tables_opened(0),
|
||||
|
Reference in New Issue
Block a user