From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Fork <mfork@toledolink.com>
Cc: doj@wwws2.redaex.de, PostgreSQL-SQL <pgsql-sql@postgresql.org>
Subject: Re: const cast ?
Date: Sat, 03 Feb 2001 02:38:07 -0500
Message-ID: <1631.981185887@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.BSI.4.21.0102021540190.5488-100000@glass.toledolink.com>
References: <Pine.BSI.4.21.0102021540190.5488-100000@glass.toledolink.com>
Michael Fork <mfork@toledolink.com> writes:
> You can create a function with the IsCacheable attribute...
> CREATE FUNCTION my_date_part(date) RETURNS int4 AS '
> SELECT date_part('year', $1);
> ' LANGUAGE 'sql' WITH iscachable();
The reason date_part --- and most other datetime-related functions ---
is not marked iscachable already is the existence of the special value
CURRENT in some of the datetime datatypes, which makes the result of
any datetime function potentially dependent on when you execute it.
I believe we have agreed that CURRENT is evil and should be eliminated,
but it hasn't gotten done yet. See past discussions in the pghackers
archives.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, mfork@toledolink.com
Subject: Re: const cast ?
In-Reply-To: <1631.981185887@sss.pgh.pa.us>
References: <Pine.BSI.4.21.0102021540190.5488-100000@glass.toledolink.com> <1631.981185887@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