Re: Two different methods of sneaking non-immutable data into an index - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Two different methods of sneaking non-immutable data into an index
Date
Msg-id AANLkTi=1+mak4vTEKSL=LcH9tEFgG09YDTFSJp7GFaRr@mail.gmail.com
Whole thread Raw
In response to Re: Two different methods of sneaking non-immutable data into an index  (Chris Browne <cbbrowne@acm.org>)
List pgsql-hackers
On Thu, Aug 5, 2010 at 12:59 PM, Chris Browne <cbbrowne@acm.org> wrote:
> mmoncure@gmail.com (Merlin Moncure) writes:
>> On Wed, Aug 4, 2010 at 9:31 PM, Robert Haas <robertmhaas@gmail.com> wrote:
>>> On Wed, Aug 4, 2010 at 6:43 PM, Merlin Moncure <mmoncure@gmail.com> wrote:
>>>> *) also, isn't it possible to change text cast influencing GUCs 'n'
>>>> times per statement considering any query can call a function and any
>>>> function can say, change datestyle?  Shouldn't the related functions
>>>> be marked 'volatile', not stable?
>>>
>>> This is just evil.  It seems to me that we might want to instead
>>> prevent functions from changing things for their callers, or
>>> postponing any such changes until the end of the statement, or, uh,
>>> something.  We can't afford to put ourselves in a situation of having
>>> to make everything volatile; at least, not if "performance" is
>>> anywhere in our top 50 goals.
>>
>> yeah -- perhaps you shouldn't be allowed set things like datestyle in
>> functions then.  I realize this is a corner (of the universe) case,
>> but I can't recall any other case of volatility being relaxed on
>> performance grounds... :-).  Maybe a documentation warning would
>> suffice?
>
> That would cause grief for Slony-I, methinks, and probably other things
> that behave somewhat similar.
>
> The "logtrigger()" function coerces datestyle to ISO, so that when dates
> get stored, they are stored in a canonical form, irrespective of an
> individual connection's decisions on datestyle, so we don't have to
> include datestyle information as part of the replicated data.

I think functions should be allowed to change GUCs internally, but
maybe not for the context from which they were called.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: pg_stat_user_functions' notion of user
Next
From: "Kevin Grittner"
Date:
Subject: Re: remove upsert example from docs