pgsql: Doc: note that statement-level view triggers require an INSTEAD

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Doc: note that statement-level view triggers require an INSTEAD
Date: 2018-03-18 19:10:54
Message-ID: E1exdhm-0003Mu-69@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Doc: note that statement-level view triggers require an INSTEAD OF trigger.

If a view lacks an INSTEAD OF trigger, DML on it can only work by rewriting
the command into a command on the underlying base table(s). Then we will
fire triggers attached to those table(s), not those for the view. This
seems appropriate from a consistency standpoint, but nowhere was the
behavior explicitly documented, so let's do that.

There was some discussion of throwing an error or warning if a statement
trigger is created on a view without creating a row INSTEAD OF trigger.
But a simple implementation of that would result in dump/restore ordering
hazards. Given that it's been like this all along, and we hadn't heard
a complaint till now, a documentation improvement seems sufficient.

Per bug #15106 from Pu Qun. Back-patch to all supported branches.

Discussion: https://postgr.es/m/152083391168.1215.16892140713507052796@wrigleys.postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a4678320471380e5159a8d6e89466d74d6ee1739

Modified Files
--------------
doc/src/sgml/ref/create_trigger.sgml | 13 +++++++++++++
doc/src/sgml/trigger.sgml | 12 +++++++++---
2 files changed, 22 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2018-03-19 08:15:16 Re: pgsql: Add tests for reinit.c
Previous Message Magnus Hagander 2018-03-18 12:13:53 pgsql: Fix pg_recvlogical for pre-10 versions