Allow INSTEAD OF DELETE triggers to modify the tuple for RETURNING

Поиск
Список
Период
Сортировка
От Marko Tiikkaja
Тема Allow INSTEAD OF DELETE triggers to modify the tuple for RETURNING
Дата
Msg-id daae5c37-64ef-21cb-ad73-72bf842a2b68@joh.to
обсуждение исходный текст
Ответы Re: [HACKERS] Allow INSTEAD OF DELETE triggers to modify the tuple for RETURNING  (Marko Tiikkaja <marko@joh.to>)
Список pgsql-hackers
Hi,

Currently the tuple returned by INSTEAD OF triggers on DELETEs is only
used to determine whether to pretend that the DELETE happened or not,
which is often not helpful enough; for example, the actual tuple might
have been concurrently UPDATEd by another transaction and one or more of
the columns now hold values different from those in the planSlot tuple.
Attached is an example case which is impossible to properly implement
under the current behavior.  For what it's worth, the current behavior
seems to be an accident; before INSTEAD OF triggers either the tuple was
already locked (in case of BEFORE triggers) or the actual pre-DELETE
version of the tuple was fetched from the heap.

So I'm suggesting to change this behavior and allow INSTEAD OF DELETE
triggers to modify the OLD tuple and use that for RETURNING instead of
returning the tuple in planSlot.  Attached is a WIP patch implementing that.

Is there any reason why we wouldn't want to change the current behavior?


.m

Вложения

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: primary_conninfo missing from pg_stat_wal_receiver
Следующее
От: Andreas Karlsson
Дата:
Сообщение: Re: OpenSSL 1.1 breaks configure and more