From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | miaoyimin(at)huawei(dot)com |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #9265: why the same interval can't get the same timestamp? |
Date: | 2014-02-18 14:26:17 |
Message-ID: | 23717.1392733577@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
miaoyimin(at)huawei(dot)com writes:
> postgres=# select ('epoch'::pg_catalog.timestamptz + 1386201600 * '1
> second'::pg_catalog.interval);
> ?column?
> ------------------------
> 2013-12-05 08:00:00+08
> (1 row)
> postgres=# select ('epoch'::pg_catalog.timestamptz + 16044 * '1
> day'::pg_catalog.interval);
> ?column?
> ------------------------
> 2013-12-05 07:30:00+08
> (1 row)
It's intentional that those don't give the same result. Adding days
is DST-aware, adding seconds is not. Since the epoch in that zone
was
# select 'epoch'::pg_catalog.timestamptz;
timestamptz
---------------------------
1970-01-01 07:30:00+07:30
(1 row)
adding any number of days to it will produce 07:30 local time on
the selected day, even though the zone offset changes.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Francisco Olarte | 2014-02-18 16:58:16 | Re: BUG #9265: why the same interval can't get the same timestamp? |
Previous Message | Vik Fearing | 2014-02-18 14:24:24 | Re: BUG #9265: why the same interval can't get the same timestamp? |