Re: Why extract( ... from timestamp ) is not immutable? - Mailing list pgsql-general

From Tom Lane
Subject Re: Why extract( ... from timestamp ) is not immutable?
Date
Msg-id 28063.1327505747@sss.pgh.pa.us
Whole thread Raw
In response to Why extract( ... from timestamp ) is not immutable?  (hubert depesz lubaczewski <depesz@depesz.com>)
Responses Re: Why extract( ... from timestamp ) is not immutable?
List pgsql-general
hubert depesz lubaczewski <depesz@depesz.com> writes:
> Why aren't the 3rd date_parts the same in both cases? I mean - I see that they
> are adjusted due to timezone, but why is it happening?

Given a timestamp without time zone, timestamp_part('epoch') assumes
that it is in session timezone, and rotates it back to UTC so as to
satisfy the expectation that epoch values start from zero at midnight
UTC.  In short, the calculation you're showing does the zone correction
an extra time.  Don't do that.

            regards, tom lane

pgsql-general by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Why extract( ... from timestamp ) is not immutable?
Next
From: hubert depesz lubaczewski
Date:
Subject: Re: Why extract( ... from timestamp ) is not immutable?