pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bruno Wolff III <bruno@wolff.to>
Cc: D. Duccini <duccini@backpack.com>
Cc: pgsql-sql@postgresql.org, Pgsql-novice <pgsql-novice@postgresql.org>
Subject: Re: [SQL] date_trunc'd timestamp index possible?
Date: Fri, 01 Oct 2004 14:49:34 -0400
Message-ID: <13492.1096656574@sss.pgh.pa.us> (raw)
In-Reply-To: <20041001182830.GA20624@wolff.to>
References: <web-1583353@davinci.ethosmedia.com>
	<Pine.GSO.4.10.10409271910480.22691-100000@solarwind>
	<20041001182830.GA20624@wolff.to>

Bruno Wolff III <bruno@wolff.to> writes:
> I am not sure how to check if the supplied function for converting
> a timestamp with time zone to a timestamp without timezone using a
> specified time zone is immutable. I think this function should be
> immutable, but that it probably isn't.

Yup.  In 7.4:

regression=# select provolatile from pg_proc where oid = 'timezone(text,timestamptz)'::regprocedure;
 provolatile
-------------
 s
(1 row)

regression=#

This is a thinko that's already been corrected for 8.0:

regression=# select provolatile from pg_proc where oid = 'timezone(text,timestamptz)'::regprocedure;
 provolatile
-------------
 i
(1 row)

regression=#

If you wanted you could just UPDATE pg_proc to correct this mistake.
Another possibility is to create a function that's an IMMUTABLE
wrapper around the standard function.

Looking at this, I realize that date_trunc() is mismarked: the
timestamptz variant is strongly dependent on the timezone setting
and so should be STABLE not IMMUTABLE.  Ooops.

			regards, tom lane



view thread (6+ messages)  latest in thread

Message-ID: <13492.1096656574@sss.pgh.pa.us>
Permalink:  ../13492.1096656574@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/13492.1096656574@sss.pgh.pa.us

 · 

reply

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, bruno@wolff.to, duccini@backpack.com, pgsql-novice@postgresql.org
  Subject: Re: [SQL] date_trunc'd timestamp index possible?
  In-Reply-To: <13492.1096656574@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