Re: BUG #12326: I think maybe postgresql has a problem about timezone.

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: 张亚琪 <zhangyingyun001(at)gmail(dot)com>
Cc: John R Pierce <pierce(at)hogranch(dot)com>, Pg Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #12326: I think maybe postgresql has a problem about timezone.
Date: 2014-12-24 15:05:11
Message-ID: CAMkU=1xZULVuL9PsMEdy5N9cvdkBKL61Wv4z_sHnB6BrVCwmoQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Dec 24, 2014 at 3:15 AM, 张亚琪 <zhangyingyun001(at)gmail(dot)com> wrote:

> hi John,
>
> Thank you for your reply. I am in China.
> You can look at my result as following:
>
> show timezone;
>
> TimeZone
>
> ----------
>
> PRC
>
> (1 row)
>
>
>
>
> # update history_configuration set var_datetime = 'Wed Dec 24 18:52:46 CST
>> 2014' where var_name = 'lastHourAggr';
>
>
>
> # select * from history_configuration ;
>
> var_name | var_value | var_datetime
>
> -------------------+-----------+------------------------
>
> lastHourAggr | | 2014-12-25 08:52:46+08
>
>
> So I think this CST means Central Standard Time , right? And then when I
> read data using select sql, it will show this time with postgresql timezone.
>
>
PostgreSQL does not remember what timezone the time was expressed as when
you inserted it. Rather, it interprets the date as being expressed in the
indicated time zone, and translates it to universal time for storage. (If
you didn't indicate a time zone in the string itself, then it interprets it
as being from the timezone the client has set to), When you pull the date
back out, it translates it from universal time to whatever your local
timezone is set to, which in this case is PRC (aka +8).

Cheers,

Jeff

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2014-12-24 15:11:58 Re: BUG #12326: I think maybe postgresql has a problem about timezone.
Previous Message nikita.y.volkov 2014-12-24 14:01:53 BUG #12330: ACID is broken for unique constraints