Re: Fix for edge case in date_bin() function - Mailing list pgsql-hackers

From Moaaz Assali
Subject Re: Fix for edge case in date_bin() function
Date
Msg-id CALkF+ns_ghEdVv2_mh=iCuirGnJHowtV0e_wg9_0RgkADo6dJg@mail.gmail.com
Whole thread Raw
In response to Re: Fix for edge case in date_bin() function  (Daniel Gustafsson <daniel@yesql.se>)
List 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@yesql.se> wrote:
> On 27 Feb 2024, at 09:42, Moaaz Assali <ma5679@nyu.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

pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: table inheritance versus column compression and storage settings
Next
From: Bertrand Drouvot
Date:
Subject: Re: Synchronizing slots from primary to standby