Re: date_trunc'd timestamp index possible?
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: "D. Duccini" <duccini@backpack.com>
Cc: Bruno Wolff III <bruno@wolff.to>, pgsql-sql@postgresql.org, Pgsql-novice <pgsql-novice@postgresql.org>
Date: 2004-10-01T21:17:28Z
Lists: pgsql-hackers, pgsql-novice, 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