Re: Does 'instead of delete' trigger support modification of OLD - Mailing list pgsql-hackers

From Eugen Konkov
Subject Re: Does 'instead of delete' trigger support modification of OLD
Date
Msg-id 471116573.20191204133757@yandex.ru
Whole thread Raw
In response to Re: Does 'instead of delete' trigger support modification of OLD  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Does 'instead of delete' trigger support modification of OLD
Re: Does 'instead of delete' trigger support modification of OLD
List pgsql-hackers
Hi again.

> Thinking some more on this, I now don't think a TODO makes sense, so I
> have removed it.

Please look into this example: https://dbfiddle.uk/?rdbms=postgres_12&fiddle=95ed9fab6870d7c4b6266ea4d93def13
This is real life code from our production.

You  can  see that this is important to get correct info about deleted
data

    -- EXPECTED app_period: ["2018-08-20", "2018-08-25")
    -- ACTUAL   app_period: ["2018-08-14", )

> Triggers are designed to check and modify input data, and since DELETE
> has no input data, it makes no sense.

Please   put   back   into   TODO  list this feature  request to allow
triggers to modify output data.

INPUT     -- receives data                         OK (behavior is expected)
UPDATE  -- receives and returns data     OK (behavior is expected)
DELETE  -- returns data                           FAIL (behavior is not expected)

This  is  inconsistent  to  allow  modify  output  data for UPDATE and
restrict to do this for DELETE


Thank you

-- 
Best regards,
Eugen Konkov




pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: could not stat promote trigger file leads to shutdown
Next
From: Eugen Konkov
Date:
Subject: Re: Does 'instead of delete' trigger support modification of OLD