mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
SQL, IB: unversioned fields with ALTER TABLE [fixes #401]
This commit is contained in:
parent
4624e565f3
commit
9b55cc73f1
7 changed files with 20 additions and 1 deletions
|
@ -512,5 +512,10 @@ alter table t add system versioning;
|
|||
ERROR HY000: Table `t` is already system-versioned table
|
||||
alter table t add system versioning, drop system versioning;
|
||||
ERROR HY000: Table `t` is already system-versioned table
|
||||
set @@versioning_alter_history=keep;
|
||||
create or replace table t(x int, y int) with system versioning engine=innodb;
|
||||
alter table t modify y int without system versioning;
|
||||
insert into t values(1, 1);
|
||||
update t set y=2;
|
||||
drop database test;
|
||||
create database test;
|
||||
|
|
|
@ -349,5 +349,11 @@ alter table t add system versioning;
|
|||
--error ER_VERS_ALREADY_VERSIONED
|
||||
alter table t add system versioning, drop system versioning;
|
||||
|
||||
set @@versioning_alter_history=keep;
|
||||
create or replace table t(x int, y int) with system versioning engine=innodb;
|
||||
alter table t modify y int without system versioning;
|
||||
insert into t values(1, 1);
|
||||
update t set y=2;
|
||||
|
||||
drop database test;
|
||||
create database test;
|
||||
|
|
|
@ -2168,6 +2168,8 @@ public:
|
|||
|
||||
static const HA_ALTER_FLAGS ALTER_DROP_HISTORICAL = 1ULL << 41;
|
||||
|
||||
static const HA_ALTER_FLAGS ALTER_COLUMN_UNVERSIONED = 1ULL << 42;
|
||||
|
||||
/**
|
||||
Create options (like MAX_ROWS) for the new version of table.
|
||||
|
||||
|
|
|
@ -95,7 +95,8 @@ public:
|
|||
// Set for ADD [COLUMN] FIRST | AFTER
|
||||
ALTER_COLUMN_ORDER = 1L << 25,
|
||||
ALTER_ADD_CHECK_CONSTRAINT = 1L << 27,
|
||||
ALTER_DROP_CHECK_CONSTRAINT = 1L << 28
|
||||
ALTER_DROP_CHECK_CONSTRAINT = 1L << 28,
|
||||
ALTER_COLUMN_UNVERSIONED = 1L << 29,
|
||||
};
|
||||
|
||||
enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE };
|
||||
|
|
|
@ -6562,6 +6562,8 @@ static bool fill_alter_inplace_info(THD *thd,
|
|||
ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_DROP_CHECK_CONSTRAINT;
|
||||
if (thd->variables.vers_alter_history == VERS_ALTER_HISTORY_DROP)
|
||||
ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_DROP_HISTORICAL;
|
||||
if (alter_info->flags & Alter_info::ALTER_COLUMN_UNVERSIONED)
|
||||
ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_COLUMN_UNVERSIONED;
|
||||
|
||||
/*
|
||||
If we altering table with old VARCHAR fields we will be automatically
|
||||
|
|
|
@ -7112,11 +7112,13 @@ serial_attribute:
|
|||
with_or_without_system:
|
||||
WITH_SYSTEM_SYM
|
||||
{
|
||||
Lex->alter_info.flags|= Alter_info::ALTER_COLUMN_UNVERSIONED;
|
||||
Lex->create_info.vers_info.versioned_fields= true;
|
||||
$$= Column_definition::WITH_VERSIONING;
|
||||
}
|
||||
| WITHOUT SYSTEM
|
||||
{
|
||||
Lex->alter_info.flags|= Alter_info::ALTER_COLUMN_UNVERSIONED;
|
||||
Lex->create_info.vers_info.unversioned_fields= true;
|
||||
$$= Column_definition::WITHOUT_VERSIONING;
|
||||
}
|
||||
|
|
|
@ -87,6 +87,7 @@ static const Alter_inplace_info::HA_ALTER_FLAGS INNOBASE_ALTER_REBUILD
|
|||
/*
|
||||
| Alter_inplace_info::ALTER_STORED_COLUMN_TYPE
|
||||
*/
|
||||
| Alter_inplace_info::ALTER_COLUMN_UNVERSIONED
|
||||
;
|
||||
|
||||
/** Operations that require changes to data */
|
||||
|
|
Loading…
Add table
Reference in a new issue