date_diff
operation works differently on Postgres and Snowflake
#10438
Labels
--bug
Type: bug
-libs
Libraries: New libraries to be implemented
l-db-connector
Libraries: database connectors
In either backend our
date_diff
operation delegates to SQLDATE_DIFF
/DATEDIFF
.However, the two backends have differing semantics in some edge cases.
See parts of the test
"should allow computing a SQL-like difference"
:In the Snowflake backend this yields
1
instead of0
.That is because, as documented, when computing a
month
difference, only year and month fields are considered - so the DB sees that the month differs and returns 1, disregarding the day field that shows us that not a full month passed yet.In Snowflake we can check that even:
which compares two dates just 1 day apart, still yields a 1 month difference if asked for months.
The text was updated successfully, but these errors were encountered: