From: Michael Paquier <michael@paquier.xyz>
To: Aleksander Alekseev <aleksander@timescale.com>
Cc: pgsql-bugs@lists.postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: TimestampTz->Text->TimestampTz casting fails with DateStyle 'Postgres'
Date: Tue, 10 Dec 2024 09:26:02 +0900
Message-ID: <Z1eKmoJHXVd8_oz1@paquier.xyz> (raw)
In-Reply-To: <CAJ7c6TMpBUMLqep4ycxySN+SFsf-eG2v-nUaVSzu2jSd5eDMAA@mail.gmail.com>
References: <CAJ7c6TOATjJqvhnYsui0=CO5XFMF4dvTGH+skzB--jNhqSQu5g@mail.gmail.com>
<3416600.1730987836@sss.pgh.pa.us>
<CAJ7c6TMzJDLutYt+pcm1Jt+sDSRHjvjezM9o8heEoo_LwgP75A@mail.gmail.com>
<CAJ7c6TMpBUMLqep4ycxySN+SFsf-eG2v-nUaVSzu2jSd5eDMAA@mail.gmail.com>
On Thu, Nov 07, 2024 at 06:09:15PM +0300, Aleksander Alekseev wrote:
> Here is the patch.
@@ -139,6 +139,7 @@ static const datetkn datetktbl[] = {
{"july", MONTH, 7},
{"jun", MONTH, 6},
{"june", MONTH, 6},
+ {"lmt", IGNORE_DTF, 0}, /* "lmt" (throwaway) */
{"m", UNITS, DTK_MONTH}, /* "month" for ISO input */
{"mar", MONTH, 3},
{"march", MONTH, 3},
FWIW, I have a hard time understanding why ignoring "LMT", which is
a timezone abbreviation meaning "Local Mean Time", in datetktbl[],
which is a table for date/time keywords, is the right thing to do.
The comment at the top of datetktbl also mentions that this includes
no TZ, DTZ, or DYNTZ entries, and that we should rely on zoneabbrevtbl
instead, which is pushed by InstallTimeZoneAbbrevs() depending on the
GUC assign callback of timezone_abbreviations. So that seems just
inconsistent to me. Perhaps that's OK at the end, but this ignores
the existing comment on top of the table.
Worth noting that we may want to do something in ECPG's dt_common.c as
well, that holds a similar table with TZ abbreviation data and LMT is
missing there?
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: michael@paquier.xyz, aleksander@timescale.com, tgl@sss.pgh.pa.us
Subject: Re: TimestampTz->Text->TimestampTz casting fails with DateStyle 'Postgres'
In-Reply-To: <Z1eKmoJHXVd8_oz1@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox