Re: Expression indexes and dependecies

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Expression indexes and dependecies
Date: 2013-07-22 23:21:35
Message-ID: 28815.1374535295@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)2ndquadrant(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-07-22 23:32:20 Re: small typo in src/backend/access/transam/xlog.c
Previous Message Andres Freund 2013-07-22 23:18:58 Re: [COMMITTERS] pgsql: Add support for REFRESH MATERIALIZED VIEW CONCURRENTLY.