-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Time seems to drop precision when passed in as an arg using at_end_of_day #252
Comments
The reason is that timestamp types in posgresql only store the time value with microsecond precision but Crystal's You can observe the same behaviour running this SQL query: SELECT '2022-06-13T23:59:59.999999999999Z' :: timestamp;
-- timestamp
-- ---------------------
-- 2022-06-14 00:00:00
-- (1 row) |
Oh lovely. Good catch. I guess we need |
Or |
If that is the case, can this line be updated to Running a quick test on my end makes the example work. |
Yes, that should fix this problem. There are other implications, though. Truncating the fraction digits results in an odd rounding behaviour that might be unexpected at some times. So I'm not sure if the driver should handle this. |
It seems when passing in a Time object set to
at_end_of_day
as an arg, it somehow loses the precision and rolls in to the beginning of the next day.Here's an example where I generate a date series. The first SQL has the time set manually, and when ran, it returns 1 result properly. The second SQL pulls the times from Crystal and passes it over as as args. Even though the Crystal times have the same values, running this SQL returns 2 results instead of 1.
The text was updated successfully, but these errors were encountered: