Re: Check-out mutable functions in check constraints

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: Check-out mutable functions in check constraints
Дата
Msg-id
14835.1562975953@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
Check-out mutable functions in check constraints Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Re: Check-out mutable functions in check constraints Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: Check-out mutable functions in check constraints Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Re: Check-out mutable functions in check constraints Pavel Stehule <pavel.stehule@gmail.com>
Re: Check-out mutable functions in check constraints Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: Check-out mutable functions in check constraints Pavel Stehule <pavel.stehule@gmail.com>
Re: Check-out mutable functions in check constraints Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: Check-out mutable functions in check constraints Tom Lane <tgl@sss.pgh.pa.us>
Re: Check-out mutable functions in check constraints Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: Check-out mutable functions in check constraints Tom Lane <tgl@sss.pgh.pa.us>
Re: Check-out mutable functions in check constraints Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Re: Check-out mutable functions in check constraints Robert Haas <robertmhaas@gmail.com>
Tomas Vondra  writes:
> On Fri, Jul 12, 2019 at 02:00:25PM +0200, Pavel Stehule wrote:
>>> Mutable function are allowed in check constraint expressions but
>>> it is not right. The attached is a proposed fix for it including
>>> regression test.

> Yes, and the question is whether this is the right thing to do (I think
> it probably is).

I'm pretty sure this change has been proposed before, and rejected before.
Has anybody excavated in the archives for prior discussions?

> OTOH, even if we prohibit mutable functions in check constraints, people
> can still create triggers doing those checks (and shoot themselves in
> the foot that way).

There are, and always will be, lots of ways to shoot yourself in the foot.
In the case at hand, I fear we might just encourage people to mark
functions as immutable when they really aren't --- which will make their
problems *worse* not better, because now other uses besides check
constraints will also be at risk of misoptimization.

			regards, tom lane


В списке pgsql-hackers по дате отправления
От: Tomas Vondra
Дата:
От: Tomas Vondra
Дата:
FAQ