mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
SQL: duplicate of historical row fix [#365 bug 7]
Tests affected (forced mode): main.type_timestamp
This commit is contained in:
@ -193,19 +193,12 @@ set @str= concat('
|
|||||||
prepare stmt from @str; execute stmt; drop prepare stmt;
|
prepare stmt from @str; execute stmt; drop prepare stmt;
|
||||||
insert into t1(x, y) values
|
insert into t1(x, y) values
|
||||||
(1, 1000),
|
(1, 1000),
|
||||||
(2, 2000),
|
|
||||||
(3, 3000),
|
(3, 3000),
|
||||||
(4, 4000),
|
(4, 4000),
|
||||||
(5, 5000),
|
(5, 5000);
|
||||||
(6, 6000),
|
|
||||||
(7, 7000),
|
|
||||||
(8, 8000),
|
|
||||||
(9, 9000);
|
|
||||||
insert into t1(x, y) values(3, 3000) on duplicate key update y = y+1;
|
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;
|
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;
|
select x, y from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
end~~
|
end~~
|
||||||
@ -408,62 +401,36 @@ No A B C D
|
|||||||
call test_05('timestamp(6)', 'myisam', 'sys_end');
|
call test_05('timestamp(6)', 'myisam', 'sys_end');
|
||||||
x y
|
x y
|
||||||
1 1000
|
1 1000
|
||||||
2 2000
|
|
||||||
3 3001
|
|
||||||
4 4002
|
|
||||||
5 5000
|
|
||||||
6 6000
|
|
||||||
7 7000
|
|
||||||
8 8000
|
|
||||||
9 9000
|
|
||||||
3 3000
|
3 3000
|
||||||
|
3 3001
|
||||||
4 4000
|
4 4000
|
||||||
4 4001
|
|
||||||
4 4444
|
4 4444
|
||||||
|
5 5000
|
||||||
x y
|
x y
|
||||||
1 1000
|
1 1000
|
||||||
2 2000
|
|
||||||
3 3001
|
3 3001
|
||||||
4 4002
|
4 4000
|
||||||
4 4444
|
4 4444
|
||||||
5 5000
|
5 5000
|
||||||
6 6000
|
|
||||||
7 7000
|
|
||||||
8 8000
|
|
||||||
9 9000
|
|
||||||
call test_05('bigint unsigned', 'innodb', 'vtq_commit_ts(sys_end)');
|
call test_05('bigint unsigned', 'innodb', 'vtq_commit_ts(sys_end)');
|
||||||
x y
|
x y
|
||||||
1 1000
|
1 1000
|
||||||
2 2000
|
|
||||||
3 3000
|
3 3000
|
||||||
3 3001
|
3 3001
|
||||||
4 4000
|
4 4000
|
||||||
4 4001
|
|
||||||
4 4002
|
|
||||||
4 4444
|
4 4444
|
||||||
5 5000
|
5 5000
|
||||||
6 6000
|
|
||||||
7 7000
|
|
||||||
8 8000
|
|
||||||
9 9000
|
|
||||||
x y
|
x y
|
||||||
1 1000
|
1 1000
|
||||||
2 2000
|
|
||||||
3 3001
|
3 3001
|
||||||
4 4002
|
4 4000
|
||||||
4 4444
|
4 4444
|
||||||
5 5000
|
5 5000
|
||||||
6 6000
|
|
||||||
7 7000
|
|
||||||
8 8000
|
|
||||||
9 9000
|
|
||||||
call verify_vtq;
|
call verify_vtq;
|
||||||
No A B C D
|
No A B C D
|
||||||
1 1 1 1 1
|
1 1 1 1 1
|
||||||
2 1 1 1 1
|
2 1 1 1 1
|
||||||
3 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');
|
call test_06('timestamp(6)', 'myisam', 'sys_end');
|
||||||
x y
|
x y
|
||||||
1 1000
|
1 1000
|
||||||
@ -590,17 +557,13 @@ No A B C D
|
|||||||
1 1 1 1 1
|
1 1 1 1 1
|
||||||
2 1 1 1 1
|
2 1 1 1 1
|
||||||
3 1 1 1 1
|
3 1 1 1 1
|
||||||
drop procedure test_01;
|
### Issue #365, bug 7 (duplicate of historical row)
|
||||||
drop procedure test_02;
|
set timestamp= 1000000019;
|
||||||
drop procedure test_03;
|
create or replace table t1 (a int primary key, b int)
|
||||||
drop procedure test_04;
|
with system versioning engine myisam;
|
||||||
drop procedure test_05;
|
insert into t1 (a) values (1);
|
||||||
drop procedure test_06;
|
update t1 set b= 2;
|
||||||
drop procedure test_07;
|
insert into t1 (a) values (1) on duplicate key update a= 2;
|
||||||
drop procedure verify_vtq;
|
ERROR 23000: Duplicate entry '1-2001-09-09 01:46:59.000000' for key 'PRIMARY'
|
||||||
drop procedure innodb_verify_vtq;
|
drop database test;
|
||||||
drop function default_engine;
|
create database test;
|
||||||
drop function sys_commit_ts;
|
|
||||||
drop function sys_datatype;
|
|
||||||
drop procedure concat_exec2;
|
|
||||||
drop procedure concat_exec3;
|
|
||||||
|
@ -134,19 +134,12 @@ begin
|
|||||||
prepare stmt from @str; execute stmt; drop prepare stmt;
|
prepare stmt from @str; execute stmt; drop prepare stmt;
|
||||||
insert into t1(x, y) values
|
insert into t1(x, y) values
|
||||||
(1, 1000),
|
(1, 1000),
|
||||||
(2, 2000),
|
|
||||||
(3, 3000),
|
(3, 3000),
|
||||||
(4, 4000),
|
(4, 4000),
|
||||||
(5, 5000),
|
(5, 5000);
|
||||||
(6, 6000),
|
|
||||||
(7, 7000),
|
|
||||||
(8, 8000),
|
|
||||||
(9, 9000);
|
|
||||||
insert into t1(x, y) values(3, 3000) on duplicate key update y = y+1;
|
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;
|
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;
|
select x, y from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
end~~
|
end~~
|
||||||
@ -262,12 +255,14 @@ call test_07('bigint unsigned', 'innodb', 'vtq_commit_ts(sys_end)');
|
|||||||
|
|
||||||
call verify_vtq;
|
call verify_vtq;
|
||||||
|
|
||||||
drop procedure test_01;
|
--echo ### Issue #365, bug 7 (duplicate of historical row)
|
||||||
drop procedure test_02;
|
set timestamp= 1000000019;
|
||||||
drop procedure test_03;
|
create or replace table t1 (a int primary key, b int)
|
||||||
drop procedure test_04;
|
with system versioning engine myisam;
|
||||||
drop procedure test_05;
|
insert into t1 (a) values (1);
|
||||||
drop procedure test_06;
|
update t1 set b= 2;
|
||||||
drop procedure test_07;
|
--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;
|
||||||
|
@ -1870,8 +1870,11 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
|
|||||||
store_record(table, record[2]);
|
store_record(table, record[2]);
|
||||||
if ((error= vers_insert_history_row(table)))
|
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]);
|
restore_record(table, record[2]);
|
||||||
goto err;
|
goto ok_or_after_trg_err;
|
||||||
}
|
}
|
||||||
restore_record(table, record[2]);
|
restore_record(table, record[2]);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user