Re: A bug with the TimeStampTZ data type and the 'AT TIME ZONE' clause

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Troy Frericks <troy(dot)frericks(at)iseatz(dot)com>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: A bug with the TimeStampTZ data type and the 'AT TIME ZONE' clause
Date: 2022-02-12 15:45:53
Message-ID: CAKFQuwY1ceakg=dcWmt1-FR=woUBiVYwDLM1d0KXpbpBLV-YkA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Friday, February 11, 2022, Troy Frericks <troy(dot)frericks(at)iseatz(dot)com>
wrote:

>
> -- A bug with the TimeStampTZ data type and the 'AT TIME ZONE' clause
>
> --
>
> -- I'm in the CST time zone.
>
> -- A friend in the EST zone wants me to call him at 11:00 EST. I insert
> that row.
>
> -- To find the time I should call him, I select the row back for my time
> zone, expecting 10:00 CST as: 11:00 EST = 10:00 CST... google: 11:00 EST to
> CST
>
> -- Troy Frericks, 07-Feb-2022
>
>
> *SELECT* *version*() -- Get my Version, returns 14.0
>
>
> *SELECT* *abbrev* -- Get my time zone, returns CST
>
> *FROM* pg_timezone_names
>
> *WHERE* *name* = *current_setting*('TIMEZONE');
>
>
> -- DROP TABLE tsTable;
>
> *CREATE* *TABLE* tsTable (tsCol *timestamptz*);
>
> *INSERT* *INTO* tsTable *VALUES* ('2022-02-07 11:00:00' *AT* *TIME* *ZONE*
> 'EST'); -- 11:00 AM EST
>
>
> *SELECT*
>
> tsCol *AT* *time* *ZONE* 'CST' *AS* "CST" -- Query time as CST, Returns
> 2022-02-07 12:00:00.000, should be 10:00
>
> *FROM* tsTable;
>
>
The time zone you specified is a POSIX one, with the opposite sign
convention than ISO. Use an ISO time zone value.

This is documented.

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

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2022-02-12 16:15:12 Re: A bug with the TimeStampTZ data type and the 'AT TIME ZONE' clause
Previous Message David G. Johnston 2022-02-12 15:37:47 Re: Postgresql datetimes are not ISO-8601 compliant, but RFC3339