Re: Fix for edge case in date_bin() function

From: Moaaz Assali <ma5679(at)nyu(dot)edu>
To: daniel(at)yesql(dot)se
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix for edge case in date_bin() function
Date: 2024-02-27 10:27:46
Message-ID: CALkF+ns_ghEdVv2_mh=iCuirGnJHowtV0e_wg9_0RgkADo6dJg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Daniel,

I have added a test case for this in timestamp.sql and timestamp.out, and
tests pass when using the bug fix patch in the first email.
I have attached a new patch in this email below with the new tests only
(doesn't include the bug fix).

P.S. I forgot to CC the mailing list in my previous reply. This is just a
copy of it.

Best regards,
Moaaz Assali

On Tue, Feb 27, 2024 at 12:48 PM Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:

> > On 27 Feb 2024, at 09:42, Moaaz Assali <ma5679(at)nyu(dot)edu> wrote:
>
> > To account for this edge, we simply add another condition in the if
> statement to not perform the subtraction by one stride interval if the time
> difference is divisible by the stride.
>
> I only skimmed the patch, but I recommend adding a testcase to it to keep
> the
> regression from reappearing. src/test/regress/sql/timestamp.sql might be a
> good candidate testsuite.
>
> --
> Daniel Gustafsson
>
>

Attachment Content-Type Size
v1-0002-Regression-test-in-timestamp.sql-for-date_bin.patch application/octet-stream 2.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2024-02-27 10:37:40 Re: Synchronizing slots from primary to standby
Previous Message Ashutosh Bapat 2024-02-27 10:23:53 Re: table inheritance versus column compression and storage settings