Re: Clarify how triggers relate to transactions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: him(at)nathanmlong(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: Clarify how triggers relate to transactions
Date: 2021-07-30 20:20:23
Message-ID: 1120625.1627676423@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers

Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)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

Attachment Content-Type Size
0001-Document-how-triggers-interact-with-transactions-2.patch text/x-diff 1.6 KB

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Anthony Berglas 2021-08-02 06:34:34 Re: Common case not at all clear
Previous Message Tom Lane 2021-07-30 19:05:08 Re: [PATCH] add link to domain data types section from locale documentation

Browse pgsql-hackers by date

  From Date Subject
Next Message Bossart, Nathan 2021-07-30 20:25:19 Re: archive status ".ready" files may be created too early
Previous Message Andres Freund 2021-07-30 20:00:44 Re: Background writer and checkpointer in crash recovery