diff --git a/test/JDBC/expected/BABEL-3953-datetrunc-vu-verify.out b/test/JDBC/expected/BABEL-3953-datetrunc-vu-verify.out index fbfd5fc298..4c15424174 100644 --- a/test/JDBC/expected/BABEL-3953-datetrunc-vu-verify.out +++ b/test/JDBC/expected/BABEL-3953-datetrunc-vu-verify.out @@ -194,6 +194,13 @@ datetime2 ~~ERROR (Message: 'NULL' is not a recognized datetrunc option.)~~ +select datetrunc('year',CAST('2020-01-01' as date)) +go +~~START~~ +date +2020-01-01 +~~END~~ + select datetrunc(year, null) as dt3 GO ~~START~~ @@ -241,6 +248,18 @@ numeric ~~ERROR (Message: Argument data type 'numeric' is invalid for argument 2 of datetrunc function.)~~ +-- postgres support 6 digits of fractional time-scale so the bbf output will differ +-- in the last fractional second digit from t-sql. bbf- 2021-12-08 11:30:15.1234570 +-- tsql- 2021-12-08 11:30:15.1234560 +DECLARE @d datetime2 = '2021-12-08 11:30:15.1234567'; +SELECT 'Microsecond', DATETRUNC(microsecond, @d); +Go +~~START~~ +varchar#!#datetime2 +Microsecond#!#2021-12-08 11:30:15.1234570 +~~END~~ + + DECLARE @test_date date; SET @test_date = '1998-09-12'; SELECT datetrunc(week, @test_date); diff --git a/test/JDBC/input/functions/BABEL-3953-datetrunc-vu-verify.sql b/test/JDBC/input/functions/BABEL-3953-datetrunc-vu-verify.sql index 935b224def..ebefb27462 100644 --- a/test/JDBC/input/functions/BABEL-3953-datetrunc-vu-verify.sql +++ b/test/JDBC/input/functions/BABEL-3953-datetrunc-vu-verify.sql @@ -68,6 +68,8 @@ select datetrunc('NULL', null) as dt1 GO select datetrunc('NULL', 'NULL') as dt1 GO +select datetrunc('year',CAST('2020-01-01' as date)) +go select datetrunc(year, null) as dt3 GO select datetrunc(years, null) as dt4 @@ -81,6 +83,13 @@ GO select datetrunc(hour, 2020.0) GO +-- postgres support 6 digits of fractional time-scale so the bbf output will differ +-- in the last fractional second digit from t-sql. bbf- 2021-12-08 11:30:15.1234570 +-- tsql- 2021-12-08 11:30:15.1234560 +DECLARE @d datetime2 = '2021-12-08 11:30:15.1234567'; +SELECT 'Microsecond', DATETRUNC(microsecond, @d); +Go + DECLARE @test_date date; SET @test_date = '1998-09-12'; SELECT datetrunc(week, @test_date);