Subject: 36.3 Writing Tigger Functions in C

From: Dmitry Igrishin <[email-masked]>
Date: Tue, 11 Aug 2015 13:47:22 +0300

Subparagparh 3:
I suggest to replace:
"but it is passed a "context" pointer pointing to a TriggerData
structure"
with
"but it is passed a "context" pointer to a structure of type
TriggerData"

tg_trigtuple:
I'm not sure why "skip the operation" is here:
"if you don't want to replace the row with a different one (in the
case of INSERT) or skip the operation"

tg_newtuple:
I'm not sure why "skip the operation" is here:
"and you don't want to replace this row by a different one or
skip the operation"

and I suggest to replace:
"and you don't want to replace this row by a different one"
with
"and you don't want to replace the row with a different one"
anyway.

-- 
// Dmitry.

---

From: Dmitry Igrishin <[email-masked]>
Date: Tue, 11 Aug 2015 14:20:32 +0300

> "but it is passed a "context" pointer to a structure of type
Oops, it's even better to replace with
"but it is passed a "context" pointer", because the need of
use CALLED_AS_TRIGGER macro described hereinafter.

-- 
// Dmitry.

---

From: Marko Tiikkaja <[email-masked]>
Date: Tue, 11 Aug 2015 13:32:25 +0200

> case of INSERT) or skip the operation"

Returning NULL from a row-level BEFORE trigger skips the operation which 
fired the trigger.  So for an INSERT, any triggers which would otherwise 
fire after the current trigger are not fired, and the row is not 
INSERTed into the table.

.m

-- 
Sent via pgsql-docs mailing list ([email-masked])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs

---

From: Dmitry Igrishin <[email-masked]>
Date: Tue, 11 Aug 2015 14:51:28 +0300

2015-08-11 14:32 GMT+03:00 Marko Tiikkaja <[email-masked]>:

> fire after the current trigger are not fired, and the row is not INSERTed
> into the table.

Yes, but it's absolutely unclear in this place of the documentation.
Thus,
"If this trigger was fired for an INSERT or DELETE then this is what you
should return from the function if you don't want to replace the row with a
different one (in the case of INSERT) or skip the operation."
should be replaced with something like
"If this trigger was fired for an INSERT or DELETE then this is what you
should return from the function if you don't want to replace the row with a
different one (in the case of INSERT). (To skip the operation you should
return NULL.)" ?

-- 
// Dmitry.