Re: Add support for AT LOCAL - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Add support for AT LOCAL
Date
Msg-id ZS8gha6qJPJADZKe@paquier.xyz
Whole thread Raw
In response to Re: Add support for AT LOCAL  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Tue, Oct 17, 2023 at 12:45:28PM -0400, Tom Lane wrote:
> Whoops, no: for negative starting values we'd need truncate-towards-
> minus-infinity division whereas C99 specifies truncate-towards-zero.
> However, the attached does pass for me on cfarm111 as well as my
> usual dev machine.

I guess that the following trick could be used for the negative case,
with one modulo followed by one extra addition:
if (result->time < INT64CONST(0))
{
    result->time %= USECS_PER_DAY;
    result->time += USECS_PER_DAY;
}

> Presumably this is a pre-existing bug that also appears in back
> branches.  But in the interests of science I propose that we
> back-patch only the test case and see which machine(s) fail it
> before back-patching the code change.

Sure, as you see fit.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: [PoC/RFC] Multiple passwords, interval expirations
Next
From: Michael Paquier
Date:
Subject: Re: New WAL record to detect the checkpoint redo location