summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2021-11-02 04:52:04 +0300
committerAleksey Midenkov <midenok@gmail.com>2021-11-02 11:49:47 +0300
commitc8cece91440edb77aa43b8ba20930fa91514308e (patch)
treeed9f937459998955cd1a1784392464fa124e6f4c /sql
parent1be39f86ccced289f7a1755467f801a1b5974ede (diff)
downloadmariadb-git-c8cece91440edb77aa43b8ba20930fa91514308e.tar.gz
MDEV-26928 Column-inclusive WITH SYSTEM VERSIONING doesn't work with explicit system fields
versioning_fields flag indicates that any columns were specified WITH SYSTEM VERSIONING. In that case we imply WITH SYSTEM VERSIONING for the whole table and WITHOUT SYSTEM VERSIONING for the other columns.
Diffstat (limited to 'sql')
-rw-r--r--sql/handler.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index bbd0f3bf515..47f78283897 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -7207,15 +7207,16 @@ bool Table_scope_and_contents_source_st::vers_fix_system_fields(
if (!vers_info.need_check(alter_info))
return false;
- if (!vers_info.versioned_fields && vers_info.unversioned_fields &&
- !(alter_info->flags & ALTER_ADD_SYSTEM_VERSIONING))
+ const bool add_versioning= alter_info->flags & ALTER_ADD_SYSTEM_VERSIONING;
+
+ if (!vers_info.versioned_fields && vers_info.unversioned_fields && !add_versioning)
{
// All is correct but this table is not versioned.
options&= ~HA_VERSIONED_TABLE;
return false;
}
- if (!(alter_info->flags & ALTER_ADD_SYSTEM_VERSIONING) && vers_info)
+ if (!add_versioning && vers_info && !vers_info.versioned_fields)
{
my_error(ER_MISSING, MYF(0), create_table.table_name.str,
"WITH SYSTEM VERSIONING");
@@ -7225,8 +7226,7 @@ bool Table_scope_and_contents_source_st::vers_fix_system_fields(
List_iterator<Create_field> it(alter_info->create_list);
while (Create_field *f= it++)
{
- if ((f->versioning == Column_definition::VERSIONING_NOT_SET &&
- !(alter_info->flags & ALTER_ADD_SYSTEM_VERSIONING)) ||
+ if ((f->versioning == Column_definition::VERSIONING_NOT_SET && !add_versioning) ||
f->versioning == Column_definition::WITHOUT_VERSIONING)
{
f->flags|= VERS_UPDATE_UNVERSIONED_FLAG;