[PATCH] session_replication_role = replica with TRUNCATE

From: Marco Nenciarini <marco(dot)nenciarini(at)2ndquadrant(dot)it>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: [PATCH] session_replication_role = replica with TRUNCATE
Date: 2017-12-29 12:01:12
Message-ID: ff835f71-3c6c-335e-4c7b-b9e1646cf3d7@2ndquadrant.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

The current behavior of session_replication_role = replica with TRUNCATE
is not the same of with the other commands.
It does not check FKs for INSERT/UPDATE/DELETE but it does for TRUNCATE,
so one cannot execute TRUNCATE on a table when it is possible to DELETE
from table without WHERE clause.

I'm attaching a simple patch to make TRUNCATE match behavior of DELETE
for session_replication_role = replica.

Regards,
Marco

--
Marco Nenciarini - 2ndQuadrant Italy
PostgreSQL Training, Services and Support
marco(dot)nenciarini(at)2ndQuadrant(dot)it | www.2ndQuadrant.it

Attachment Content-Type Size
truncate_ignore_fks_role_replica.v1.patch text/plain 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2017-12-29 12:43:54 Re: [HACKERS] taking stdbool.h into use
Previous Message Michael Paquier 2017-12-29 11:49:15 Re: Basebackups reported as idle