Skip to content

Instantly share code, notes, and snippets.

@kevgs
Created December 15, 2017 10:30
Show Gist options
  • Save kevgs/f4b200dd79aa3c67d3689dd0b2ab7cd5 to your computer and use it in GitHub Desktop.
Save kevgs/f4b200dd79aa3c67d3689dd0b2ab7cd5 to your computer and use it in GitHub Desktop.
diff --git a/sql/handler.cc b/sql/handler.cc
index 9d19ede0a70..c8d06114847 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -6843,10 +6843,23 @@ bool Vers_parse_info::fix_implicit(THD *thd, Alter_info *alter_info,
return false;
}
-bool Table_scope_and_contents_source_st::vers_native(THD *thd) const
+bool Table_scope_and_contents_source_st::vers_native(THD *thd, TABLE *table) const
{
- if (ha_check_storage_engine_flag(db_type, HTON_NATIVE_SYS_VERSIONING))
+ if (table)
+ {
+ handlerton *hton1= db_type;
+ handlerton *hton2= table->file->partition_ht();
+ bool int1 = ha_check_storage_engine_flag(hton1, HTON_NATIVE_SYS_VERSIONING);
+ bool int2 = ha_check_storage_engine_flag(hton2, HTON_NATIVE_SYS_VERSIONING);
+ if (hton1 != hton2)
+ return int1 || int2;
+ if (int1 || int2)
+ return true;
+ }
+ else if (ha_check_storage_engine_flag(db_type, HTON_NATIVE_SYS_VERSIONING))
+ {
return true;
+ }
#ifdef WITH_PARTITION_STORAGE_ENGINE
partition_info *info= thd->work_part_info;
@@ -7092,7 +7105,7 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info,
TABLE *table)
{
TABLE_SHARE *share= table->s;
- bool integer_fields= create_info->vers_native(thd);
+ bool integer_fields= create_info->vers_native(thd, table);
const char *table_name= share->table_name.str;
if (!need_check() && !share->versioned)
diff --git a/sql/handler.h b/sql/handler.h
index 44e18e17a1e..58826446f04 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1878,7 +1878,7 @@ struct Table_scope_and_contents_source_st
List<Item> *items= NULL,
bool *versioned_write= NULL);
- bool vers_native(THD *thd) const;
+ bool vers_native(THD *thd, TABLE *table=NULL) const;
void init()
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment