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

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [GENERAL] Why extract( ... from timestamp ) is not immutable?
Date: 2012-01-30 18:53:51
Message-ID: 20120130185351.GA21624@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general 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/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tulio 2012-01-30 18:55:11 parameter "vacuum_defer_cleanup_age"
Previous Message Josh Berkus 2012-01-30 18:35:21 Re: [GENERAL] Why extract( ... from timestamp ) is not immutable?

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2012-01-30 19:55:07 Re: Group commit, revised
Previous Message Josh Berkus 2012-01-30 18:35:21 Re: [GENERAL] Why extract( ... from timestamp ) is not immutable?