Re: datestyle=postgres broken with timezone=UTC+N

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christoph Berg <cb(at)df7cb(dot)de>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: datestyle=postgres broken with timezone=UTC+N
Date: 2015-08-30 15:02:47
Message-ID: 20976.1440946967@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Christoph Berg <cb(at)df7cb(dot)de> writes:
> postgres =# set timezone = 'Etc/UTC+1';
> SET
> postgres =# set datestyle = 'postgres';
> SET
> postgres =# select '2015-01-01 01:00:00 +0100'::timestamptz;
> Wed 31 Dec 23:00:00 2014 ETC/UTC

> postgres =# select 'Wed 31 Dec 23:00:00 2014 ETC/UTC'::timestamptz;
> Wed 31 Dec 22:00:00 2014 ETC/UTC

Not sure I see your point? Lacking any entry for ETC/UTC in the
timezone_abbreviations file, we'll look it up in the zoneinfo database,
and that will tell us it means UTC+0. So the input means 2300 UTC, and
that gets displayed as 2200 in your UTC-1 display timezone.

No, this isn't entirely consistent with the way the timezone name is being
used in output. But that's because you've only half-configured the system
for a weird timezone name. You would need an abbreviation entry as well
if you want "ETC/UTC" to be read as UTC-1.

For more info read
http://www.postgresql.org/docs/9.4/static/datatype-datetime.html#DATATYPE-TIMEZONES
--- see particularly the FOOBAR0 example, which is exactly what you've
got here. By and large, I don't recommend use of POSIX notation in
timezone settings; the IANA geographical zone names are much less likely
to bite you on the rear.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2015-08-30 15:14:49 SimpleTee flush
Previous Message Simon Riggs 2015-08-30 14:31:10 Re: Horizontal scalability/sharding