1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-16546 System versioning setting to allow history modification

1. system_versioning_insert_history session variable allows
pseudocolumns ROW_START and ROW_END be specified in INSERT,
INSERT..SELECT and LOAD DATA.

2. Cleaned up select_insert::send_data() from setting vers_write as
this parameter is now set on TABLE initialization.

4. Replication of system_versioning_insert_history via option_bits in
OPTIONS_WRITTEN_TO_BIN_LOG.
This commit is contained in:
Aleksey Midenkov
2022-08-28 22:44:56 +03:00
committed by Sergei Golubchik
parent d9b0c9ad2b
commit a2cda88631
23 changed files with 581 additions and 23 deletions

View File

@@ -6311,7 +6311,8 @@ find_field_in_table(THD *thd, TABLE *table, const char *name, size_t length,
if (field->invisible == INVISIBLE_SYSTEM &&
thd->column_usage != MARK_COLUMNS_READ &&
thd->column_usage != COLUMNS_READ)
thd->column_usage != COLUMNS_READ &&
!thd->vers_insert_history(field))
DBUG_RETURN((Field*)0);
}
else
@@ -8895,7 +8896,8 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
if (table->next_number_field &&
rfield->field_index == table->next_number_field->field_index)
table->auto_increment_field_not_null= TRUE;
const bool skip_sys_field= rfield->vers_sys_field(); // TODO: && !thd->vers_modify_history() [MDEV-16546]
const bool skip_sys_field= rfield->vers_sys_field() &&
(update || !thd->vers_insert_history(rfield));
if ((rfield->vcol_info || skip_sys_field) &&
!value->vcol_assignment_allowed_value() &&
table->s->table_category != TABLE_CATEGORY_TEMPORARY)
@@ -9180,7 +9182,10 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List<Item> &values,
if (field->field_index == autoinc_index)
table->auto_increment_field_not_null= TRUE;
if ((unlikely(field->vcol_info) || (vers_sys_field && !ignore_errors)) &&
if ((unlikely(field->vcol_info) ||
(vers_sys_field &&
!ignore_errors &&
!thd->vers_insert_history(field))) &&
!value->vcol_assignment_allowed_value() &&
table->s->table_category != TABLE_CATEGORY_TEMPORARY)
{