Re: Since '2001-09-09 01:46:40'::timestamp microseconds are lost whenextracting epoch - Mailing list pgsql-hackers

From Vik Fearing
Subject Re: Since '2001-09-09 01:46:40'::timestamp microseconds are lost whenextracting epoch
Date
Msg-id 9a680979-ad76-4c3b-1bc0-403152cf49dc@postgresfriends.org
Whole thread Raw
In response to Re: Since '2001-09-09 01:46:40'::timestamp microseconds are lost whenextracting epoch  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: Since '2001-09-09 01:46:40'::timestamp microseconds are lost when extracting epoch
List pgsql-hackers
On 5/25/20 3:28 PM, Peter Eisentraut wrote:
> On 2019-12-02 23:52, Thomas Munro wrote:
>>> I'm not an expert in floating point math but hopefully it means that no
>>> type change is required - double precision can handle it.
>> Me neither, but the SQL standard requires us to use an exact numeric
>> type, so it's wrong on that level by definition.
> 
> I looked into this (changing the return types of date_part()/extract()
> from float8 to numeric).

I think what would be better is to have a specific date_part function
for each part and have extract translate to the appropriate one.  This
is particularly interesting for epoch but it would also allow us to
return the correct type mandated by the spec.

(I would also accept a specific date_part per return type instead of per
part, that would probably even be better.)
-- 
Vik Fearing



pgsql-hackers by date:

Previous
From: "Jonathan S. Katz"
Date:
Subject: Re: password_encryption default
Next
From: Tom Lane
Date:
Subject: Re: Since '2001-09-09 01:46:40'::timestamp microseconds are lost when extracting epoch