Re: [COMMITTERS] pgsql: Allow to_timestamp(float8) to convert float infinity to timestam

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Allow to_timestamp(float8) to convert float infinity to timestam
Date: 2016-03-30 00:19:58
Message-ID: CAB7nPqQRbFsDmvwescsnTjKioUm9qK1moWSMZHDrPSYJxnd0Rg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Wed, Mar 30, 2016 at 6:09 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Allow to_timestamp(float8) to convert float infinity to timestamp infinity.
>
> With the original SQL-function implementation, such cases failed because
> we don't support infinite intervals. Converting the function to C lets
> us bypass the interval representation, which should be a bit faster as
> well as more flexible.

+-- The upper boundary differs between integer and float timestamps,
so check the biggest one
+SELECT to_timestamp(185331707078400::float8); -- error, out of range
+ERROR: timestamp out of range: "1.85332e+14"
Some of the tests introduced are making MSVC unhappy, because they
depend on the three-digit behavior that Windows is using, leading to
those failures:

-- The upper boundary differs between integer and float timestamps,
so check the biggest one
SELECT to_timestamp(185331707078400::float8); -- error, out of range
! ERROR: timestamp out of range: "1.85332e+14"
-- nonfinite values
SELECT to_timestamp(' Infinity'::float);
to_timestamp
--- 2338,2344 ----

-- The upper boundary differs between integer and float timestamps,
so check the biggest one
SELECT to_timestamp(185331707078400::float8); -- error, out of range
! ERROR: timestamp out of range: "1.85332e+014"

If the those tests are kept, an alternate output file is necessary (I
can send a patch if needed, I see the failure locally as well).
--
Michael

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-03-30 01:13:36 Re: [COMMITTERS] pgsql: Allow to_timestamp(float8) to convert float infinity to timestam
Previous Message Michael Paquier 2016-03-30 00:15:39 Re: Re: [COMMITTERS] pgsql: Sync tzload() and tzparse() APIs with IANA release tzcode2016c.

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2016-03-30 00:21:07 Re: OOM in libpq and infinite loop with getCopyStart()
Previous Message Michael Paquier 2016-03-30 00:15:39 Re: Re: [COMMITTERS] pgsql: Sync tzload() and tzparse() APIs with IANA release tzcode2016c.