Re: UPDATE SET (a,b,c) = (SELECT ...) versus rules
| От | Tom Lane |
|---|---|
| Тема | Re: UPDATE SET (a,b,c) = (SELECT ...) versus rules |
| Дата | |
| Msg-id | 10919.1402778650@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: UPDATE SET (a,b,c) = (SELECT ...) versus rules (Andres Freund <andres@2ndquadrant.com>) |
| Ответы |
Re: UPDATE SET (a,b,c) = (SELECT ...) versus rules
|
| Список | pgsql-hackers |
Andres Freund <andres@2ndquadrant.com> writes:
> On 2014-06-14 15:48:52 -0400, Tom Lane wrote:
>> Well, it wouldn't be "unsafe" (barring volatile functions in the UPDATE,
>> which are unsafe already). It might be slow, but that's probably better
>> than failing.
> I forgot the details, but IIRC it's possible to write a ON UPDATE ...
> DO INSTEAD rule that's safe wrt multiple evaluations today by calling a
> function passing in the old pkey and NEW. At least I believed so at some
> point in the past :P
Hm. But you might as well use a trigger, no? Is anyone likely to
actually be doing such a thing?
It's conceivable that we could optimize the special case of NEW.*,
especially if it appears in the rule query's targetlist. But it's
trouble I don't really care to undertake ...
regards, tom lane
В списке pgsql-hackers по дате отправления: