Re: Does 'instead of delete' trigger support modification of OLD

From: Eugen Konkov <kes-kes(at)yandex(dot)ru>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: Does 'instead of delete' trigger support modification of OLD
Date: 2019-12-04 11:37:57
Message-ID: 471116573.20191204133757@yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs 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

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Eugen Konkov 2019-12-04 11:39:43 Re: Does 'instead of delete' trigger support modification of OLD
Previous Message James Salsman 2019-12-04 11:29:55 Re: monitoring-stats.html is too impenetrable

Browse pgsql-hackers by date

  From Date Subject
Next Message Eugen Konkov 2019-12-04 11:39:43 Re: Does 'instead of delete' trigger support modification of OLD
Previous Message Peter Eisentraut 2019-12-04 10:52:33 Re: could not stat promote trigger file leads to shutdown