Re: Bug / Unintentional Feature: non-immutable functions can be used for generated columns.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Bug / Unintentional Feature: non-immutable functions can be used for generated columns.
Дата
Msg-id 1028095.1664665480@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Bug / Unintentional Feature: non-immutable functions can be used for generated columns.  (Shane Plesner <gebnar@gmail.com>)
Список pgsql-bugs
Shane Plesner <gebnar@gmail.com> writes:
> It seems to me that any time a function is replaced, there could be a check
> to see if it was changed from immutable to mutable. If it was, check the
> schema for any references to that function that require immutable function
> calls, and raise an exception.
> Is there something I'm missing that makes this unfeasible?

Cost, added maintenance burden, race conditions.

Also, just complaining about dropping the immutability flag seems
rather pointless.  If you redefine the function in a way that changes its
results, but continue to mark it immutable, you've still broken a lot
of situations (e.g., expression indexes that depend on the function's
results).  If memory serves, we've actually discussed refusing any
alterations at all of an "immutable" function once it's defined.
But that's still not much help, because we can't usefully verify that
an "immutable" function's behavior actually is immutable.  In the end
it's on the user to preserve its behavior, or do appropriate cleanup
(such as reindexing) after a change.

            regards, tom lane



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

Предыдущее
От: Jeff Janes
Дата:
Сообщение: Re: pg ignores wal files in pg_wal, and instead tries to load them from archive/primary
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: v15rc1 shadowbuild fails when using src from symlink