public inbox for [email protected]help / color / mirror / Atom feed
36.3 Writing Tigger Functions in C 4+ messages / 2 participants [nested] [flat]
* 36.3 Writing Tigger Functions in C @ 2015-08-11 10:47 Dmitry Igrishin <[email protected]> 0 siblings, 2 replies; 4+ messages in thread From: Dmitry Igrishin @ 2015-08-11 10:47 UTC (permalink / raw) To: pgsql-docs 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. ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: 36.3 Writing Tigger Functions in C @ 2015-08-11 11:20 Dmitry Igrishin <[email protected]> parent: Dmitry Igrishin <[email protected]> 1 sibling, 0 replies; 4+ messages in thread From: Dmitry Igrishin @ 2015-08-11 11:20 UTC (permalink / raw) To: pgsql-docs 2015-08-11 13:47 GMT+03:00 Dmitry Igrishin <[email protected]>: > 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" > 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. ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: 36.3 Writing Tigger Functions in C @ 2015-08-11 11:32 Marko Tiikkaja <[email protected]> parent: Dmitry Igrishin <[email protected]> 1 sibling, 1 reply; 4+ messages in thread From: Marko Tiikkaja @ 2015-08-11 11:32 UTC (permalink / raw) To: Dmitry Igrishin <[email protected]>; pgsql-docs On 8/11/15 12:47 PM, Dmitry Igrishin wrote: > 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" 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 protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: 36.3 Writing Tigger Functions in C @ 2015-08-11 11:51 Dmitry Igrishin <[email protected]> parent: Marko Tiikkaja <[email protected]> 0 siblings, 0 replies; 4+ messages in thread From: Dmitry Igrishin @ 2015-08-11 11:51 UTC (permalink / raw) To: Marko Tiikkaja <[email protected]>; +Cc: pgsql-docs 2015-08-11 14:32 GMT+03:00 Marko Tiikkaja <[email protected]>: > On 8/11/15 12:47 PM, Dmitry Igrishin wrote: > >> 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" >> > > 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. 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. ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2015-08-11 11:51 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2015-08-11 10:47 36.3 Writing Tigger Functions in C Dmitry Igrishin <[email protected]> 2015-08-11 11:20 ` Dmitry Igrishin <[email protected]> 2015-08-11 11:32 ` Marko Tiikkaja <[email protected]> 2015-08-11 11:51 ` Dmitry Igrishin <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox