summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/versioning/r/insert.result36
-rw-r--r--mysql-test/suite/versioning/r/partition.result2
-rw-r--r--mysql-test/suite/versioning/r/view.result8
-rw-r--r--mysql-test/suite/versioning/t/partition.test2
-rw-r--r--mysql-test/suite/versioning/t/select.test2
-rw-r--r--mysql-test/suite/versioning/t/select_sp.test2
-rw-r--r--sql/field.cc7
-rw-r--r--sql/item_vers.cc1
-rw-r--r--sql/sql_select.cc7
-rw-r--r--sql/sql_table.cc4
10 files changed, 39 insertions, 32 deletions
diff --git a/mysql-test/suite/versioning/r/insert.result b/mysql-test/suite/versioning/r/insert.result
index e6cf8954f26..f92bcdcbe19 100644
--- a/mysql-test/suite/versioning/r/insert.result
+++ b/mysql-test/suite/versioning/r/insert.result
@@ -194,29 +194,29 @@ drop table t2;
end~~
call test_01('timestamp(6)', 'myisam', 'sys_end');
x y sys_end
-3 4 2038-01-19 03:14:07.000000
-2 3 2038-01-19 03:14:07.000000
-40 33 2038-01-19 03:14:07.000000
+3 4 2038-01-19 03:14:07.999999
+2 3 2038-01-19 03:14:07.999999
+40 33 2038-01-19 03:14:07.999999
call test_01('bigint unsigned', 'innodb', 'vtq_commit_ts(sys_end)');
x y vtq_commit_ts(sys_end)
-3 4 2038-01-19 03:14:07.000000
-2 3 2038-01-19 03:14:07.000000
-40 33 2038-01-19 03:14:07.000000
+3 4 2038-01-19 03:14:07.999999
+2 3 2038-01-19 03:14:07.999999
+40 33 2038-01-19 03:14:07.999999
call test_02('timestamp(6)', 'myisam', 'sys_end');
id x y sys_end
-1 33 44 2038-01-19 03:14:07.000000
-20 33 44 2038-01-19 03:14:07.000000
-40 33 44 2038-01-19 03:14:07.000000
+1 33 44 2038-01-19 03:14:07.999999
+20 33 44 2038-01-19 03:14:07.999999
+40 33 44 2038-01-19 03:14:07.999999
call test_02('bigint unsigned', 'innodb', 'vtq_commit_ts(sys_end)');
id x y vtq_commit_ts(sys_end)
-1 33 44 2038-01-19 03:14:07.000000
-20 33 44 2038-01-19 03:14:07.000000
-40 33 44 2038-01-19 03:14:07.000000
+1 33 44 2038-01-19 03:14:07.999999
+20 33 44 2038-01-19 03:14:07.999999
+40 33 44 2038-01-19 03:14:07.999999
call test_03('timestamp(6)', 'myisam', 'sys_end');
x y sys_end
-8001 9001 2038-01-19 03:14:07.000000
-1001 2001 2038-01-19 03:14:07.000000
-1002 2002 2038-01-19 03:14:07.000000
+8001 9001 2038-01-19 03:14:07.999999
+1001 2001 2038-01-19 03:14:07.999999
+1002 2002 2038-01-19 03:14:07.999999
x y
8001 9001
1001 2001
@@ -225,9 +225,9 @@ drop table t1;
drop view vt1_1;
call test_03('bigint unsigned', 'innodb', 'vtq_commit_ts(sys_end)');
x y vtq_commit_ts(sys_end)
-8001 9001 2038-01-19 03:14:07.000000
-1001 2001 2038-01-19 03:14:07.000000
-1002 2002 2038-01-19 03:14:07.000000
+8001 9001 2038-01-19 03:14:07.999999
+1001 2001 2038-01-19 03:14:07.999999
+1002 2002 2038-01-19 03:14:07.999999
x y
8001 9001
1001 2001
diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result
index 89f96b7b4e4..a7c02a3f9d0 100644
--- a/mysql-test/suite/versioning/r/partition.result
+++ b/mysql-test/suite/versioning/r/partition.result
@@ -168,7 +168,7 @@ set @ts_start= sys_commit_ts('sys_trx_start');
set @ts_end= sys_commit_ts('sys_trx_end');
set @str= concat('select x, ', @ts_start, ' < @now as A, ', @ts_end, ' > @now as B from t1 partition (p0) for system_time all');
prepare select_p0 from @str;
-set @str= concat('select x, ', @ts_start, ' > @now as C, ', @ts_end, ' = timestamp\'2038-01-19 03:14:07\' as D from t1 partition (pn) for system_time all');
+set @str= concat('select x, ', @ts_start, ' > @now as C, ', @ts_end, ' = timestamp\'2038-01-19 03:14:07.999999\' as D from t1 partition (pn) for system_time all');
prepare select_pn from @str;
execute select_p0;
x A B
diff --git a/mysql-test/suite/versioning/r/view.result b/mysql-test/suite/versioning/r/view.result
index 96ff29bd73b..22b75f5439a 100644
--- a/mysql-test/suite/versioning/r/view.result
+++ b/mysql-test/suite/versioning/r/view.result
@@ -85,7 +85,7 @@ x
create or replace view vt1 as select * from t1;
show create view vt1;
View Create View character_set_client collation_connection
-vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`x` AS `x`,`t1`.`sys_trx_start` AS `sys_trx_start`,`t1`.`sys_trx_end` AS `sys_trx_end` from `t1` FOR SYSTEM_TIME ALL where `t1`.`sys_trx_end` = TIMESTAMP'2038-01-19 03:14:07' latin1 latin1_swedish_ci
+vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`x` AS `x`,`t1`.`sys_trx_start` AS `sys_trx_start`,`t1`.`sys_trx_end` AS `sys_trx_end` from `t1` FOR SYSTEM_TIME ALL where `t1`.`sys_trx_end` = TIMESTAMP'2038-01-19 03:14:07.999999' latin1 latin1_swedish_ci
drop view vt1;
drop view vt2;
create view vt1 as select * from t1 for system_time all;
@@ -178,15 +178,15 @@ create or replace table t3 (x int);
create or replace view vt1 as select * from t1, t2, t3;
show create view vt1;
View Create View character_set_client collation_connection
-vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`a` AS `a`,`t2`.`b` AS `b`,`t3`.`x` AS `x`,`t1`.`sys_trx_start` AS `sys_trx_start`,`t1`.`sys_trx_end` AS `sys_trx_end` from ((`t1` FOR SYSTEM_TIME ALL join `t2` FOR SYSTEM_TIME ALL) join `t3`) where `t1`.`sys_trx_end` = TIMESTAMP'2038-01-19 03:14:07' and `t2`.`sys_trx_end` = TIMESTAMP'2038-01-19 03:14:07' latin1 latin1_swedish_ci
+vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`a` AS `a`,`t2`.`b` AS `b`,`t3`.`x` AS `x`,`t1`.`sys_trx_start` AS `sys_trx_start`,`t1`.`sys_trx_end` AS `sys_trx_end` from ((`t1` FOR SYSTEM_TIME ALL join `t2` FOR SYSTEM_TIME ALL) join `t3`) where `t1`.`sys_trx_end` = TIMESTAMP'2038-01-19 03:14:07.999999' and `t2`.`sys_trx_end` = TIMESTAMP'2038-01-19 03:14:07.999999' latin1 latin1_swedish_ci
create or replace view vt1 as select * from t3, t2, t1;
show create view vt1;
View Create View character_set_client collation_connection
-vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t3`.`x` AS `x`,`t2`.`b` AS `b`,`t1`.`a` AS `a`,`t2`.`sys_trx_start` AS `sys_trx_start`,`t2`.`sys_trx_end` AS `sys_trx_end` from ((`t3` join `t2` FOR SYSTEM_TIME ALL) join `t1` FOR SYSTEM_TIME ALL) where `t2`.`sys_trx_end` = TIMESTAMP'2038-01-19 03:14:07' and `t1`.`sys_trx_end` = TIMESTAMP'2038-01-19 03:14:07' latin1 latin1_swedish_ci
+vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t3`.`x` AS `x`,`t2`.`b` AS `b`,`t1`.`a` AS `a`,`t2`.`sys_trx_start` AS `sys_trx_start`,`t2`.`sys_trx_end` AS `sys_trx_end` from ((`t3` join `t2` FOR SYSTEM_TIME ALL) join `t1` FOR SYSTEM_TIME ALL) where `t2`.`sys_trx_end` = TIMESTAMP'2038-01-19 03:14:07.999999' and `t1`.`sys_trx_end` = TIMESTAMP'2038-01-19 03:14:07.999999' latin1 latin1_swedish_ci
create or replace view vt1 as select a, t2.sys_trx_end as endo from t3, t1, t2;
show create view vt1;
View Create View character_set_client collation_connection
-vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`a` AS `a`,`t2`.`sys_trx_end` AS `endo`,`t2`.`sys_trx_start` AS `sys_trx_start` from ((`t3` join `t1` FOR SYSTEM_TIME ALL) join `t2` FOR SYSTEM_TIME ALL) where `t1`.`sys_trx_end` = TIMESTAMP'2038-01-19 03:14:07' and `t2`.`sys_trx_end` = TIMESTAMP'2038-01-19 03:14:07' latin1 latin1_swedish_ci
+vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`a` AS `a`,`t2`.`sys_trx_end` AS `endo`,`t2`.`sys_trx_start` AS `sys_trx_start` from ((`t3` join `t1` FOR SYSTEM_TIME ALL) join `t2` FOR SYSTEM_TIME ALL) where `t1`.`sys_trx_end` = TIMESTAMP'2038-01-19 03:14:07.999999' and `t2`.`sys_trx_end` = TIMESTAMP'2038-01-19 03:14:07.999999' latin1 latin1_swedish_ci
create or replace view vvt1 as select * from t1, t2, vt1;
ERROR HY000: Creating VIEW `vvt1` is prohibited: versioned VIEW `vt1` in query!
drop view vt1, vt12;
diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test
index d5a9643de9a..5c97b468a1a 100644
--- a/mysql-test/suite/versioning/t/partition.test
+++ b/mysql-test/suite/versioning/t/partition.test
@@ -102,7 +102,7 @@ set @ts_start= sys_commit_ts('sys_trx_start');
set @ts_end= sys_commit_ts('sys_trx_end');
set @str= concat('select x, ', @ts_start, ' < @now as A, ', @ts_end, ' > @now as B from t1 partition (p0) for system_time all');
prepare select_p0 from @str;
-set @str= concat('select x, ', @ts_start, ' > @now as C, ', @ts_end, ' = timestamp\'2038-01-19 03:14:07\' as D from t1 partition (pn) for system_time all');
+set @str= concat('select x, ', @ts_start, ' > @now as C, ', @ts_end, ' = timestamp\'2038-01-19 03:14:07.999999\' as D from t1 partition (pn) for system_time all');
prepare select_pn from @str;
execute select_p0;
diff --git a/mysql-test/suite/versioning/t/select.test b/mysql-test/suite/versioning/t/select.test
index 345e28f610c..6ec45db6c08 100644
--- a/mysql-test/suite/versioning/t/select.test
+++ b/mysql-test/suite/versioning/t/select.test
@@ -137,7 +137,7 @@ insert into t1 values (1);
create trigger read_end after update on t1
for each row set @end = old.sys_trx_end;
update t1 set a=2;
---replace_result 18446744073709551615 MAX_RESULT "2038-01-19 03:14:07.000000" MAX_RESULT
+--replace_result 18446744073709551615 MAX_RESULT "2038-01-19 03:14:07.999999" MAX_RESULT
select @end;
create or replace table t1 (a int) with system versioning;
diff --git a/mysql-test/suite/versioning/t/select_sp.test b/mysql-test/suite/versioning/t/select_sp.test
index d261e1bc537..bd165c3bd16 100644
--- a/mysql-test/suite/versioning/t/select_sp.test
+++ b/mysql-test/suite/versioning/t/select_sp.test
@@ -150,7 +150,7 @@ insert into t1 values (1);
create trigger read_end after update on t1
for each row set @end = old.sys_trx_end;
update t1 set a=2;
---replace_result 18446744073709551615 MAX_RESULT "2038-01-19 03:14:07.000000" MAX_RESULT
+--replace_result 18446744073709551615 MAX_RESULT "2038-01-19 03:14:07.999999" MAX_RESULT
select @end;
create or replace table t1 (a int) with system versioning;
diff --git a/sql/field.cc b/sql/field.cc
index cd83e61ba43..9afe74f0808 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -2012,6 +2012,7 @@ bool Field_vers_system::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate, ulonglo
if (trx_id == ULONGLONG_MAX)
{
get_thd()->variables.time_zone->gmt_sec_to_TIME(ltime, TIMESTAMP_MAX_VALUE);
+ ltime->second_part= TIME_MAX_SECOND_PART;
return false;
}
if (cached == trx_id)
@@ -5481,10 +5482,11 @@ void Field_timestampf::set_max()
{
DBUG_ENTER("Field_timestampf::set_max");
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
+ DBUG_ASSERT(dec == TIME_SECOND_PART_DIGITS);
set_notnull();
mi_int4store(ptr, TIMESTAMP_MAX_VALUE);
- memset(ptr + 4, 0x0, value_length() - 4);
+ mi_int3store(ptr + 4, TIME_MAX_SECOND_PART);
DBUG_VOID_RETURN;
}
@@ -5494,7 +5496,8 @@ bool Field_timestampf::is_max()
DBUG_ENTER("Field_timestampf::is_max");
ASSERT_COLUMN_MARKED_FOR_READ;
- DBUG_RETURN(mi_sint4korr(ptr) == 0x7fffffff);
+ DBUG_RETURN(mi_sint4korr(ptr) == TIMESTAMP_MAX_VALUE &&
+ mi_sint3korr(ptr + 4) == TIME_MAX_SECOND_PART);
}
my_time_t Field_timestampf::get_timestamp(const uchar *pos,
diff --git a/sql/item_vers.cc b/sql/item_vers.cc
index 47e62d9ebf0..cbeb72810f3 100644
--- a/sql/item_vers.cc
+++ b/sql/item_vers.cc
@@ -67,6 +67,7 @@ Item_func_vtq_ts::get_date(MYSQL_TIME *res, ulonglong fuzzy_date)
{
null_value= false;
thd->variables.time_zone->gmt_sec_to_TIME(res, TIMESTAMP_MAX_VALUE);
+ res->second_part= TIME_MAX_SECOND_PART;
return false;
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 437c04c2984..68fb90ae9ec 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -676,7 +676,8 @@ bool vers_select_conds_t::init_from_sysvar(THD *thd)
if (type != FOR_SYSTEM_TIME_UNSPECIFIED && type != FOR_SYSTEM_TIME_ALL)
{
DBUG_ASSERT(type == FOR_SYSTEM_TIME_AS_OF);
- start= new (thd->mem_root) Item_datetime_literal(thd, &in.ltime, 6);
+ start= new (thd->mem_root)
+ Item_datetime_literal(thd, &in.ltime, TIME_SECOND_PART_DIGITS);
if (!start)
return true;
}
@@ -921,7 +922,9 @@ int vers_setup_select(THD *thd, TABLE_LIST *tables, COND **where_expr,
{
MYSQL_TIME max_time;
thd->variables.time_zone->gmt_sec_to_TIME(&max_time, TIMESTAMP_MAX_VALUE);
- curr= newx Item_datetime_literal(thd, &max_time);
+ max_time.second_part= TIME_MAX_SECOND_PART;
+ curr= newx Item_datetime_literal(thd, &max_time,
+ TIME_SECOND_PART_DIGITS);
cond1= newx Item_func_eq(thd, row_end, curr);
}
else
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index cb4bb052a65..abf337c9fa6 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -10017,8 +10017,8 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
// TODO: write directly to record bypassing the same checks on every call
to_sys_trx_start->store_time(&query_start);
- static const timeval max_tv= {0x7fffffff, 0};
- static const uint dec= 6;
+ static const timeval max_tv= {TIMESTAMP_MAX_VALUE, TIME_MAX_SECOND_PART};
+ static const uint dec= TIME_SECOND_PART_DIGITS;
to_sys_trx_end->set_notnull(to_sys_trx_end->null_offset());
my_timestamp_to_binary(&max_tv, to_sys_trx_end->ptr, dec);
}