Thread
Commits
-
Doc: clarify how triggers relate to transactions.
- 95bc40f880a6 14.0 landed
- 469150a240dd 15.0 landed
-
Clarify how triggers relate to transactions
The Post Office <noreply@postgresql.org> — 2021-04-27T14:26:48Z
The following documentation comment has been logged on the website: Page: https://www.postgresql.org/docs/13/sql-createtrigger.html Description: https://www.postgresql.org/docs/current/sql-createtrigger.html mentions the word "transaction" only once, in reference specifically to constraint triggers: "They can be fired either at the end of the statement causing the triggering event, or at the end of the containing transaction; in the latter case they are said to be deferred." If I understand correctly, it would be helpful to add this sentence or a corrected version of it: "Triggers always execute in the same transaction as the triggering event, and if a trigger fails, the transaction is rolled back."
-
Re: Clarify how triggers relate to transactions
Laurenz Albe <laurenz.albe@cybertec.at> — 2021-04-28T11:24:53Z
On Tue, 2021-04-27 at 14:26 +0000, PG Doc comments form wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/13/sql-createtrigger.html > Description: > > https://www.postgresql.org/docs/current/sql-createtrigger.html mentions the > word "transaction" only once, in reference specifically to constraint > triggers: "They can be fired either at the end of the statement causing the > triggering event, or at the end of the containing transaction; in the latter > case they are said to be deferred." > > If I understand correctly, it would be helpful to add this sentence or a > corrected version of it: "Triggers always execute in the same transaction as > the triggering event, and if a trigger fails, the transaction is rolled > back." Good idea in principle, but I'd put that information on https://www.postgresql.org/docs/current/trigger-definition.html Yours, Laurenz Albe
-
Re: Clarify how triggers relate to transactions
Nathan Long <him@nathanmlong.com> — 2021-04-28T17:18:40Z
Gotcha. Where would I go to make the PR? On Wed, Apr 28, 2021, 7:24 AM Laurenz Albe <laurenz.albe@cybertec.at> wrote: > On Tue, 2021-04-27 at 14:26 +0000, PG Doc comments form wrote: > > The following documentation comment has been logged on the website: > > > > Page: https://www.postgresql.org/docs/13/sql-createtrigger.html > > Description: > > > > https://www.postgresql.org/docs/current/sql-createtrigger.html mentions > the > > word "transaction" only once, in reference specifically to constraint > > triggers: "They can be fired either at the end of the statement causing > the > > triggering event, or at the end of the containing transaction; in the > latter > > case they are said to be deferred." > > > > If I understand correctly, it would be helpful to add this sentence or a > > corrected version of it: "Triggers always execute in the same > transaction as > > the triggering event, and if a trigger fails, the transaction is rolled > > back." > > Good idea in principle, but I'd put that information on > https://www.postgresql.org/docs/current/trigger-definition.html > > Yours, > Laurenz Albe > >
-
Re: Clarify how triggers relate to transactions
Laurenz Albe <laurenz.albe@cybertec.at> — 2021-04-28T18:17:49Z
On Wed, 2021-04-28 at 13:18 -0400, Nathan Long wrote: > Gotcha. Where would I go to make the PR? You'd create a patch against Git master and send it to this mailing list or pgsql-hackers. If you don't want it to fall between the cracks, register in the next commitfest where it can undergo peer review. Yours, Laurenz Albe
-
Re: Clarify how triggers relate to transactions
Euler Taveira <euler@eulerto.com> — 2021-05-02T15:45:45Z
On Wed, Apr 28, 2021, at 2:18 PM, Nathan Long wrote: > Gotcha. Where would I go to make the PR? > There is no such PR feature; we don't use GitHub despite of having a mirror there. As Laurenz said you should create a patch (using your preferred git command) and attach to this thread. If you prefer, you can also send the patch to pgsql-hackers ML (add the link to this thread). The next step is to register your patch to the next commitfest [1] so we don't lose track of it. For a complete reference about submitting a patch, take a look at [2]. [1] https://commitfest.postgresql.org/33/ [2] https://wiki.postgresql.org/wiki/Submitting_a_Patch Regards, -- Euler Taveira EDB https://www.enterprisedb.com/
-
Re: Clarify how triggers relate to transactions
Laurenz Albe <laurenz.albe@cybertec.at> — 2021-05-05T09:55:20Z
On Wed, 2021-04-28 at 13:24 +0200, Laurenz Albe wrote: > On Tue, 2021-04-27 at 14:26 +0000, PG Doc comments form wrote: > > https://www.postgresql.org/docs/current/sql-createtrigger.html mentions the > > word "transaction" only once, in reference specifically to constraint > > triggers: "They can be fired either at the end of the statement causing the > > triggering event, or at the end of the containing transaction; in the latter > > case they are said to be deferred." > > > > If I understand correctly, it would be helpful to add this sentence or a > > corrected version of it: "Triggers always execute in the same transaction as > > the triggering event, and if a trigger fails, the transaction is rolled > > back." > > Good idea in principle, but I'd put that information on > https://www.postgresql.org/docs/current/trigger-definition.html Here is a proposed patch for this. Yours, Laurenz Albe
-
Re: Clarify how triggers relate to transactions
Laurenz Albe <laurenz.albe@cybertec.at> — 2021-05-20T15:53:40Z
On Wed, 2021-05-05 at 11:55 +0200, Laurenz Albe wrote: > On Wed, 2021-04-28 at 13:24 +0200, Laurenz Albe wrote: > > On Tue, 2021-04-27 at 14:26 +0000, PG Doc comments form wrote: > > > https://www.postgresql.org/docs/current/sql-createtrigger.html mentions the > > > word "transaction" only once, in reference specifically to constraint > > > triggers: "They can be fired either at the end of the statement causing the > > > triggering event, or at the end of the containing transaction; in the latter > > > case they are said to be deferred." > > > > > > If I understand correctly, it would be helpful to add this sentence or a > > > corrected version of it: "Triggers always execute in the same transaction as > > > the triggering event, and if a trigger fails, the transaction is rolled > > > back." > > > > Good idea in principle, but I'd put that information on > > https://www.postgresql.org/docs/current/trigger-definition.html > > Here is a proposed patch for this. Replying to -hackers for the commitfest app. Yours, Laurenz Albe
-
Re: Clarify how triggers relate to transactions
Tom Lane <tgl@sss.pgh.pa.us> — 2021-07-30T20:20:23Z
Laurenz Albe <laurenz.albe@cybertec.at> writes: > On Wed, 2021-04-28 at 13:24 +0200, Laurenz Albe wrote: >> On Tue, 2021-04-27 at 14:26 +0000, PG Doc comments form wrote: >>> If I understand correctly, it would be helpful to add this sentence or a >>> corrected version of it: "Triggers always execute in the same transaction as >>> the triggering event, and if a trigger fails, the transaction is rolled >>> back." >> Good idea in principle, but I'd put that information on >> https://www.postgresql.org/docs/current/trigger-definition.html > Here is a proposed patch for this. I think this is a good idea, but I felt like you'd added the extra sentences in not-terribly-well-chosen places. For instance, your first addition in trigger.sgml is adding to a para that talks about triggers for tables, while the next para talks about triggers for views. So it seems unclear whether the statement is meant to apply to view triggers too. I think it'd work out best to make this a separate para after the one that defines before/after/instead-of triggers. How do you like the attached? regards, tom lane
-
Re: Clarify how triggers relate to transactions
Laurenz Albe <laurenz.albe@cybertec.at> — 2021-08-18T11:06:05Z
On Fri, 2021-07-30 at 16:20 -0400, Tom Lane wrote: > Laurenz Albe <laurenz.albe@cybertec.at> writes: > > On Wed, 2021-04-28 at 13:24 +0200, Laurenz Albe wrote: > > > On Tue, 2021-04-27 at 14:26 +0000, PG Doc comments form wrote: > > > > If I understand correctly, it would be helpful to add this sentence or a > > > > corrected version of it: "Triggers always execute in the same transaction as > > > > the triggering event, and if a trigger fails, the transaction is rolled > > > > back." > > > > Here is a proposed patch for this. > > I think this is a good idea, but I felt like you'd added the extra > sentences in not-terribly-well-chosen places. For instance, your > first addition in trigger.sgml is adding to a para that talks about > triggers for tables, while the next para talks about triggers for > views. So it seems unclear whether the statement is meant to apply > to view triggers too. > > I think it'd work out best to make this a separate para after the > one that defines before/after/instead-of triggers. How do you > like the attached? That is better, and I like your patch. Thanks! Keeping paragraphs short is a good thing. Yours, Laurenz Albe
-
Re: Clarify how triggers relate to transactions
Tom Lane <tgl@sss.pgh.pa.us> — 2021-09-01T21:25:57Z
Laurenz Albe <laurenz.albe@cybertec.at> writes: > On Fri, 2021-07-30 at 16:20 -0400, Tom Lane wrote: >> I think it'd work out best to make this a separate para after the >> one that defines before/after/instead-of triggers. How do you >> like the attached? > That is better, and I like your patch. Thanks! > Keeping paragraphs short is a good thing. Pushed like that, then. regards, tom lane