mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
SQL: fix implicit sys fields for implicit engine of partitioned table [#366]
This commit is contained in:
committed by
Aleksey Midenkov
parent
03b54a6b8a
commit
8c9c302016
@ -287,4 +287,10 @@ x
|
|||||||
select * from t1 partition (p1sp1) for system_time all;
|
select * from t1 partition (p1sp1) for system_time all;
|
||||||
x
|
x
|
||||||
2
|
2
|
||||||
|
create or replace table t1 (a bigint)
|
||||||
|
with system versioning
|
||||||
|
partition by range (a)
|
||||||
|
(partition p0 values less than (20) engine innodb,
|
||||||
|
partition p1 values less than maxvalue engine innodb);
|
||||||
|
insert into t1 values (1);
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -229,6 +229,13 @@ select * from t1 partition (p0sp1) for system_time all;
|
|||||||
select * from t1 partition (p1sp0) for system_time all;
|
select * from t1 partition (p1sp0) for system_time all;
|
||||||
select * from t1 partition (p1sp1) for system_time all;
|
select * from t1 partition (p1sp1) for system_time all;
|
||||||
|
|
||||||
|
create or replace table t1 (a bigint)
|
||||||
|
with system versioning
|
||||||
|
partition by range (a)
|
||||||
|
(partition p0 values less than (20) engine innodb,
|
||||||
|
partition p1 values less than maxvalue engine innodb);
|
||||||
|
insert into t1 values (1);
|
||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
-- source suite/versioning/common_finish.inc
|
-- source suite/versioning/common_finish.inc
|
||||||
|
@ -6872,7 +6872,25 @@ bool Vers_parse_info::check_and_fix_implicit(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool integer_fields= create_info->db_type->flags & HTON_NATIVE_SYS_VERSIONING;
|
bool integer_fields= ha_check_storage_engine_flag(create_info->db_type,
|
||||||
|
HTON_NATIVE_SYS_VERSIONING);
|
||||||
|
|
||||||
|
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||||
|
if (partition_info *info= thd->work_part_info)
|
||||||
|
{
|
||||||
|
if (!(create_info->used_fields & HA_CREATE_USED_ENGINE) &&
|
||||||
|
info->partitions.elements)
|
||||||
|
{
|
||||||
|
partition_element *element=
|
||||||
|
static_cast<partition_element *>(info->partitions.elem(0));
|
||||||
|
handlerton *hton= element->engine_type;
|
||||||
|
if (hton && ha_check_storage_engine_flag(hton, HTON_NATIVE_SYS_VERSIONING))
|
||||||
|
{
|
||||||
|
integer_fields= true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (fix_implicit(thd, alter_info, integer_fields))
|
if (fix_implicit(thd, alter_info, integer_fields))
|
||||||
return true;
|
return true;
|
||||||
@ -6947,8 +6965,8 @@ bool Vers_parse_info::check_and_fix_alter(THD *thd, Alter_info *alter_info,
|
|||||||
TABLE *table)
|
TABLE *table)
|
||||||
{
|
{
|
||||||
TABLE_SHARE *share= table->s;
|
TABLE_SHARE *share= table->s;
|
||||||
bool integer_fields=
|
bool integer_fields= ha_check_storage_engine_flag(create_info->db_type,
|
||||||
create_info->db_type->flags & HTON_NATIVE_SYS_VERSIONING;
|
HTON_NATIVE_SYS_VERSIONING);
|
||||||
const char *table_name= share->table_name.str;
|
const char *table_name= share->table_name.str;
|
||||||
|
|
||||||
if (!need_check() && !share->versioned)
|
if (!need_check() && !share->versioned)
|
||||||
|
@ -8854,13 +8854,17 @@ bool mysql_alter_table(THD *thd, const char *new_db, const char *new_name,
|
|||||||
|
|
||||||
if (versioned)
|
if (versioned)
|
||||||
{
|
{
|
||||||
if (create_info->db_type &&
|
if (handlerton *hton1= create_info->db_type)
|
||||||
table->s->db_type() != create_info->db_type && (
|
|
||||||
table->file->native_versioned() ||
|
|
||||||
create_info->db_type->flags & HTON_NATIVE_SYS_VERSIONING))
|
|
||||||
{
|
{
|
||||||
my_error(ER_VERS_ALTER_ENGINE_PROHIBITED, MYF(0), table_list->db, table_list->table_name);
|
handlerton *hton2= table->file->ht;
|
||||||
DBUG_RETURN(true);
|
if (hton1 != hton2 &&
|
||||||
|
(ha_check_storage_engine_flag(hton1, HTON_NATIVE_SYS_VERSIONING) ||
|
||||||
|
ha_check_storage_engine_flag(hton2, HTON_NATIVE_SYS_VERSIONING)))
|
||||||
|
{
|
||||||
|
my_error(ER_VERS_ALTER_ENGINE_PROHIBITED, MYF(0), table_list->db,
|
||||||
|
table_list->table_name);
|
||||||
|
DBUG_RETURN(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bool vers_data_mod= alter_info->data_modifying();
|
bool vers_data_mod= alter_info->data_modifying();
|
||||||
if (thd->variables.vers_alter_history == VERS_ALTER_HISTORY_SURVIVE)
|
if (thd->variables.vers_alter_history == VERS_ALTER_HISTORY_SURVIVE)
|
||||||
|
Reference in New Issue
Block a user