miaoyimin@huawei.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