summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Malyavin <nikitamalyavin@gmail.com>2019-09-05 22:59:53 +0300
committerNikita Malyavin <nikitamalyavin@gmail.com>2019-09-05 22:59:53 +0300
commit5ba716835815a99a4f95e8918a9d6236218fb990 (patch)
treec9165595d7413e1814363d638284fe731453e073
parent4b6399a63430aa23a57745d53496028b5e8fa187 (diff)
downloadmariadb-git-MDEV-16490-old.tar.gz
Add a comment; Remove junk if; Do not pass default argument;MDEV-16490-old
-rw-r--r--sql/handler.cc9
-rw-r--r--sql/sql_parse.cc2
2 files changed, 8 insertions, 3 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));
}
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 35b841d8b94..516ea5f9205 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -4257,7 +4257,7 @@ mysql_execute_command(THD *thd)
if (create_info.vers_fix_system_fields(thd, &alter_info, *create_table) ||
create_info.vers_check_system_fields(thd, &alter_info,
create_table->table_name,
- create_table->db, 0))
+ create_table->db))
goto end_with_restore_list;
/*