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

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Why extract( ... from timestamp ) is not immutable?
Date: 2012-01-30 17:28:59
Message-ID: 20120130172859.GB8109@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Wed, Jan 25, 2012 at 11:30:49AM -0500, Tom Lane wrote:
> hubert depesz lubaczewski <depesz(at)depesz(dot)com> writes:
> > anyway - the point is that in \df date_part(, timestamp) says it's
> > immutable, while it is not.
>
> Hmm, you're right. I thought we'd fixed that way back when, but
> obviously not. Or maybe the current behavior of the epoch case
> postdates that.

is there a chance something will happen with/about it?

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:

get_epoch(timestamptz) would be immutable
while
get_epoch(timestamp) would be stable

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 Adrian Klaver 2012-01-30 17:43:46 Re: pg_dump -s dumps data?!
Previous Message hubert depesz lubaczewski 2012-01-30 17:23:15 Re: pg_dump -s dumps data?!

Browse pgsql-hackers by date

  From Date Subject
Next Message Adrian Klaver 2012-01-30 17:43:46 Re: pg_dump -s dumps data?!
Previous Message Robert Haas 2012-01-30 17:28:46 Re: Simulating Clog Contention