From 86f575948c773b0ec5b0f27066e37dd93a7f0a96 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Fri, 23 Mar 2018 10:48:22 -0300 Subject: Allow FOR EACH ROW triggers on partitioned tables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, FOR EACH ROW triggers were not allowed in partitioned tables. Now we allow AFTER triggers on them, and on trigger creation we cascade to create an identical trigger in each partition. We also clone the triggers to each partition that is created or attached later. This means that deferred unique keys are allowed on partitioned tables, too. Author: Álvaro Herrera Reviewed-by: Peter Eisentraut, Simon Riggs, Amit Langote, Robert Haas, Thomas Munro Discussion: https://postgr.es/m/20171229225319.ajltgss2ojkfd3kp@alvherre.pgsql --- doc/src/sgml/catalogs.sgml | 8 ++++++++ doc/src/sgml/ref/create_trigger.sgml | 7 +++++++ 2 files changed, 15 insertions(+) (limited to 'doc/src') diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index c030cdab4be..95a5b113b98 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -2254,6 +2254,14 @@ SCRAM-SHA-256$<iteration count>:&l key, foreign key, or exclusion constraint; else 0 + + conparentid + oid + pg_constraint.oid + The corresponding constraint in the parent partitioned table, + if this is a constraint in a partition; else 0 + + confrelid oid diff --git a/doc/src/sgml/ref/create_trigger.sgml b/doc/src/sgml/ref/create_trigger.sgml index 784ed5b8e02..7b971ee6b43 100644 --- a/doc/src/sgml/ref/create_trigger.sgml +++ b/doc/src/sgml/ref/create_trigger.sgml @@ -512,6 +512,13 @@ UPDATE OF column_name1 [, column_name2 + + Creating a row-level trigger on a partitioned table will cause identical + triggers to be created in all its existing partitions; and any partitions + created or attached later will contain an identical trigger, too. + Triggers on partitioned tables may only be AFTER. + + Modifying a partitioned table or a table with inheritance children fires statement-level triggers attached to the explicitly named table, but not -- cgit v1.2.3