Skip to content

Commit ede54f3

Browse files
committed
Add documentation about the behavior of BEFORE triggers and referential
integrity actions. Stephan Szabo
1 parent 9c9b944 commit ede54f3

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

doc/src/sgml/ref/create_trigger.sgml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/create_trigger.sgml,v 1.42 2005/11/01 21:09:50 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/create_trigger.sgml,v 1.43 2005/12/09 19:39:41 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -241,13 +241,25 @@ CREATE TRIGGER <replaceable class="PARAMETER">name</replaceable> { BEFORE | AFTE
241241
function that executes the desired commands.
242242
</para>
243243
</listitem>
244+
244245
</itemizedlist>
245246
</para>
246247

247248
<para>
248249
SQL specifies that multiple triggers should be fired in
249250
time-of-creation order. <productname>PostgreSQL</productname> uses
250-
name order, which was judged more convenient to work with.
251+
name order, which was judged to be more convenient.
252+
</para>
253+
254+
<para>
255+
SQL specifies that <literal>BEFORE DELETE</literal> triggers on cascaded
256+
deletes fire <emphasis>after</> the cascaded <literal>DELETE</> completes.
257+
The <productname>PostgreSQL</productname> behavior is for <literal>BEFORE
258+
DELETE</literal> to always fire before the delete action, even a cascading
259+
one. This is considered more consistent. There is also unpredictable
260+
behavior when <literal>BEFORE</literal> triggers modify rows that are later
261+
to be modified by referential actions. This can lead to contraint violations
262+
or stored data that does not honor the referential constraint.
251263
</para>
252264

253265
<para>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy