mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge 10.3 into 10.4
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Copyright (c) 2000, 2019, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2020, MariaDB
|
||||
Copyright (c) 2010, 2021, MariaDB
|
||||
|
||||
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
|
||||
@ -8318,7 +8318,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
||||
def->real_field_type() == MYSQL_TYPE_NEWDATE ||
|
||||
def->real_field_type() == MYSQL_TYPE_DATETIME ||
|
||||
def->real_field_type() == MYSQL_TYPE_DATETIME2) &&
|
||||
!alter_ctx->datetime_field &&
|
||||
!alter_ctx->datetime_field && !def->field &&
|
||||
!(~def->flags & (NO_DEFAULT_VALUE_FLAG | NOT_NULL_FLAG)) &&
|
||||
thd->variables.sql_mode & MODE_NO_ZERO_DATE)
|
||||
{
|
||||
@ -8527,7 +8527,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
||||
key_parts.push_back(new (thd->mem_root) Key_part_spec(&cfield->field_name,
|
||||
key_part_length, true),
|
||||
thd->mem_root);
|
||||
if (cfield->invisible < INVISIBLE_SYSTEM)
|
||||
if (!(cfield->invisible == INVISIBLE_SYSTEM && cfield->vers_sys_field()))
|
||||
user_keyparts= true;
|
||||
}
|
||||
if (table->s->tmp_table == NO_TMP_TABLE)
|
||||
@ -8539,6 +8539,14 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
||||
(void) delete_statistics_for_index(thd, table, key_info, TRUE);
|
||||
}
|
||||
|
||||
if (!user_keyparts && key_parts.elements)
|
||||
{
|
||||
/*
|
||||
If we dropped all user key-parts we also drop implicit system fields.
|
||||
*/
|
||||
key_parts.empty();
|
||||
}
|
||||
|
||||
if (key_parts.elements)
|
||||
{
|
||||
KEY_CREATE_INFO key_create_info;
|
||||
@ -8574,7 +8582,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
||||
key_type= Key::PRIMARY;
|
||||
else
|
||||
key_type= Key::UNIQUE;
|
||||
if (dropped_key_part && user_keyparts)
|
||||
if (dropped_key_part)
|
||||
{
|
||||
my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), dropped_key_part);
|
||||
if (long_hash_key)
|
||||
|
Reference in New Issue
Block a user