mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 20:07:13 +02:00
revert a suggested "optimization" that introduced a bug
compilation error in mysys/my_getsystime.c fixed some redundant code removed sec_to_time, time_to_sec, from_unixtime, unix_timestamp, @@timestamp now use decimal, not double for numbers with a fractional part. purge_master_logs_before_date() fixed many bugs in corner cases fixed mysys/my_getsystime.c: compilation failure fixed sql/sql_parse.cc: don't cut corners. it backfires.
This commit is contained in:
parent
c1a92f9cae
commit
4d128777dd
67 changed files with 1556 additions and 1110 deletions
|
|
@ -14,10 +14,10 @@ current_time(3) 01:01:01.123
|
|||
current_timestamp(4) 2011-01-01 01:01:01.1234
|
||||
localtime(5) 2011-01-01 01:01:01.12345
|
||||
localtimestamp(6) 2011-01-01 01:01:01.123456
|
||||
time_to_sec('12:34:56') 45296
|
||||
time_to_sec('12:34:56.789') 45296.789
|
||||
time_to_sec('12:34:56') 45296.000000
|
||||
time_to_sec('12:34:56.789') 45296.789000
|
||||
select sec_to_time(time_to_sec('1:2:3')), sec_to_time(time_to_sec('2:3:4.567890'));
|
||||
sec_to_time(time_to_sec('1:2:3')) 01:02:03
|
||||
sec_to_time(time_to_sec('1:2:3')) 01:02:03.000000
|
||||
sec_to_time(time_to_sec('2:3:4.567890')) 02:03:04.567890
|
||||
select time_to_sec(sec_to_time(11111)), time_to_sec(sec_to_time(11111.22222));
|
||||
time_to_sec(sec_to_time(11111)) 11111
|
||||
|
|
@ -47,7 +47,7 @@ t1 CREATE TABLE `t1` (
|
|||
`localtime(5)` datetime(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000',
|
||||
`localtimestamp(6)` datetime(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
|
||||
`time_to_sec(123456)` bigint(17) DEFAULT NULL,
|
||||
`time_to_sec('12:34:56.789')` double DEFAULT NULL
|
||||
`time_to_sec('12:34:56.789')` decimal(22,6) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
select * from t1;
|
||||
sec_to_time(12345) 03:25:45
|
||||
|
|
@ -62,33 +62,27 @@ current_timestamp(4) 2011-01-01 01:01:01.1234
|
|||
localtime(5) 2011-01-01 01:01:01.12345
|
||||
localtimestamp(6) 2011-01-01 01:01:01.123456
|
||||
time_to_sec(123456) 45296
|
||||
time_to_sec('12:34:56.789') 45296.789
|
||||
time_to_sec('12:34:56.789') 45296.789000
|
||||
drop table t1;
|
||||
select unix_timestamp('2011-01-01 01:01:01'), unix_timestamp('2011-01-01 01:01:01.123456'), unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(0))), unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(4)));;
|
||||
unix_timestamp('2011-01-01 01:01:01') 1293832861
|
||||
unix_timestamp('2011-01-01 01:01:01.123456') 1293832861.12346
|
||||
unix_timestamp('2011-01-01 01:01:01') 1293832861.000000
|
||||
unix_timestamp('2011-01-01 01:01:01.123456') 1293832861.123456
|
||||
unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(0))) 1293832861
|
||||
unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(4))) 1293832861.1235
|
||||
unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(4))) 1293832861.1234
|
||||
select from_unixtime(unix_timestamp('2011/1/1 1:1:1')), from_unixtime(unix_timestamp('2011/1/1 1:1:1.123456')), from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(0)))), from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(4))));;
|
||||
from_unixtime(unix_timestamp('2011/1/1 1:1:1')) 2011-01-01 01:01:01
|
||||
from_unixtime(unix_timestamp('2011/1/1 1:1:1')) 2011-01-01 01:01:01.000000
|
||||
from_unixtime(unix_timestamp('2011/1/1 1:1:1.123456')) 2011-01-01 01:01:01.123456
|
||||
from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(0)))) 2011-01-01 01:01:01
|
||||
from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(4)))) 2011-01-01 01:01:01.1234
|
||||
select sec_to_time(3020399.99999), sec_to_time(3020399.999999), sec_to_time(3020399.9999999);
|
||||
sec_to_time(3020399.99999) sec_to_time(3020399.999999) sec_to_time(3020399.9999999)
|
||||
838:59:59.99998 838:59:59.999999 838:59:59.999999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '3020399.9999999'
|
||||
838:59:59.99999 838:59:59.999999 838:59:59.999999
|
||||
select sec_to_time(-3020399.99999), sec_to_time(-3020399.999999), sec_to_time(-3020399.9999999);
|
||||
sec_to_time(-3020399.99999) sec_to_time(-3020399.999999) sec_to_time(-3020399.9999999)
|
||||
-838:59:59.99998 -838:59:59.999999 -838:59:59.999999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '-3020399.9999999'
|
||||
-838:59:59.99999 -838:59:59.999999 -838:59:59.999999
|
||||
select 20010101000203.000000004 + interval 1 day;
|
||||
20010101000203.000000004 + interval 1 day
|
||||
2001-01-02 00:02:03.000000
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect datetime value: '20010101000203.000000004'
|
||||
select 20010101000203.4 + interval 1 day;
|
||||
20010101000203.4 + interval 1 day
|
||||
2001-01-02 00:02:03.4
|
||||
|
|
@ -157,6 +151,14 @@ t4 12:13:14.1234
|
|||
t5 12:13:14.12345
|
||||
t6 12:13:14.123456
|
||||
drop table t1;
|
||||
explain extended select cast(cast(@a as datetime(4)) as time(0));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select cast(cast((@a) as datetime(4)) as time) AS `cast(cast(@a as datetime(4)) as time(0))`
|
||||
select cast(cast(@a as time(2)) as time(6));
|
||||
cast(cast(@a as time(2)) as time(6))
|
||||
12:13:14.120000
|
||||
select CAST(@a AS DATETIME(7));
|
||||
ERROR 42000: Too big precision 7 specified for '(@a)'. Maximum is 6.
|
||||
SELECT CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue