Functions used in index definitions shouldn't be changed

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Functions used in index definitions shouldn't be changed
Date: 2014-11-19 14:38:05
Message-ID: A737B7A37273E048B164557ADEF4A58B17D9FF61@ntex2010a.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Currently it is possible to change the behaviour of a function with
CREATE OR REPLACE FUNCTION even if the function is part of an index definition.

I think that should be forbidden, because it is very likely to corrupt
the index. I expect the objection that this would break valid use cases
where people know exactly what they are doing, but I believe that this
is a footgun for inexperienced users that should be disarmed.

I'd also opt for forbidding behaviour changing modifications with ALTER FUNCTION
for functions used in index definitions, specifically altering strictness.

Attached is a patch implementing a fix.

Yours,
Laurenz Albe

Attachment Content-Type Size
alter_index_function.patch application/octet-stream 4.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-11-19 14:45:30 Re: Increasing test coverage of WAL redo functions
Previous Message Robert Haas 2014-11-19 14:27:57 Re: [HACKERS] Performance issue with libpq prepared queries on 9.3 and 9.4