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
70b82f64
Commit
70b82f64
authored
Dec 02, 2017
by
Aleksey Midenkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SQL: duplicate of historical row fix [#365 bug 7]
Tests affected (forced mode): main.type_timestamp
parent
a3802ecb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
71 deletions
+32
-71
mysql-test/suite/versioning/r/update.result
mysql-test/suite/versioning/r/update.result
+16
-53
mysql-test/suite/versioning/t/update.test
mysql-test/suite/versioning/t/update.test
+12
-17
sql/sql_insert.cc
sql/sql_insert.cc
+4
-1
No files found.
mysql-test/suite/versioning/r/update.result
View file @
70b82f64
...
...
@@ -193,19 +193,12 @@ set @str= concat('
prepare stmt from @str; execute stmt; drop prepare stmt;
insert into t1(x, y) values
(1, 1000),
(2, 2000),
(3, 3000),
(4, 4000),
(5, 5000),
(6, 6000),
(7, 7000),
(8, 8000),
(9, 9000);
(5, 5000);
insert into t1(x, y) values(3, 3000) on duplicate key update y = y+1;
insert into t1(x, y) values(4, 4000) on duplicate key update y = y+1;
insert into t1(x, y) values(4, 4001) on duplicate key update y = y+1;
insert into t1(x, y) values(4, 4444) on duplicate key update y = y+1;
select x, y from t1 for system_time
between timestamp '0-0-0 0:0:0' and timestamp '9999-1-1 0:0:0'
;
select x, y from t1 for system_time
all
;
select x, y from t1;
drop table t1;
end~~
...
...
@@ -408,62 +401,36 @@ No A B C D
call test_05('timestamp(6)', 'myisam', 'sys_end');
x y
1 1000
2 2000
3 3001
4 4002
5 5000
6 6000
7 7000
8 8000
9 9000
3 3000
3 3001
4 4000
4 4001
4 4444
5 5000
x y
1 1000
2 2000
3 3001
4 400
2
4 400
0
4 4444
5 5000
6 6000
7 7000
8 8000
9 9000
call test_05('bigint unsigned', 'innodb', 'vtq_commit_ts(sys_end)');
x y
1 1000
2 2000
3 3000
3 3001
4 4000
4 4001
4 4002
4 4444
5 5000
6 6000
7 7000
8 8000
9 9000
x y
1 1000
2 2000
3 3001
4 400
2
4 400
0
4 4444
5 5000
6 6000
7 7000
8 8000
9 9000
call verify_vtq;
No A B C D
1 1 1 1 1
2 1 1 1 1
3 1 1 1 1
4 1 1 1 1
5 1 1 1 1
call test_06('timestamp(6)', 'myisam', 'sys_end');
x y
1 1000
...
...
@@ -590,17 +557,13 @@ No A B C D
1 1 1 1 1
2 1 1 1 1
3 1 1 1 1
drop procedure test_01;
drop procedure test_02;
drop procedure test_03;
drop procedure test_04;
drop procedure test_05;
drop procedure test_06;
drop procedure test_07;
drop procedure verify_vtq;
drop procedure innodb_verify_vtq;
drop function default_engine;
drop function sys_commit_ts;
drop function sys_datatype;
drop procedure concat_exec2;
drop procedure concat_exec3;
### Issue #365, bug 7 (duplicate of historical row)
set timestamp= 1000000019;
create or replace table t1 (a int primary key, b int)
with system versioning engine myisam;
insert into t1 (a) values (1);
update t1 set b= 2;
insert into t1 (a) values (1) on duplicate key update a= 2;
ERROR 23000: Duplicate entry '1-2001-09-09 01:46:59.000000' for key 'PRIMARY'
drop database test;
create database test;
mysql-test/suite/versioning/t/update.test
View file @
70b82f64
...
...
@@ -134,19 +134,12 @@ begin
prepare
stmt
from
@
str
;
execute
stmt
;
drop
prepare
stmt
;
insert
into
t1
(
x
,
y
)
values
(
1
,
1000
),
(
2
,
2000
),
(
3
,
3000
),
(
4
,
4000
),
(
5
,
5000
),
(
6
,
6000
),
(
7
,
7000
),
(
8
,
8000
),
(
9
,
9000
);
(
5
,
5000
);
insert
into
t1
(
x
,
y
)
values
(
3
,
3000
)
on
duplicate
key
update
y
=
y
+
1
;
insert
into
t1
(
x
,
y
)
values
(
4
,
4000
)
on
duplicate
key
update
y
=
y
+
1
;
insert
into
t1
(
x
,
y
)
values
(
4
,
4001
)
on
duplicate
key
update
y
=
y
+
1
;
insert
into
t1
(
x
,
y
)
values
(
4
,
4444
)
on
duplicate
key
update
y
=
y
+
1
;
select
x
,
y
from
t1
for
system_time
between
timestamp
'0-0-0 0:0:0'
and
timestamp
'9999-1-1 0:0:0'
;
select
x
,
y
from
t1
for
system_time
all
;
select
x
,
y
from
t1
;
drop
table
t1
;
end
~~
...
...
@@ -262,12 +255,14 @@ call test_07('bigint unsigned', 'innodb', 'vtq_commit_ts(sys_end)');
call
verify_vtq
;
drop
procedure
test_01
;
drop
procedure
test_02
;
drop
procedure
test_03
;
drop
procedure
test_04
;
drop
procedure
test_05
;
drop
procedure
test_06
;
drop
procedure
test_07
;
--
echo
### Issue #365, bug 7 (duplicate of historical row)
set
timestamp
=
1000000019
;
create
or
replace
table
t1
(
a
int
primary
key
,
b
int
)
with
system
versioning
engine
myisam
;
insert
into
t1
(
a
)
values
(
1
);
update
t1
set
b
=
2
;
--
error
ER_DUP_ENTRY
insert
into
t1
(
a
)
values
(
1
)
on
duplicate
key
update
a
=
2
;
--
source
suite
/
versioning
/
common_finish
.
inc
drop
database
test
;
create
database
test
;
sql/sql_insert.cc
View file @
70b82f64
...
...
@@ -1870,8 +1870,11 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
store_record
(
table
,
record
[
2
]);
if
((
error
=
vers_insert_history_row
(
table
)))
{
info
->
last_errno
=
error
;
table
->
file
->
print_error
(
error
,
MYF
(
0
));
trg_error
=
1
;
restore_record
(
table
,
record
[
2
]);
goto
err
;
goto
ok_or_after_trg_
err
;
}
restore_record
(
table
,
record
[
2
]);
}
...
...
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