Re: Expression indexes and dependecies - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Expression indexes and dependecies
Date
Msg-id 28815.1374535295@sss.pgh.pa.us
Whole thread Raw
In response to Re: Expression indexes and dependecies  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: Expression indexes and dependecies
List pgsql-hackers
Andres Freund <andres@2ndquadrant.com> writes:
> On 2013-07-22 17:04:06 -0400, Alvaro Herrera wrote:
>> One way to attack this would be registering dependencies of a new kind
>> on functions used by index expressions.  Then CREATE OR REPLACE function
>> could reject alteration for such functions.  I don't know if we care
>> enough about this case.

> I think changing the results of a immutable function violates the
> contract enough to make this the user's fault. Also the other solutions
> seem hard to achieve ;)

Yeah.  Prohibiting any change at all would be a cure worse than the
disease, likely, but we don't have the tools to analyze more finely than
that.  And what if the index uses function A which calls function B,
and you change function B?

I'd be in favor of adding a note to the CREATE INDEX man page pointing
out that if you change the behavior of an immutable function, any bad
consequences for indexes are on your own head, and a REINDEX would be
advisable.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [COMMITTERS] pgsql: Add support for REFRESH MATERIALIZED VIEW CONCURRENTLY.
Next
From: Tom Lane
Date:
Subject: Re: small typo in src/backend/access/transam/xlog.c