Hi Zsolt,
Thanks for your patches. I have some thoughts.
1. For 003, a SET LOGGED that fails the foreign key check rewrites
the table first. I think it will create too much overhead.
I did a experiment on a 270MB table and your patch writes 310MB wal.
Master only writes 88bytes.
2. For 004, this seems already captured in a different bug[1], I think the
current patch is to reject access to the table from the trigger.
If that goes in, would 0004 still be needed?
[1]https://postgr.es/m/29523cc1.253e7.1a080818743.Coremail.njuptlgq@163.com
Thanks,