should be it
This commit is contained in:
56
external/duckdb/test/sql/function/timestamp/epoch.test
vendored
Normal file
56
external/duckdb/test/sql/function/timestamp/epoch.test
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
# name: test/sql/function/timestamp/epoch.test
|
||||
# description: Test epoch_ms function
|
||||
# group: [timestamp]
|
||||
|
||||
query TTTTTT
|
||||
SELECT
|
||||
make_timestamp(0) as epoch1,
|
||||
make_timestamp(1574802684123 * 1000) as epoch2,
|
||||
make_timestamp(-291044928000 * 1000) as epoch3,
|
||||
make_timestamp(-291081600000 * 1000) as epoch4,
|
||||
make_timestamp(-291081600001 * 1000) as epoch5,
|
||||
make_timestamp(-290995201000 * 1000) as epoch6
|
||||
----
|
||||
1970-01-01 00:00:00
|
||||
2019-11-26 21:11:24.123
|
||||
1960-10-11 10:11:12
|
||||
1960-10-11 00:00:00
|
||||
1960-10-10 23:59:59.999
|
||||
1960-10-11 23:59:59
|
||||
|
||||
# MS version for replacing epoch_ms(bigint)
|
||||
query TTTTTT
|
||||
SELECT
|
||||
make_timestamp_ms(0) as epoch1,
|
||||
make_timestamp_ms(1574802684123) as epoch2,
|
||||
make_timestamp_ms(-291044928000) as epoch3,
|
||||
make_timestamp_ms(-291081600000) as epoch4,
|
||||
make_timestamp_ms(-291081600001) as epoch5,
|
||||
make_timestamp_ms(-290995201000) as epoch6
|
||||
----
|
||||
1970-01-01 00:00:00
|
||||
2019-11-26 21:11:24.123
|
||||
1960-10-11 10:11:12
|
||||
1960-10-11 00:00:00
|
||||
1960-10-10 23:59:59.999
|
||||
1960-10-11 23:59:59
|
||||
|
||||
query IIII
|
||||
SELECT to_timestamp(0), to_timestamp(1), to_timestamp(1574802684), to_timestamp(-1)
|
||||
----
|
||||
1970-01-01 00:00:00+00
|
||||
1970-01-01 00:00:01+00
|
||||
2019-11-26 21:11:24+00
|
||||
1969-12-31 23:59:59+00
|
||||
|
||||
# Frational seconds in UTC
|
||||
query I
|
||||
SELECT to_timestamp(1284352323.5);
|
||||
----
|
||||
2010-09-13 04:32:03.5+00
|
||||
|
||||
# Coverage
|
||||
statement error
|
||||
SELECT to_timestamp(1284352323::DOUBLE * 100000000);
|
||||
----
|
||||
Conversion Error: Epoch seconds out of range for TIMESTAMP WITH TIME ZONE
|
||||
Reference in New Issue
Block a user