Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
fe44d46a
Commit
fe44d46a
authored
Oct 17, 2022
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-29721 Inconsistency upon inserting history with visible system versioning columns
parent
b6a60870
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
4 deletions
+53
-4
mysql-test/suite/versioning/r/misc.result
mysql-test/suite/versioning/r/misc.result
+25
-0
mysql-test/suite/versioning/t/misc.test
mysql-test/suite/versioning/t/misc.test
+21
-0
sql/field.cc
sql/field.cc
+6
-0
sql/table.cc
sql/table.cc
+1
-4
No files found.
mysql-test/suite/versioning/r/misc.result
0 → 100644
View file @
fe44d46a
set time_zone='+00:00';
#
# MDEV-29721 Inconsistency upon inserting history with visible system versioning columns
#
create table t1 (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning;
set system_versioning_insert_history=on;
set timestamp=unix_timestamp('2010-10-10 10:10:10');
insert t1 (a,s,e) values (1,'2020-01-01',default), (2,'2020-02-02',ignore),(3,default,'2020-03-03'), (4,ignore,'2020-04-04');
set timestamp=unix_timestamp('2010-11-11 11:11:11');
insert t1 values (5,'2020-01-01',default), (6,'2020-02-02',ignore),(7,default,'2020-03-03'), (8,ignore,'2020-04-04');
set timestamp=default;
select * from t1 for system_time all;
a s e
1 2020-01-01 00:00:00.000000 2038-01-19 03:14:07.999999
2 2020-02-02 00:00:00.000000 2038-01-19 03:14:07.999999
3 2010-10-10 10:10:10.000000 2020-03-03 00:00:00.000000
4 2010-10-10 10:10:10.000000 2020-04-04 00:00:00.000000
5 2020-01-01 00:00:00.000000 2038-01-19 03:14:07.999999
6 2020-02-02 00:00:00.000000 2038-01-19 03:14:07.999999
7 2010-11-11 11:11:11.000000 2020-03-03 00:00:00.000000
8 2010-11-11 11:11:11.000000 2020-04-04 00:00:00.000000
drop table t1;
#
# End of 10.11 tests
#
mysql-test/suite/versioning/t/misc.test
0 → 100644
View file @
fe44d46a
#
# simple tests that don't need to be run in multiple various combinations
#
set
time_zone
=
'+00:00'
;
--
echo
#
--
echo
# MDEV-29721 Inconsistency upon inserting history with visible system versioning columns
--
echo
#
create
table
t1
(
a
int
,
s
timestamp
(
6
)
as
row
start
,
e
timestamp
(
6
)
as
row
end
,
period
for
system_time
(
s
,
e
))
with
system
versioning
;
set
system_versioning_insert_history
=
on
;
set
timestamp
=
unix_timestamp
(
'2010-10-10 10:10:10'
);
insert
t1
(
a
,
s
,
e
)
values
(
1
,
'2020-01-01'
,
default
),
(
2
,
'2020-02-02'
,
ignore
),(
3
,
default
,
'2020-03-03'
),
(
4
,
ignore
,
'2020-04-04'
);
set
timestamp
=
unix_timestamp
(
'2010-11-11 11:11:11'
);
insert
t1
values
(
5
,
'2020-01-01'
,
default
),
(
6
,
'2020-02-02'
,
ignore
),(
7
,
default
,
'2020-03-03'
),
(
8
,
ignore
,
'2020-04-04'
);
set
timestamp
=
default
;
select
*
from
t1
for
system_time
all
;
drop
table
t1
;
--
echo
#
--
echo
# End of 10.11 tests
--
echo
#
sql/field.cc
View file @
fe44d46a
...
...
@@ -11307,7 +11307,13 @@ bool Field::save_in_field_default_value(bool view_error_processing)
This condition will go away as well as other conditions with vers_sys_field().
*/
if
(
vers_sys_field
())
{
if
(
flags
&
VERS_ROW_START
)
set_time
();
else
set_max
();
return
false
;
}
if
(
unlikely
(
flags
&
NO_DEFAULT_VALUE_FLAG
&&
real_type
()
!=
MYSQL_TYPE_ENUM
))
...
...
sql/table.cc
View file @
fe44d46a
...
...
@@ -9159,11 +9159,8 @@ bool TABLE::vers_update_fields()
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
()))
{
if
(
vers_start_field
()
->
set_time
())
DBUG_ASSERT
(
0
);
}
}
if
(
!
versioned
(
VERS_TIMESTAMP
)
||
!
vers_end_field
()
->
has_explicit_value
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment