pgsql: Allow FOR EACH ROW triggers on partitioned tables

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Allow FOR EACH ROW triggers on partitioned tables
Date: 2018-03-23 13:48:53
Message-ID: E1ezN3t-0005Bt-9a@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Allow FOR EACH ROW triggers on partitioned tables

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/86f575948c773b0ec5b0f27066e37dd93a7f0a96

Modified Files
--------------
doc/src/sgml/catalogs.sgml | 8 +
doc/src/sgml/ref/create_trigger.sgml | 7 +
src/backend/catalog/heap.c | 1 +
src/backend/catalog/index.c | 4 +-
src/backend/catalog/pg_constraint.c | 3 +
src/backend/commands/tablecmds.c | 150 ++++++++++++-
src/backend/commands/trigger.c | 313 +++++++++++++++++++++++---
src/backend/commands/typecmds.c | 1 +
src/backend/tcop/utility.c | 3 +-
src/include/catalog/catversion.h | 2 +-
src/include/catalog/indexing.h | 2 +
src/include/catalog/pg_constraint.h | 39 ++--
src/include/catalog/pg_constraint_fn.h | 1 +
src/include/commands/trigger.h | 5 +-
src/test/regress/expected/oidjoins.out | 8 +
src/test/regress/expected/triggers.out | 344 +++++++++++++++++++++++++++--
src/test/regress/input/constraints.source | 16 ++
src/test/regress/output/constraints.source | 26 +++
src/test/regress/sql/oidjoins.sql | 4 +
src/test/regress/sql/triggers.sql | 234 +++++++++++++++++++-
20 files changed, 1078 insertions(+), 93 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2018-03-23 14:25:04 pgsql: pg_resetwal: Prevent division-by-zero errors
Previous Message Peter Eisentraut 2018-03-23 12:43:37 pgsql: pg_resetwal: Add simple test suite