Re: Since '2001-09-09 01:46:40'::timestamp microseconds are lost when extracting epoch

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Petr Fedorov <petr(dot)fedorov(at)phystech(dot)edu>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Since '2001-09-09 01:46:40'::timestamp microseconds are lost when extracting epoch
Date: 2019-12-01 22:59:11
Message-ID: 18389.1575241151@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Thomas Munro <thomas(dot)munro(at)gmail(dot)com> writes:
> On Sat, Nov 30, 2019 at 10:28 PM Petr Fedorov <petr(dot)fedorov(at)phystech(dot)edu> wrote:
>> Obviously, it is due to the fact that extract epoch returns double
>> precision which in turn has 15 decimal digits precision.

> I guess this deviation from the SQL standard ("exact numeric") made
> sense when PostgreSQL used double for timestamps, but would break a
> lot of queries if we changed it.

Hmmm ... well, now that you mention it, would it really break things
if we made it return numeric? There's an implicit cast to float8,
so it seems like queries requiring that type would still work.

There might be a performance-related argument against switching,
perhaps.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Manuel Rigger 2019-12-01 23:31:45 FailedAssertion("!OidIsValid(def->collOid)", File: "view.c", Line: 89)
Previous Message Thomas Munro 2019-12-01 22:50:00 Re: Since '2001-09-09 01:46:40'::timestamp microseconds are lost when extracting epoch

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2019-12-01 23:12:14 Re: Allow 'sslkey' and 'sslcert' in postgres_fdw user mappings
Previous Message Thomas Munro 2019-12-01 22:50:00 Re: Since '2001-09-09 01:46:40'::timestamp microseconds are lost when extracting epoch