summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc38
1 files changed, 27 insertions, 11 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index b9d50a7684e..d88e5f06425 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -8107,7 +8107,6 @@ static Create_field *vers_init_sys_field(THD *thd, const char *field_name, int f
f->flags= flags | NOT_NULL_FLAG;
if (integer)
{
- DBUG_ASSERT(0); // Not implemented yet
f->set_handler(&type_handler_vers_trx_id);
f->length= MY_INT64_NUM_DECIMAL_DIGITS - 1;
f->flags|= UNSIGNED_FLAG;
@@ -8125,10 +8124,13 @@ static Create_field *vers_init_sys_field(THD *thd, const char *field_name, int f
return f;
}
-static bool vers_create_sys_field(THD *thd, const char *field_name,
- Alter_info *alter_info, int flags)
+bool Vers_parse_info::create_sys_field(THD *thd, const char *field_name,
+ Alter_info *alter_info, int flags)
{
- Create_field *f= vers_init_sys_field(thd, field_name, flags, false);
+ DBUG_ASSERT(can_native >= 0); /* Requires vers_check_native() called */
+ Create_field *f= vers_init_sys_field(thd, field_name, flags,
+ DBUG_EVALUATE_IF("sysvers_force_trx",
+ (bool) can_native, false));
if (!f)
return true;
@@ -8152,8 +8154,8 @@ bool Vers_parse_info::fix_implicit(THD *thd, Alter_info *alter_info)
period= start_end_t(default_start, default_end);
as_row= period;
- if (vers_create_sys_field(thd, default_start, alter_info, VERS_ROW_START) ||
- vers_create_sys_field(thd, default_end, alter_info, VERS_ROW_END))
+ if (create_sys_field(thd, default_start, alter_info, VERS_ROW_START) ||
+ create_sys_field(thd, default_end, alter_info, VERS_ROW_END))
{
return true;
}
@@ -8161,14 +8163,25 @@ bool Vers_parse_info::fix_implicit(THD *thd, Alter_info *alter_info)
}
+void Table_scope_and_contents_source_st::vers_check_native()
+{
+ vers_info.can_native= (db_type->db_type == DB_TYPE_PARTITION_DB ||
+ ha_check_storage_engine_flag(db_type,
+ HTON_NATIVE_SYS_VERSIONING));
+}
+
+
bool Table_scope_and_contents_source_st::vers_fix_system_fields(
THD *thd, Alter_info *alter_info, const TABLE_LIST &create_table)
{
DBUG_ASSERT(!(alter_info->flags & ALTER_DROP_SYSTEM_VERSIONING));
- DBUG_EXECUTE_IF("sysvers_force", if (!tmp_table()) {
- alter_info->flags|= ALTER_ADD_SYSTEM_VERSIONING;
- options|= HA_VERSIONED_TABLE; });
+ if (DBUG_EVALUATE_IF("sysvers_force", true, false) ||
+ DBUG_EVALUATE_IF("sysvers_force_trx", true, false))
+ {
+ alter_info->flags|= ALTER_ADD_SYSTEM_VERSIONING;
+ options|= HA_VERSIONED_TABLE;
+ }
if (!vers_info.need_check(alter_info))
return false;
@@ -8199,7 +8212,9 @@ bool Table_scope_and_contents_source_st::vers_fix_system_fields(
{
f->flags|= VERS_UPDATE_UNVERSIONED_FLAG;
}
- } // while (Create_field *f= it++)
+ } // while
+
+ vers_check_native();
if (vers_info.fix_implicit(thd, alter_info))
return true;
@@ -8265,7 +8280,8 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info,
if (!need_check(alter_info) && !share->versioned)
return false;
- if (DBUG_EVALUATE_IF("sysvers_force", 0, share->tmp_table))
+ if (DBUG_EVALUATE_IF("sysvers_force", 0, share->tmp_table) ||
+ DBUG_EVALUATE_IF("sysvers_force_trx", 0, share->tmp_table))
{
my_error(ER_VERS_NOT_SUPPORTED, MYF(0), "CREATE TEMPORARY TABLE");
return true;