pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: 甄明洋 <zhenmingyang@yeah.net>
Cc: pgsql-bugs@postgresql.org
Subject: Re: setting the timezone parameter with space cause diff result
Date: Tue, 08 Jun 2021 14:02:50 -0400
Message-ID: <1123102.1623175370@sss.pgh.pa.us> (raw)
In-Reply-To: <37c04704.1327.179eab261fd.Coremail.zhenmingyang@yeah.net>
References: <37c04704.1327.179eab261fd.Coremail.zhenmingyang@yeah.net>

=?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





view thread (5+ messages)  latest in thread

Message-ID: <1123102.1623175370@sss.pgh.pa.us>
Permalink:  ../1123102.1623175370@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1123102.1623175370@sss.pgh.pa.us

 · 

reply

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: tgl@sss.pgh.pa.us, zhenmingyang@yeah.net
  Subject: Re: setting the timezone parameter with space cause diff result
  In-Reply-To: <1123102.1623175370@sss.pgh.pa.us>

* 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