On Thu, Nov 7, 2019 at 04:26:55PM -0500, Bruce Momjian wrote:
> On Thu, Nov 7, 2019 at 11:24:29AM +0200, Eugen Konkov wrote:
> > >> As far as allowing DELETE to modify the trigger row for RETURNING, I am
> > >> not sure how much work it would take to allow that, but it seems like it
> > >> is a valid requite, and if so, I can add it to the TODO list.
> >
> > > Yes, Add please into TODO the feature to "allowing DELETE to modify the trigger row
> > > for RETURNING". Becuase, as I have described at first letter, without
> > > this the RETURNING rows **does not correspond actually deleted data**
> >
> > > Thank you.
>
> I have added a TODO item:
>
> Allow DELETE triggers to modify rows, for use by RETURNING
Thinking some more on this, I now don't think a TODO makes sense, so I
have removed it.
Triggers are designed to check and modify input data, and since DELETE
has no input data, it makes no sense. In the attached SQL script, you
can see that only the BEFORE INSERT trigger fires, so there is no way
even with INSERT to change what is passed after the write to RETURNING.
What you can do is to modify the returning expression, which is what I
have done for the last query --- hopefully that will help you.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +