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: 2020-01-17 10:14:03
Message-ID: 15010033764.20200117121403@yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers

Hello Bruce,

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

Sorry, I am still ambiguous. You say that DELETE has no input data,
but doc says that it has:

https://www.postgresql.org/docs/current/trigger-definition.html
For a row-level trigger, the input data also includes ... the OLD row for ... DELETE triggers

Also restricting DELETE to change the returned data by DELETE
RETURNING seems as incomplete.

For example if triggers implement some compression.
-- insert into field ZZZZZ value
-- compress and actually store Zx5 into field
-- Delete this insert row
-- So user should get back that the value ZZZZZ was deleted and not Zx5.
Correct?

but currently user will see Zx5, because next code:

OLD.value = uncompress( OLD.value );

does not effect RETURNING =(

--
Best regards,
Eugen Konkov

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Bruce Momjian 2020-01-17 22:39:34 Re: Spanish translation of postgresql manuals
Previous Message Laurenz Albe 2020-01-15 22:25:00 Re: Shrinking SVG (Again)

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2020-01-17 10:36:51 Re: PATCH: standby crashed when replay block which truncated in standby but failed to truncate in master node
Previous Message Amit Kapila 2020-01-17 09:17:44 Re: [HACKERS] Block level parallel vacuum