Re: function side effects - Mailing list pgsql-hackers

From Greg Stark
Subject Re: function side effects
Date
Msg-id 407d949e1002231018r191ad206ye01561f98caf6fc@mail.gmail.com
Whole thread Raw
In response to Re: function side effects  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Responses Re: function side effects
List pgsql-hackers
On Tue, Feb 23, 2010 at 4:52 PM, Kevin Grittner
<Kevin.Grittner@wicourts.gov> wrote:
> Right, we all know it currently doesn't throw an error, but I can't
> think of anywhere I'd like to have someone do that in a database for
> which I have any responsibility.  Does anyone have a sane use case
> for a non-volatile function to call a volatile one or to update the
> database?

So consider for example a function which explicitly sets the timezone
and then uses timestamp without timezone functions (which are volatile
only because the GUC variable might change between calls).

Or somebody who uses the tsearch functions because they're planning to
not change their dictionaries.

Or builds a hash function by calling random after setting the seed to
a specific value -- this is actually a fairly popular strategy for
building good hash functions.

--
greg


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [PATCH] 8.5 TODO: Add comments to output indicating version of pg_dump and of the database server
Next
From: Robert Haas
Date:
Subject: Re: [PATCH] backend: compare word-at-a-time in bcTruelen