-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
date_part currently returns i32 which might lose some information, e.g.
❯ select date_part('second', timestamp '2000-01-01T00:00:00.1');
+--------------------------------------------------------+
| datepart(Utf8("second"),Utf8("2000-01-01T00:00:00.1")) |
+--------------------------------------------------------+
| 0 |
+--------------------------------------------------------+
1 row in set. Query took 0.000 seconds.while postgresql returns double precision
willy=# select date_part('second', timestamp '2000-01-01T00:00:00.1');
date_part
-----------
0.1
(1 row)is it recommended to follow postgresql's return type?
if it is preferred, perhaps we could do a separate pr to deal with this
change it to double precision
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
perhaps we could consider return decimals instead to align with extract to return decimal. postgres doc mentions this:
For historical reasons, the date_part function returns values of type double precision.
This can result in a loss of precision in certain uses. Using extract is recommended instead.
https://www.postgresql.org/docs/current/functions-datetime.html
Additional context
Add any other context or screenshots about the feature request here.