Re: Inconsistent 'at time zone' conversion - Mailing list pgsql-bugs

From Umut TEKİN
Subject Re: Inconsistent 'at time zone' conversion
Date
Msg-id CAPZcZRmMRcCRGCshrqtxJkn4vyuGpLDH0=iWrM0fkc_shBEC0g@mail.gmail.com
Whole thread Raw
In response to Re: Inconsistent 'at time zone' conversion  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Inconsistent 'at time zone' conversion  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Hi,

Thank you  for your answers David G. Johnston and Tom Land. That is much more clear now.

Yet, there is one tiny thing left:

1. select TIMESTAMP WITH TIME ZONE '2004-10-19 10:23:54+03' at time zone 'America/Denver';
  2004-10-19 01:23:54

2. select TIMESTAMP WITH TIME ZONE '2004-10-19 10:23:54+03' at time zone 'UTC+7';
  2004-10-19 00:23:54

3. select TIMESTAMP WITH TIME ZONE '2004-10-19 10:23:54+03' at time zone 'Europe/Moscow';
  2004-10-19 11:23:54

4. select TIMESTAMP WITH TIME ZONE '2004-10-19 10:23:54+03' at time zone 'UTC-3';
  2004-10-19 10:23:54

The outputs of the 1st and the 2nd queries should be the same because "+/-" works opposite of ISO - 8601. Same thing should apply to query 3rd and 4th.

When I try following queries they give exactly the same output.

select now()::timestamp with time zone  at time zone 'America/Denver';
select now()::timestamp with time zone  at time zone 'UTC+7';

So, it should be related to the date. Yet, as you can see '2004-10-19 10:23:54+03' is nearly the same time of the year 18 years and 4 months ago. So, the same DST rules should apply, but it does not. There is 1 hour difference between query 1st and 2nd, also query 3rd and 4th.


What could be the reason for this?

Thanks!

Umut Tekin



On Mon, Feb 20, 2023 at 12:49 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Umut TEKİN <umuttechin@gmail.com> writes:
> I think I found a bug about time zones.

You're just confused about the signs of timezone offsets.
"UTC-7" is read as POSIX notation so that it means 7 hours
east of Greenwich, not west where Denver is.  See

https://www.postgresql.org/docs/current/datetime-posix-timezone-specs.html

                        regards, tom lane

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17802: PGLogical getting Terminated
Next
From: Tom Lane
Date:
Subject: Re: Inconsistent 'at time zone' conversion