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 CAKFQuwZgNKvb4Oref9n6aUywqne-BrH+RHDFW9ZN0c+t2uuDtA@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>)
Список pgsql-hackers
On Wed, Jul 9, 2025 at 12:11 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Wed, Jul 9, 2025 at 9:15 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> TBH, I find this proposal to be useless nannyism.

> Isn't preventing a dump-restore hazard sufficient reason to do this?

No, I don't think so.  If you're not being very careful about revising
functions used in indexes, you are going to have problems a lot sooner
than some future dump/restore cycle.


Then probably this patch can just update the create index documentation to say "create or replace it" instead of just "create it".  The fact that during 'update' (replace) existing non-implied settings can be replaced with implied ones is a beginner/inattentive foot-gun.  We do make the point clearly in create function but it seems worthwhile to reinforce it here too.

"To use a user-defined function in an index expression or WHERE clause, remember to mark the function immutable when you create [or replace] it."

David J.

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