Re: TimestampTz->Text->TimestampTz casting fails with DateStyle 'Postgres'

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Aleksander Alekseev <aleksander@timescale.com>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2024-11-07T13:57:16Z
Lists: pgsql-bugs
Aleksander Alekseev <aleksander@timescale.com> writes:
> =# set datestyle to 'Postgres';
> SET
> =# SELECT '1000-01-01'::timestamptz::text::timestamptz;
> ERROR:  invalid input syntax for type timestamp with time zone: "Wed
> Jan 01 00:00:00 1000 LMT"

> If I understand correctly, text->timestamptz doesn't understand the
> 'LMT' timezone.

So it seems.  In a quick experiment, it seemed like just treating LMT
as a noise word on input might be enough, but I don't have time today
to poke at it further.

			regards, tom lane



Commits

  1. Seek zone abbreviations in the IANA data before timezone_abbreviations.

  2. Make pg_interpret_timezone_abbrev() check sp->defaulttype too.