diff options
author | Sergei Golubchik <serg@mariadb.org> | 2022-10-10 10:30:51 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2022-10-26 15:30:38 +0200 |
commit | d94ed0bb2a3305d8c1588360c0ac6a384e580981 (patch) | |
tree | 8e02cee392ba9bcc139017221cdf3585fae5a3ce /sql/table.cc | |
parent | 8d2ec37a40117996897c97904ac91b674a448cb8 (diff) | |
download | mariadb-git-d94ed0bb2a3305d8c1588360c0ac6a384e580981.tar.gz |
MDEV-29721 Inconsistency upon inserting history with visible period columns
don't set vers_write=false if one vers column was used explicitly,
instead do vers_update_fields() for columns that do not have explicit
value. So, if row_start has the value and row_end not, row_end will
get max by default.
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sql/table.cc b/sql/table.cc index 202ff6b708f..828bccf0927 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -9153,9 +9153,11 @@ bool TABLE::check_period_overlaps(const KEY &key, return true; } -void TABLE::vers_update_fields() +/* returns true if vers_end_field was updated */ +bool TABLE::vers_update_fields() { - if (versioned(VERS_TIMESTAMP)) + bool res= false; + if (versioned(VERS_TIMESTAMP) && !vers_start_field()->has_explicit_value()) { if (vers_start_field()->store_timestamp(in_use->query_start(), in_use->query_start_sec_part())) @@ -9165,11 +9167,16 @@ void TABLE::vers_update_fields() vers_start_field()->set_has_explicit_value(); } - vers_end_field()->set_max(); - vers_end_field()->set_has_explicit_value(); + if (!versioned(VERS_TIMESTAMP) || !vers_end_field()->has_explicit_value()) + { + vers_end_field()->set_max(); + vers_end_field()->set_has_explicit_value(); + res= true; + } if (vfield) update_virtual_fields(file, VCOL_UPDATE_FOR_READ); + return res; } |