Re: jsonpath: Inconsistency of timestamp_tz() Output - Mailing list pgsql-hackers

From David E. Wheeler
Subject Re: jsonpath: Inconsistency of timestamp_tz() Output
Date
Msg-id 31EE4A0B-3126-43E3-9E24-998431241739@justatheory.com
Whole thread Raw
In response to Re: jsonpath: Inconsistency of timestamp_tz() Output  ("David E. Wheeler" <david@justatheory.com>)
Responses Re: jsonpath: Inconsistency of timestamp_tz() Output
List pgsql-hackers
On Jul 10, 2024, at 10:33, David E. Wheeler <david@justatheory.com> wrote:

> Yeah I don’t know either, but now at least it’s consistent. I’ve attached a patch to fix it.

Actually I think there’s a subtlety still missing here:

@@ -2914,7 +2914,7 @@ HINT:  Use *_tz() function for time zone support.
 select jsonb_path_query_tz('"2023-08-15"', '$.timestamp_tz()'); -- should work
      jsonb_path_query_tz       -----------------------------
- "2023-08-15T07:00:00+00:00"
+ "2023-08-14T23:00:00-08:00"
 (1 row)

This test runs while the time zone is set to “PST8PDT”, but it’s got the PST offset when it should be PDT:

david=# set time zone 'PST8PDT';
SET
david=# select '2023-08-15'::timestamptz;
      timestamptz
------------------------
 2023-08-15 00:00:00-07

So it should be -7, not -8. Not sure where to tell it to pay proper attention to daylight savings time.

Best,

David





pgsql-hackers by date:

Previous
From: Rafia Sabih
Date:
Subject: Re: Possible incorrect row estimation for Gather paths
Next
From: Antonin Houska
Date:
Subject: Missed opportunity for bsearch() in TransactionIdIsCurrentTransactionId()?