Re: Remove dependence on integer wrapping

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Joseph Koshakow <koshy44(at)gmail(dot)com>
Cc: Alexander Lakhin <exclusion(at)gmail(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Matthew Kim <matthewkmkim(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Remove dependence on integer wrapping
Date: 2024-12-05 22:50:34
Message-ID: Z1IuOvRk7xQIBGSI@nathan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Aug 24, 2024 at 08:44:40AM -0400, Joseph Koshakow wrote:
> FWIW, Matthew's patch actually does resolve a bug with `to_timestamp`
> and `to_date`. It converts the following incorrect queries
>
> test=# SELECT to_timestamp('2147483647,999', 'Y,YYY');
> to_timestamp
> ---------------------------------
> 0001-01-01 00:00:00-04:56:02 BC
> (1 row)
>
> test=# SELECT to_date('-2147483648', 'CC');
> to_date
> ------------
> 0001-01-01
> (1 row)
>
> into errors
>
> test=# SELECT to_timestamp('2147483647,999', 'Y,YYY');
> ERROR: invalid input string for "Y,YYY"
> test=# SELECT to_date('-2147483648', 'CC');
> ERROR: date out of range: "-2147483648"
>
> So, it might be worth committing only his changes before moving on.

Good point. Here is a v27 patch that extracts the bug fix portions of the
v26 patch. If/when this is committed, I think we should close the
commitfest entry.

--
nathan

Attachment Content-Type Size
v27-0001-fix-date-time-overflows.patch text/plain 7.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2024-12-05 23:24:40 Re: attndims, typndims still not enforced, but make the value within a sane threshold
Previous Message Peter Smith 2024-12-05 22:37:33 Re: Parallel heap vacuum