From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | Aleksander Alekseev <aleksander(at)timescale(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: TimestampTz->Text->TimestampTz casting fails with DateStyle 'Postgres' |
Date: | 2024-12-11 02:43:18 |
Message-ID: | 394372.1733884998@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
I wrote:
> I agree. We should be mapping it to whatever GMT offset "LMT" means
> in the selected zone (assuming there is an entry, which it seems like
> there is in most of them). I've not gotten around to looking at what
> that would take, but it's probably not entirely trivial, since it
> would mean different GMT offsets in different zones.
Here's a draft patch for that. It turns out to be simpler than I
thought, because we can mostly piggy-back on the existing DYNTZ
support. The difference between LMT and one of our existing dynamic
abbreviations is that LMT means whatever it means in the prevailing
session timezone, while a dynamic abbreviation specifies which TZDB
timezone it refers to.
> One thing that might be interesting to look at is whether the same
> mechanism could be used for other TZ abbreviations defined by the tzdb
> data, instead of relying on our hard-wired lists.
As I set it up here, we first check the timezone abbreviation list,
then look into the session timezone to see if it has an entry.
I don't expect that this lookup will succeed for anything except LMT,
because every other abbreviation that TZDB knows about is already
listed in our standard abbreviation list. But in the future we
could imagine removing entries from the abbreviation list so that
this code path takes more of the burden. That'd be particularly
attractive for abbreviations that have conflicts, because then
our interpretation of the abbreviation would automatically adapt
based on the timezone setting. That's something to pursue another
day though. We might need to work a bit harder on optimizing
this code path before we let it take anything more common than
LMT, too.
This is not committable because I didn't think about documentation
yet. We probably want to explain this in Appendix B, and also
there are assorted comments about what a "dynamic abbreviation"
is that will need some adjustment.
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
v1-handle-LMT-as-a-dynamic-abbreviation.patch | text/x-diff | 7.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Artur Zakirov | 2024-12-11 11:38:59 | Re: pg_dump crash on identity sequence with not loaded attributes |
Previous Message | Tom Lane | 2024-12-10 21:15:16 | Re: pg_dump crash on identity sequence with not loaded attributes |