Обсуждение: Re: [NOVICE] date_trunc'd timestamp index possible?

Поиск
Список
Период
Сортировка

Re: [NOVICE] date_trunc'd timestamp index possible?

От
Tom Lane
Дата:
"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