Re: Date-Time dangling unit fix - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Date-Time dangling unit fix
Date
Msg-id 807753.1678460966@sss.pgh.pa.us
Whole thread Raw
In response to Re: Date-Time dangling unit fix  (Alexander Lakhin <exclusion@gmail.com>)
Responses Re: Date-Time dangling unit fix
List pgsql-hackers
Alexander Lakhin <exclusion@gmail.com> writes:
> I also wonder how the units affect time zone parsing.
> With the patch:
> SELECT time with time zone '010203m+3';
> ERROR:  invalid input syntax for type time with time zone: "010203m+3"
> But without the patch:
> SELECT time with time zone '010203m+3';
>   01:02:03+03

Yeah, I think this is the ptype-still-set-at-end-of-loop check.
I'm fine with throwing an error for that.

> Though with "non-unit" spec:
> SELECT time with time zone '010203mmm+3';
>   01:02:03-03
> (With or without the patch.)
> It seems like "units" were just ignored in a time zone specification,
> but now they are rejected.

I think it's reading "mmm+3" as a POSIX timezone spec.  From memory,
POSIX allows any sequence of 3 or more letters as a zone abbreviation.
It looks like we're being lax and not enforcing the "3 or more" part:

regression=# set time zone 'foobar+3';
SET
regression=# select timeofday();
               timeofday                
----------------------------------------
 Fri Mar 10 12:08:24.484853 2023 FOOBAR
(1 row)

regression=# set time zone 'fo+3';
SET
regression=# select timeofday();
             timeofday              
------------------------------------
 Fri Mar 10 12:08:38.207311 2023 FO
(1 row)

            regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: pgsql: Use ICU by default at initdb time.
Next
From: Masahiko Sawada
Date:
Subject: Re: [PoC] Improve dead tuple storage for lazy vacuum