]> granicus.if.org Git - postgresql/commit
Doc: note that statement-level view triggers require an INSTEAD OF trigger.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 18 Mar 2018 19:10:28 +0000 (15:10 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 18 Mar 2018 19:10:28 +0000 (15:10 -0400)
commitff301166a9a6f23527277b89495ce56973a409f3
treeab94f938fe0985308c1e05f7fe3a7399a9461fe2
parente7d3a37d9936f725807b4d5cdf471123a4805ef1
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
doc/src/sgml/ref/create_trigger.sgml
doc/src/sgml/trigger.sgml