1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

SQL: default engine fix in create from versioned [fixes #206]

This commit is contained in:
Eugene Kosov
2017-06-27 12:22:52 +03:00
committed by Aleksey Midenkov
parent faab918ecd
commit 46d572dde4
3 changed files with 64 additions and 3 deletions

View File

@ -6663,9 +6663,6 @@ bool Vers_parse_info::check_and_fix_implicit(
HA_CREATE_INFO *create_info,
const char* table_name)
{
bool integer_fields=
create_info->db_type->flags & HTON_NATIVE_SYS_VERSIONING;
SELECT_LEX &slex= thd->lex->select_lex;
int vers_tables= 0;
bool from_select= slex.item_list.elements ? true : false;
@ -6677,6 +6674,21 @@ bool Vers_parse_info::check_and_fix_implicit(
if (table->table && table->table->versioned())
vers_tables++;
}
// Possibly override default storage engine to match
// one used in source table.
if (!(create_info->used_fields & HA_CREATE_USED_ENGINE))
{
List_iterator_fast<Create_field> it(alter_info->create_list);
while (Create_field *f= it++)
{
if (is_trx_start(*f) || is_trx_end(*f))
{
create_info->db_type= f->field->orig_table->file->ht;
break;
}
}
}
}
// CREATE ... SELECT: if at least one table in SELECT is versioned,
@ -6750,6 +6762,8 @@ bool Vers_parse_info::check_and_fix_implicit(
}
}
bool integer_fields= create_info->db_type->flags & HTON_NATIVE_SYS_VERSIONING;
if (vers_tables > 0)
{
if (!generated_as_row.start && !generated_as_row.end)