mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
SQL, IB: unversioned fields with ALTER TABLE [fixes #401]
This commit is contained in:
@ -512,5 +512,10 @@ alter table t add system versioning;
|
|||||||
ERROR HY000: Table `t` is already system-versioned table
|
ERROR HY000: Table `t` is already system-versioned table
|
||||||
alter table t add system versioning, drop system versioning;
|
alter table t add system versioning, drop system versioning;
|
||||||
ERROR HY000: Table `t` is already system-versioned table
|
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;
|
drop database test;
|
||||||
create database test;
|
create database test;
|
||||||
|
@ -349,5 +349,11 @@ alter table t add system versioning;
|
|||||||
--error ER_VERS_ALREADY_VERSIONED
|
--error ER_VERS_ALREADY_VERSIONED
|
||||||
alter table t add system versioning, drop system versioning;
|
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;
|
drop database test;
|
||||||
create 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_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.
|
Create options (like MAX_ROWS) for the new version of table.
|
||||||
|
|
||||||
|
@ -95,7 +95,8 @@ public:
|
|||||||
// Set for ADD [COLUMN] FIRST | AFTER
|
// Set for ADD [COLUMN] FIRST | AFTER
|
||||||
ALTER_COLUMN_ORDER = 1L << 25,
|
ALTER_COLUMN_ORDER = 1L << 25,
|
||||||
ALTER_ADD_CHECK_CONSTRAINT = 1L << 27,
|
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 };
|
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;
|
ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_DROP_CHECK_CONSTRAINT;
|
||||||
if (thd->variables.vers_alter_history == VERS_ALTER_HISTORY_DROP)
|
if (thd->variables.vers_alter_history == VERS_ALTER_HISTORY_DROP)
|
||||||
ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_DROP_HISTORICAL;
|
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
|
If we altering table with old VARCHAR fields we will be automatically
|
||||||
|
@ -7112,11 +7112,13 @@ serial_attribute:
|
|||||||
with_or_without_system:
|
with_or_without_system:
|
||||||
WITH_SYSTEM_SYM
|
WITH_SYSTEM_SYM
|
||||||
{
|
{
|
||||||
|
Lex->alter_info.flags|= Alter_info::ALTER_COLUMN_UNVERSIONED;
|
||||||
Lex->create_info.vers_info.versioned_fields= true;
|
Lex->create_info.vers_info.versioned_fields= true;
|
||||||
$$= Column_definition::WITH_VERSIONING;
|
$$= Column_definition::WITH_VERSIONING;
|
||||||
}
|
}
|
||||||
| WITHOUT SYSTEM
|
| WITHOUT SYSTEM
|
||||||
{
|
{
|
||||||
|
Lex->alter_info.flags|= Alter_info::ALTER_COLUMN_UNVERSIONED;
|
||||||
Lex->create_info.vers_info.unversioned_fields= true;
|
Lex->create_info.vers_info.unversioned_fields= true;
|
||||||
$$= Column_definition::WITHOUT_VERSIONING;
|
$$= 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_STORED_COLUMN_TYPE
|
||||||
*/
|
*/
|
||||||
|
| Alter_inplace_info::ALTER_COLUMN_UNVERSIONED
|
||||||
;
|
;
|
||||||
|
|
||||||
/** Operations that require changes to data */
|
/** Operations that require changes to data */
|
||||||
|
Reference in New Issue
Block a user