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

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Why extract( ... from timestamp ) is not immutable?
Date: 2012-01-25 16:57:50
Message-ID: 20120125165750.GA28055@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Wed, Jan 25, 2012 at 08:54:44AM -0800, Adrian Klaver wrote:
> > Personally, I think that extract(epoch from timestamp) should assume
> > that the timestamp is UTC.
>
> What if it isn't?

then you can always correct it with "at time zone 'some specific time
zone'"

but you can't correct it the other way.

> > Or that there should be a way to do it - by "it" i mean - extract epoch
> > value from timestamp value in immutable way.
>
> Have a timezone value on the timestamp. If the data you are working with is
> stored as timestamp with time zone then the timestamps represent a point in
> time.

I do have. But you can't have index on epoch from timestamptz.
and while you can have iundex on epoch from timestamp, it is not
correct.

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 Greg Sabino Mullane 2012-01-25 17:38:44 Re: Logging access to data in database table
Previous Message Adrian Klaver 2012-01-25 16:54:44 Re: Why extract( ... from timestamp ) is not immutable?

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2012-01-25 17:00:37 Re: some longer, larger pgbench tests with various performance-related patches
Previous Message Robert Haas 2012-01-25 16:57:22 Re: [v9.2] sepgsql's DROP Permission checks