Re: Inconsistency of timezones in postgresql

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Chris BSomething <xpusostomos(at)gmail(dot)com>
Cc: PostgreSQL Bug List <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Inconsistency of timezones in postgresql
Date: 2024-08-02 04:13:25
Message-ID: CAKFQuwbuU3ULeoXO5MPjWbRx2-2hn7KCpzV69tMdcS3hKJb9HA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Please reply-all to keep the list involved.

On Thursday, August 1, 2024, Chris BSomething <xpusostomos(at)gmail(dot)com> wrote:

>
> ibis=# set time zone 'UTC';
>>>
>> SET
>
>
From this point on all timestamptz outputs will be shown to you in “+00”
since your time zone is set to UTC

>
>
> ibis=# select update_date at time zone 'Australia/Sydney' from
> collection_item where item_id=2197;
> timezone
> ------------------------
> 2012-07-06 02:59:55+00
>

The input timestamp is noon. Turn it into a string. Concatenate
“Australia/Sydney” to it. Cast that to timestamptz. Then rotate that 12pm
Sydney time to UTC - resulting in 2AM. Print 2am to the screen with a
“+00” suffix to indicate that what you are seeing is a timestamptz value
displayed in your UTC specified time zone.

I.e. your just wrote something similar to (in common terms):

Select ‘2012-07-06 12:59:55+10’::timezone at time zone UTC

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2024-08-02 04:18:54 Re: Inconsistency of timezones in postgresql
Previous Message Peter Smith 2024-08-02 02:51:46 Re: BUG #18558: ALTER PUBLICATION fails with unhelpful error on attempt to use system column