1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Fire per-statement triggers on partitioned tables.

Even though no actual tuples are ever inserted into a partitioned
table (the actual tuples are in the partitions, not the partitioned
table itself), we still need to have a ResultRelInfo for the
partitioned table, or per-statement triggers won't get fired.

Amit Langote, per a report from Rajkumar Raghuwanshi.  Reviewed by me.

Discussion: http://postgr.es/m/CAKcux6%3DwYospCRY2J4XEFuVy0L41S%3Dfic7rmkbsU-GXhhSbmBg%40mail.gmail.com
This commit is contained in:
Robert Haas
2017-05-01 08:23:01 -04:00
parent e18b2c480d
commit e180c8aa8c
14 changed files with 296 additions and 27 deletions

View File

@ -33,7 +33,8 @@
<para>
A trigger is a specification that the database should automatically
execute a particular function whenever a certain type of operation is
performed. Triggers can be attached to tables, views, and foreign tables.
performed. Triggers can be attached to tables (partitioned or not),
views, and foreign tables.
</para>
<para>
@ -111,14 +112,14 @@
Statement-level <literal>BEFORE</> triggers naturally fire before the
statement starts to do anything, while statement-level <literal>AFTER</>
triggers fire at the very end of the statement. These types of
triggers may be defined on tables or views. Row-level <literal>BEFORE</>
triggers fire immediately before a particular row is operated on,
while row-level <literal>AFTER</> triggers fire at the end of the
statement (but before any statement-level <literal>AFTER</> triggers).
These types of triggers may only be defined on tables and foreign tables.
Row-level <literal>INSTEAD OF</> triggers may only be defined on views,
and fire immediately as each row in the view is identified as needing to
be operated on.
triggers may be defined on tables, views, or foreign tables. Row-level
<literal>BEFORE</> triggers fire immediately before a particular row is
operated on, while row-level <literal>AFTER</> triggers fire at the end of
the statement (but before any statement-level <literal>AFTER</> triggers).
These types of triggers may only be defined on non-partitioned tables and
foreign tables. Row-level <literal>INSTEAD OF</> triggers may only be
defined on views, and fire immediately as each row in the view is
identified as needing to be operated on.
</para>
<para>