On Wed, Jul 9, 2025 at 9:15 AM Tom Lane <t...@sss.pgh.pa.us> wrote:
> "=?utf-8?B?c3VuZGF5amlhbmco6JKL5rWp5aSpKQ==?=" <sundayji...@tencent.com> > writes: > > > The purpose of this patch is to prevent replacing a function via > `CREATE OR REPLACE FUNCTION` with a new definition that is not marked as > `IMMUTABLE`, if the existing function is referenced by an index expression. > > > > > > Replacing such functions may lead to index corruption or runtime > semantic inconsistencies, especially when the function’s output is not > stable for the same input. > > > TBH, I find this proposal to be useless nannyism. Replacing a > function that is used in an index is problematic if you change its > behavior (that is, its actual output for given inputs) in any way. > Whether it's marked IMMUTABLE is a very minor side point. > Isn't preventing a dump-restore hazard sufficient reason to do this? The now-volatile function will be dumped as such and the create index during the restore will fail because of that. David J.