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

From Josh Berkus
Subject Re: [GENERAL] Why extract( ... from timestamp ) is not immutable?
Date
Msg-id 4F26E2E9.50802@agliodbs.com
Whole thread Raw
In response to Re: [GENERAL] Why extract( ... from timestamp ) is not immutable?  (hubert depesz lubaczewski <depesz@depesz.com>)
Responses Re: [GENERAL] Why extract( ... from timestamp ) is not immutable?  (hubert depesz lubaczewski <depesz@depesz.com>)
List pgsql-hackers
> 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.

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

Well, to_epoch, in order to be consistent with other conversion functions.

-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com


pgsql-hackers by date:

Previous
From: Gilles Darold
Date:
Subject: Patch pg_is_in_backup()
Next
From: hubert depesz lubaczewski
Date:
Subject: Re: [GENERAL] Why extract( ... from timestamp ) is not immutable?