summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2022-01-13 23:35:17 +0300
committerAleksey Midenkov <midenok@gmail.com>2022-01-13 23:35:17 +0300
commit585cb18ed1a38f9bb27c7542343d9ea197d313eb (patch)
tree611a5ac912ca6ff043c5e3826cd8c1bcf90a5536 /sql/handler.cc
parent241ac79e4994013ed3a9e847f0ac72dc1e3722b2 (diff)
downloadmariadb-git-585cb18ed1a38f9bb27c7542343d9ea197d313eb.tar.gz
MDEV-27452 TIMESTAMP(0) system field is allowed for certain creation of system-versioned table
First, we do not add VERS_UPDATE_UNVERSIONED_FLAG for system field and that fixes SHOW CREATE result. Second, we have to call check_sys_fields() for any CREATE TABLE and there correct type is checked for system fields. Third, we update system_time like as_row structures for ALTER TABLE and that makes check_sys_fields() happy for ALTER TABLE when we make system fields hidden.
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index 871ba3c4149..1e5e4b18366 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -7226,6 +7226,8 @@ 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->vers_sys_field())
+ continue;
if ((f->versioning == Column_definition::VERSIONING_NOT_SET && !add_versioning) ||
f->versioning == Column_definition::WITHOUT_VERSIONING)
{
@@ -7247,9 +7249,10 @@ bool Table_scope_and_contents_source_st::vers_check_system_fields(
if (!(options & HA_VERSIONED_TABLE))
return false;
+ uint versioned_fields= 0;
+
if (!(alter_info->flags & ALTER_DROP_SYSTEM_VERSIONING))
{
- uint versioned_fields= 0;
uint fieldnr= 0;
List_iterator<Create_field> field_it(alter_info->create_list);
while (Create_field *f= field_it++)
@@ -7280,7 +7283,7 @@ bool Table_scope_and_contents_source_st::vers_check_system_fields(
}
}
- if (!(alter_info->flags & ALTER_ADD_SYSTEM_VERSIONING))
+ if (!(alter_info->flags & ALTER_ADD_SYSTEM_VERSIONING) && !versioned_fields)
return false;
bool can_native= ha_check_storage_engine_flag(db_type,