Re: [GENERAL] Why extract( ... from timestamp ) is not immutable? - Mailing list pgsql-hackers

From hubert depesz lubaczewski
Subject Re: [GENERAL] Why extract( ... from timestamp ) is not immutable?
Date
Msg-id 20120130185351.GA21624@depesz.com
Whole thread Raw
In response to Re: [GENERAL] Why extract( ... from timestamp ) is not immutable?  (Josh Berkus <josh@agliodbs.com>)
Responses Re: [GENERAL] Why extract( ... from timestamp ) is not immutable?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, Jan 30, 2012 at 10:35:21AM -0800, Josh Berkus wrote:
> 
> > preferably I would see extract( epoch from timestamp ) to be really
> > immutable, i.e. (in my opinion) it should treat incoming data as UTC
> > - for epoch calculation.
> > Alternatively - perhaps epoch extraction should be moved to specialized
> > function, which would have swapped mutability:
> 
> We can't have functions which are immutable or not depending on their
> inputs.  That way lies madness.

but this is exactly what's happening now.
extract( ... from timestamp) is marked as immutable, while in some cases
(namely when you want epoch) it should be stable because the return from
function changes.

Best regards,

depesz

-- 
The best thing about modern society is how easy it is to avoid contact with it.
                  http://depesz.com/
 


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: [GENERAL] Why extract( ... from timestamp ) is not immutable?
Next
From: Simon Riggs
Date:
Subject: Re: Group commit, revised