Re: 回复:[Internet]Re: [PATCH] Prevent replacement of a function if it's used in an index expression and is not IMMUTABLE

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: 回复:[Internet]Re: [PATCH] Prevent replacement of a function if it's used in an index expression and is not IMMUTABLE
Дата
Msg-id CAKFQuwZD+V-9Tm8OD2Zx6hgvU=f8aQ+xjaD7EhP7OLvc=ZF8BQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: 回复:[Internet]Re: [PATCH] Prevent replacement of a function if it's used in an index expression and is not IMMUTABLE  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: 回复:[Internet]Re: [PATCH] Prevent replacement of a function if it's used in an index expression and is not IMMUTABLE
Список pgsql-hackers
On Wed, Jul 9, 2025 at 9:15 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
"sundayjiang(蒋浩天)" <sundayjiang@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.

В списке pgsql-hackers по дате отправления: