Re: Why extract( ... from timestamp ) is not immutable?

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Why extract( ... from timestamp ) is not immutable?
Date: 2012-02-06 11:13:08
Message-ID: jgock4$l1j$7@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On 2012-01-25, hubert depesz lubaczewski <depesz(at)depesz(dot)com> wrote:
> On Wed, Jan 25, 2012 at 02:07:40PM -0800, Adrian Klaver wrote:
>> Finally dawned on me. When you use 'at time zone' on a timestamp
>> with tz it strips the tz which then allows the value to be indexed
>> because:
>>
>> -[ RECORD 5 ]-------+-------------------------------------------------------------------------
>> Schema | pg_catalog
>> Name | date_part
>> Result data type | double precision
>> Argument data types | text, timestamp without time zone
>> Type | normal
>> Volatility | immutable
>> Owner | postgres
>> Language | internal
>> Source code | timestamp_part
>> Description | extract field from timestamp
>
> yes, but it is not correct - the value is actually stable, and not
> immutable.

it's immutable for all date parts except "epoch".

epoch is backwards to the other date parts.
immutable for timestamptz and stable for timestamp

--
⚂⚃ 100% natural

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jasen Betts 2012-02-06 11:14:30 Re: Why extract( ... from timestamp ) is not immutable?
Previous Message Misa Simic 2012-02-06 10:40:10 Re: Triggering a function on table overwrite

Browse pgsql-hackers by date

  From Date Subject
Next Message Jasen Betts 2012-02-06 11:14:30 Re: Why extract( ... from timestamp ) is not immutable?
Previous Message Fujii Masao 2012-02-06 11:08:15 Re: double writes using "double-write buffer" approach [WIP]