diff --git a/mysql-test/suite/versioning/r/update.result b/mysql-test/suite/versioning/r/update.result index 85849bf2b44..a22e2383ae6 100644 --- a/mysql-test/suite/versioning/r/update.result +++ b/mysql-test/suite/versioning/r/update.result @@ -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 4002 +4 4000 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 4002 +4 4000 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; diff --git a/mysql-test/suite/versioning/t/update.test b/mysql-test/suite/versioning/t/update.test index 1d137127536..f99d1c6f07b 100644 --- a/mysql-test/suite/versioning/t/update.test +++ b/mysql-test/suite/versioning/t/update.test @@ -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; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 032ed66c9ac..40ba695499f 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -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]); }