From: Tom Lane <tgl@sss.pgh.pa.us>
To: D. Duccini <duccini@backpack.com>
Cc: Bruno Wolff III <bruno@wolff.to>
Cc: pgsql-sql@postgresql.org, Pgsql-novice <pgsql-novice@postgresql.org>
Subject: Re: date_trunc'd timestamp index possible?
Date: Fri, 01 Oct 2004 17:17:28 -0400
Message-ID: <15053.1096665448@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.GSO.4.10.10410011327580.26562-100000@solarwind>
References: <Pine.GSO.4.10.10410011327580.26562-100000@solarwind>
"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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, duccini@backpack.com, bruno@wolff.to, pgsql-novice@postgresql.org
Subject: Re: date_trunc'd timestamp index possible?
In-Reply-To: <15053.1096665448@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox