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 15010033764.20200117121403@yandex.ru
Whole thread Raw
In response to Re: Does 'instead of delete' trigger support modification of OLD  (Bruce Momjian <bruce@momjian.us>)
List 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




pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: [HACKERS] Block level parallel vacuum
Next
From: Fujii Masao
Date:
Subject: Re: PATCH: standby crashed when replay block which truncated instandby but failed to truncate in master node