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: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Petr Fedorov <petr(dot)fedorov(at)phystech(dot)edu>
Subject: Re: Since '2001-09-09 01:46:40'::timestamp microseconds are lost when extracting epoch
Date: 2020-09-06 23:46:32
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-hackers

Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> writes:
> Here is a new patch series version.
> I have created a new internal function for converting integers to
> numeric, to make the implementation a bit more elegant and compact.

I reviewed the 0002 patch, finding one bug (in int8_sum) and a few
more calls of int8_numeric that could be converted. I think the
attached updated version is committable, and I'd recommend going
ahead with that regardless of the rest of this. I hadn't realized
how many random calls of int8_numeric and int4_numeric we'd grown,
but there are a lot, so this is nice cleanup.

I continue to think that we can't commit 0003 in this form, because
of the breakage that will ensure in stored views. As I said upthread,
we should leave the existing SQL-exposed functions alone, invent
new ones that return numeric, and alter the parser to translate
EXTRACT constructs to the new functions. This approach would also
provide an "out" for anyone who does complain about the performance
cost --- they can just continue to use the old functions.

regards, tom lane

Attachment Content-Type Size
v3-0002-expose-int64_to_numeric.patch text/x-diff 14.3 KB

In response to


Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2020-09-07 01:35:08 Re: [BUG v13] Crash with event trigger in extension
Previous Message Peter Eisentraut 2020-09-04 21:05:28 Re: BUG #16419: wrong parsing BC year in to_date() function

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiro Ikeda 2020-09-07 00:49:21 Re: Transactions involving multiple postgres foreign servers, take 2
Previous Message Tom Lane 2020-09-06 22:36:14 Re: A micro-optimisation for walkdir()