Re: Add support for AT LOCAL

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Vik Fearing <vik@postgresfriends.org>, cary huang <hcary328@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2023-10-16T01:58:03Z
Lists: pgsql-hackers
On Mon, Oct 16, 2023 at 11:50:08AM +1300, Thomas Munro wrote:
> On Mon, Oct 16, 2023 at 11:24 AM Thomas Munro <thomas.munro@gmail.com> wrote:
>> On Mon, Oct 16, 2023 at 10:57 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> I'm tempted to wonder if this helps:
>>>
>>> -       result->time = t->time + (t->zone - tz) * USECS_PER_SEC;
>>> +       result->time = t->time + (int64) (t->zone - tz) * USECS_PER_SEC;

All that should use TZNAME_FIXED_OFFSET as timezone type, and I don't
really see why this would overflow..

Perhaps a more aggressive (int64) ((t->zone - (int64) tz) *
USECS_PER_SEC) would help?

>> I wanted to be able to try this and any other theories and managed to
>> build the tip of master on cfarm111 with the same CC and CFLAGS as
>> Noah used, but the problem didn't reproduce!  Hmm, I didn't enable any
>> extra options, so now I'm wondering if something in some random header
>> somewhere is involved here...  trying again with more stuff turned
>> on...
> 
> Oh, I can't use any of the handrolled packages in ~nm due to
> permissions.  I tried enabling perl from /opt/freeware (perl is my
> usual first guess for who is !@#$ing with the system headers), but the
> test passes.

Another theory would be one of these weird compiler optimization issue
from xlc?  In recent history, there was 8d2a01ae12cd.
--
Michael

Commits

  1. Dodge a compiler bug affecting timetz_zone/timetz_izone.

  2. Back-patch test cases for timetz_zone/timetz_izone.

  3. Add regression test coverage for timetz_izone().

  4. Add support for AT LOCAL

  5. doc: Mention timezone(zone, time) in section for AT TIME ZONE

  6. Use HASH_BLOBS for xidhash.