Re: setting the timezone parameter with space cause diff result - Mailing list pgsql-bugs

From Tom Lane
Subject Re: setting the timezone parameter with space cause diff result
Date
Msg-id 1123102.1623175370@sss.pgh.pa.us
Whole thread Raw
In response to setting the timezone parameter with space cause diff result  (甄明洋 <zhenmingyang@yeah.net>)
Responses Re:Re: setting the timezone parameter with space cause diff result  (甄明洋 <zhenmingyang@yeah.net>)
List pgsql-bugs
=?UTF-8?B?55SE5piO5rSL?= <zhenmingyang@yeah.net> writes:
> /* timezone string with space */
> postgres=# set timezone=' +04:00 ';
> SET
> postgres=# select now();
>               now              
> -------------------------------
>  2021-06-08 05:14:36.486693-03
> (1 row)

What is happening here is that the setting is being interpreted
much like 'X+04:00Y'.  That is, it's taken as a POSIX timezone
specifier with standard-time abbreviation being ' ', daylight-
savings abbreviation also being ' ', and the daylight-savings
offset and transition rules all being defaulted.  Your example
without any spaces is recognized as a POSIX timezone spec
with no DST part, so that's why it behaves differently.

There's certainly room to quibble about whether a single space
ought to be considered a valid zone abbreviation.  However,
this behavior comes directly from the IANA tzcode library,
so I'm hesitant to change it.

            regards, tom lane



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #17052: Incorrect params inferred on PREPARE (part 2)
Next
From: Tom Lane
Date:
Subject: Re: BUG #17050: cursor with for update + commit in loop