summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/versioning/r/truncate.result24
-rw-r--r--mysql-test/suite/versioning/t/truncate.test29
-rw-r--r--sql/item_vers.cc2
-rw-r--r--sql/sql_delete.cc7
4 files changed, 46 insertions, 16 deletions
diff --git a/mysql-test/suite/versioning/r/truncate.result b/mysql-test/suite/versioning/r/truncate.result
index 181b120eafb..308501915dc 100644
--- a/mysql-test/suite/versioning/r/truncate.result
+++ b/mysql-test/suite/versioning/r/truncate.result
@@ -1,7 +1,12 @@
create table t (a int);
delete history from t before system_time now();
ERROR HY000: Table `t` is not system-versioned
-create or replace table t (a int) with system versioning;
+create or replace table t (
+a int,
+row_start SYS_TYPE as row start invisible,
+row_end SYS_TYPE as row end invisible,
+period for system_time (row_start, row_end))
+with system versioning;
insert into t values (1);
update t set a=2;
set @test = 'correct';
@@ -12,7 +17,12 @@ select @test from t;
@test
correct
drop table t;
-create table t (a int) with system versioning;
+create or replace table t (
+a int,
+row_start SYS_TYPE as row start invisible,
+row_end SYS_TYPE as row end invisible,
+period for system_time (row_start, row_end))
+with system versioning;
insert into t values (1), (2);
update t set a=11 where a=1;
set @ts1=now(6);
@@ -48,7 +58,6 @@ drop procedure truncate_sp;
# Truncate partitioned
create or replace table t (a int)
with system versioning
-engine myisam
partition by system_time limit 1 (
partition p0 history,
partition p1 history,
@@ -61,7 +70,12 @@ select * from t for system_time all;
a
3
# VIEW
-create or replace table t (i int) with system versioning;
+create or replace table t (
+i int,
+row_start SYS_TYPE as row start invisible,
+row_end SYS_TYPE as row end invisible,
+period for system_time (row_start, row_end))
+with system versioning;
delete history from t;
create or replace view v as select * from t;
delete history from v;
@@ -86,3 +100,5 @@ ERROR 42S02: 'v' is a view
unlock tables;
drop view v;
drop table t;
+drop database test;
+create database test;
diff --git a/mysql-test/suite/versioning/t/truncate.test b/mysql-test/suite/versioning/t/truncate.test
index f52d52d81ea..4e039a76567 100644
--- a/mysql-test/suite/versioning/t/truncate.test
+++ b/mysql-test/suite/versioning/t/truncate.test
@@ -1,3 +1,4 @@
+--source suite/versioning/common.inc
--source include/have_partition.inc
--source suite/versioning/engines.inc
@@ -6,7 +7,13 @@ create table t (a int);
delete history from t before system_time now();
# TRUNCATE is not DELETE and trigger must not be called.
-create or replace table t (a int) with system versioning;
+--replace_result $sys_datatype_expl SYS_TYPE
+eval create or replace table t (
+ a int,
+ row_start $sys_datatype_expl as row start invisible,
+ row_end $sys_datatype_expl as row end invisible,
+ period for system_time (row_start, row_end))
+with system versioning;
insert into t values (1);
update t set a=2;
set @test = 'correct';
@@ -16,7 +23,13 @@ delete history from t;
select @test from t;
drop table t;
-create table t (a int) with system versioning;
+--replace_result $sys_datatype_expl SYS_TYPE
+eval create or replace table t (
+ a int,
+ row_start $sys_datatype_expl as row start invisible,
+ row_end $sys_datatype_expl as row end invisible,
+ period for system_time (row_start, row_end))
+with system versioning;
insert into t values (1), (2);
update t set a=11 where a=1;
--real_sleep 0.01
@@ -45,7 +58,6 @@ drop procedure truncate_sp;
--echo # Truncate partitioned
create or replace table t (a int)
with system versioning
-engine myisam
partition by system_time limit 1 (
partition p0 history,
partition p1 history,
@@ -57,7 +69,13 @@ delete history from t;
select * from t for system_time all;
--echo # VIEW
-create or replace table t (i int) with system versioning;
+--replace_result $sys_datatype_expl SYS_TYPE
+eval create or replace table t (
+ i int,
+ row_start $sys_datatype_expl as row start invisible,
+ row_end $sys_datatype_expl as row end invisible,
+ period for system_time (row_start, row_end))
+with system versioning;
delete history from t;
create or replace view v as select * from t;
--error ER_IT_IS_A_VIEW
@@ -88,3 +106,6 @@ delete history from v before system_time now(6);
unlock tables;
drop view v;
drop table t;
+
+drop database test;
+create database test;
diff --git a/sql/item_vers.cc b/sql/item_vers.cc
index 8a83ffddcf4..d7361f687f9 100644
--- a/sql/item_vers.cc
+++ b/sql/item_vers.cc
@@ -123,7 +123,7 @@ Item_func_trt_id::get_by_commit_ts(MYSQL_TIME &commit_ts, bool backwards)
TR_table trt(thd);
null_value= !trt.query(commit_ts, backwards);
if (null_value)
- return 0;
+ return backwards ? ULONGLONG_MAX : 0;
return trt[trt_field]->val_int();
}
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index d4a2f779544..a963ae5b3e1 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -324,13 +324,6 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
DBUG_ASSERT(!conds);
conds= table_list->on_expr;
table_list->on_expr= NULL;
-
- // trx_sees() in InnoDB reads row_start
- if (!table->versioned(VERS_TIMESTAMP))
- {
- DBUG_ASSERT(table_list->vers_conditions.type == SYSTEM_TIME_BEFORE);
- bitmap_set_bit(table->read_set, table->vers_end_field()->field_index);
- }
}
if (mysql_handle_list_of_derived(thd->lex, table_list, DT_MERGE_FOR_INSERT))