Re: Document How Commit Handles Aborted Transactions

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Gurjeet Singh <gurjeet(at)singh(dot)im>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Document How Commit Handles Aborted Transactions
Date: 2025-01-16 19:38:21
Message-ID: CAKFQuwaLLvjUY5-mivFEPYZdQsLSRYdB+LEmLLEQ_zQ3j_XmmA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 1, 2025 at 11:16 PM Gurjeet Singh <gurjeet(at)singh(dot)im> wrote:

> > On Fri, Dec 20, 2024 at 9:02 AM David G. Johnston <
> david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
> >> The commit reference page lacks an "Outputs" section even though it is
> capable of outputting both "COMMIT" and "ROLLBACK".
>
> I generally agree with the improvements proposed. I currently don't
> have the infrastructure to build docs, so the following review is
> without the benefit of what the build output looks like.
>

Thank you for the review. Version 2 Attached.

> This line in the patch has a trailing whitespace, which should be removed.
>
> + <xref linkend="sql-begin"/> and
>

Done

> I believe this sentence can be improved slightly:
>
> + When a failure does occur during a transaction it is not ended but
> instead
> + goes into an aborted state.
>
> as: When an error occurs in a transaction block, the transaction goes
> into an aborted state.
>

Agreed, and changed the existing usage of failure to error to match.

> So this seems like a better statement: If the transaction is in an
> aborted state, say, because of an error, then the effect of the
> <command>COMMIT</> will be identical to that of <command>ROLLBACK</>,
> including the command tag output.
>

I went with:

+ If the transaction is in an aborted state then no changes will be made
+ and the effect of the <command>COMMIT</command> will be identical to
that
+ of <command>ROLLBACK</command>, including the command tag output.

> The following needs to be rephrased:
>
> + However, if the transaction being affected is aborted, a
> <command>COMMIT</command>
> + command returns a command tag of the form
>
> as: However, if the transaction is in an aborted state, the
> <command>COMMIT</> command ...
>

I went with this, keeping the phrasing "on an" consistent between this and
the previous text.

+ However, on an aborted transaction, a <command>COMMIT</command>
+ command returns a command tag of the form

The use of "a/an" instead of "the" is supported by existing phrasing for
Insert.

"On successful completion, an INSERT command returns a command tag of the
form"

David J.

Attachment Content-Type Size
v2-0001-doc-Commit-performs-rollback-of-aborted-transactions.patch text/x-patch 4.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2025-01-16 20:52:54 Re: An improvement of ProcessTwoPhaseBuffer logic
Previous Message Mahendra Singh Thalor 2025-01-16 18:42:32 Re: Non-text mode for pg_dumpall