Re: Information on savepoint requirement within transctions

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Robert Zenz <robert(dot)zenz(at)sibvisions(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Information on savepoint requirement within transctions
Date: 2018-01-31 18:58:25
Message-ID: CAKFQuwZAi7PLdan2uf-9JFTWgjnccEhL6Z+2Tge8YM9-_8zVoA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jan 30, 2018 at 1:40 AM, Robert Zenz <robert(dot)zenz(at)sibvisions(dot)com>
wrote:

> On 30.01.2018 03:07, David G. Johnston wrote:
> > ​So, my first pass at this.
>
> Nice, thank you.
>
> > + These are of particular use for client software to use when executing
> > + user-supplied SQL statements and want to provide try/catch behavior
> > + where failures are ignored.
>
> Personally, I'd reword this to something like this:
>
> > These are of particular use for client software which is executing
> > user-supplied SQL statements and wants to provide try/catch behavior
> > with the ability to continue to use the transaction after a failure.
>
> Or maybe something like this:
>
> > These are of particular use for client software which requires
> > fine-grained support over failure behavior within a transaction.
> > They allow to provide a try/catch behavior with the ability
> > to continue to use a transaction after a failure.
>
>
​Given three options, and re-reading the paragraph, I figured dropping the
last part altogether was probably the best; though of the three "continue
to use a transaction after a failure" was close.​

> Also I'd like to see something like this in the docs at roughly the same
> position:
>
> > If a failure occurs during a transaction, the transaction enters
> > an aborted state. An aborted or failed transaction cannot be used
> > anymore to issue more commands, ROLLBACK or ROLLBACK TO must be used
> > to regain control of the aborted transaction. A commit issued while
> > the transaction is aborted is automatically converted into a
> > <xref linkend="sql-rollback"/>.
>

​Now that I've skimmed the tutorial again I think pointing the reader of
the SQL Commands there to learn how it works in practice is better than
trying to explain it in BEGIN and/or SAVEPOINT.

I decided to add a title to the part of SAVEPOINTS and introduce the term
"Sub-Transaction" there though I'm not married to it - re-wording it using
only "savepoint" is something that should be tried still.

A title and a paragraph or two on aborted transaction behavior probably
should be added as well.

Not compiled, not sure how the tutorial modifications would (want to)
interplay with the table of contents.

Diff from v1 and full v2 diff attached.

David J.

Attachment Content-Type Size
savepoint-doc-thoughts-v2.txt text/plain 4.7 KB
savepoint-doc-thoughts-v2-delta-from-v1.txt text/plain 3.2 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2018-01-31 19:29:20 Re: Issue with WAL logs temporary not replaying
Previous Message Tomas Vondra 2018-01-31 18:18:28 Re: Issue with WAL logs temporary not replaying