@@ -7138,13 +7138,34 @@ bool Vers_parse_info::check_and_fix_alter(THD *thd, Alter_info *alter_info,
71387138 check_generated_type (table_name, alter_info, integer_fields)));
71397139}
71407140
7141- bool Vers_parse_info::fix_create_like (THD *thd, Alter_info *alter_info,
7142- HA_CREATE_INFO *create_info, TABLE_LIST *table)
7141+ bool
7142+ Vers_parse_info::fix_create_like (Alter_info &alter_info, HA_CREATE_INFO &create_info,
7143+ TABLE_LIST &src_table, TABLE_LIST &table)
71437144{
7144- List_iterator<Create_field> it (alter_info-> create_list );
7145+ List_iterator<Create_field> it (alter_info. create_list );
71457146 Create_field *f, *f_start=NULL , *f_end= NULL ;
71467147
7147- DBUG_ASSERT (alter_info->create_list .elements > 2 );
7148+ DBUG_ASSERT (alter_info.create_list .elements > 2 );
7149+
7150+ if (create_info.tmp_table ())
7151+ {
7152+ int remove= 2 ;
7153+ while (remove && (f= it++))
7154+ {
7155+ if (f->flags & (VERS_SYS_START_FLAG|VERS_SYS_END_FLAG))
7156+ {
7157+ it.remove ();
7158+ remove--;
7159+ }
7160+ }
7161+ DBUG_ASSERT (remove == 0 );
7162+ push_warning_printf (current_thd, Sql_condition::WARN_LEVEL_WARN,
7163+ ER_UNKNOWN_ERROR,
7164+ " System versioning is stripped from temporary `%s.%s`" ,
7165+ table.db , table.table_name );
7166+ return false ;
7167+ }
7168+
71487169 while ((f= it++))
71497170 {
71507171 if (f->flags & VERS_SYS_START_FLAG)
@@ -7163,15 +7184,15 @@ bool Vers_parse_info::fix_create_like(THD *thd, Alter_info *alter_info,
71637184
71647185 if (!f_start || !f_end)
71657186 {
7166- my_error_as (ER_VERS_WRONG_PARAMS, ER_MISSING, MYF (0 ), table-> table_name ,
7187+ my_error_as (ER_VERS_WRONG_PARAMS, ER_MISSING, MYF (0 ), src_table. table_name ,
71677188 f_start ? " AS ROW END" : " AS ROW START" );
71687189 return true ;
71697190 }
71707191
71717192 as_row= start_end_t (f_start->field_name , f_end->field_name );
71727193 system_time= as_row;
71737194
7174- create_info-> options |= HA_VERSIONED_TABLE;
7195+ create_info. options |= HA_VERSIONED_TABLE;
71757196 return false ;
71767197}
71777198
0 commit comments