summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index b3f957b6737..653d7c017ac 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -6995,6 +6995,13 @@ bool Table_scope_and_contents_source_st::vers_check_system_fields(
List_iterator<Create_field> field_it(alter_info->create_list);
while (Create_field *f= field_it++)
{
+ /*
+ The field from the CREATE part can be duplicated in the SELECT part of
+ CREATE...SELECT. In that case double counts should be avoided.
+ select_create::create_table_from_items just pushes the fields back into
+ the create_list, without additional manipulations, so the fields from
+ SELECT go last there.
+ */
bool is_dup= false;
if (fieldnr >= alter_info->create_list.elements - select_count)
{
@@ -7018,8 +7025,6 @@ bool Table_scope_and_contents_source_st::vers_check_system_fields(
if (!(alter_info->flags & ALTER_ADD_SYSTEM_VERSIONING))
return false;
- if (!(options & HA_VERSIONED_TABLE))
- return false;
return vers_info.check_sys_fields(table_name, db, alter_info,
vers_native(thd));
}