Re: [NOVICE] date_trunc'd timestamp index possible? - Mailing list pgsql-sql

From Tom Lane
Subject Re: [NOVICE] date_trunc'd timestamp index possible?
Date
Msg-id 15053.1096665448@sss.pgh.pa.us
Whole thread Raw
List pgsql-sql
"D. Duccini" <duccini@backpack.com> writes:
> I think we found a way around it!

> CREATE OR REPLACE FUNCTION date_immutable( timestamptz ) RETURNS date AS
> 'SELECT date( $1 ) ;' LANGUAGE 'sql' IMMUTABLE ;

No, you just found a way to corrupt your index.  Pretending that
date(timestamptz) is immutable does not make it so.  The above
*will* break the first time someone uses the table with a different
timezone setting.

What you can do safely is date(footime AT TIME ZONE 'something'),
since this nails down the zone in which the date is interpreted.

            regards, tom lane

pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: [NOVICE] date_trunc'd timestamp index possible?
Next
From: Dag Gullberg
Date:
Subject: Concurrency problem