Re: doc: Clarify Savepoint Behavior

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: doc: Clarify Savepoint Behavior
Date: 2022-06-26 16:14:56
Message-ID: CAKFQuwaCe-oHVLuXL0e=54EredKUPy8YEHCyuw=x17ycbBK+fw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thank you for the review.

On Thu, Jun 23, 2022 at 5:35 AM Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com>
wrote:

> On Thu, 9 Jun 2022 at 16:41, David G. Johnston
> <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
> "The name to give to the new savepoint. The name may already exist,
> + in which case a rollback or release to the same name will use the
> + one that was most recently defined."
>
> instead I propose:
>
> "The name to give to the new savepoint. If the name duplicates a
> previously defined savepoint name then only the latest savepoint with
> that name
> can be referenced in a later ROLLBACK TO SAVEPOINT."
>

So leave the "release" behavior implied from the rollback behavior?

On the whole I'm slightly in favor of your proposed wording (mostly due to
the better fitting of the ROLLBACK command, though at the omission of
RELEASE...) but are you seeing anything beyond personal style as to why you
feel one is better than the other? Is there some existing wording in the
docs that I should be conforming to here?

> + <para>
> + If multiple savepoints have the same name, only the one that was most
> + recently defined is released.
> + </para>
>
> instead I propose
>
> "Searches backwards through previously defined savepoints until the
> a savepoint name matches the request. If the savepoint name duplicated
> earlier
> defined savepoints then those earlier savepoints can only be released if
> multiple ROLLBACK TO SAVEPOINT commands are issued with the same
> name, as shown in the following example."
>
>
Upon reflection, adding this after the comments about cursors seems like a
poor location, I will probably move it up one paragraph.

I dislike this proposal for its added wordiness that doesn't bring in new
material. The whole idea of "searching backwards until the name is found"
is already covered in the description:

"ROLLBACK TO SAVEPOINT implicitly destroys all savepoints that were
established after the named savepoint."

Using the phrase "can only be released if" here in the rollback to
savepoint command page just seems to be asking for confusion between this
and the release savepoint command.

Also, I would just call the savepoint "s" in the example, to declutter it.
>
>
If I do use a name that differs from the other two examples on that page
I'll probably go with "sp" for added detectability - but deviating from the
established convention doesn't seem warranted here.

In all, I'm still content with the patch as-is; though I or the committer
should consider moving up the one paragraph in rollback to savepoint.
Otherwise I'll probably post an updated patch sometime this coming week and
give another look at the savepoint name description and make that paragraph
move.

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2022-06-26 17:50:27 Re: Support logical replication of DDLs
Previous Message Justin Pryzby 2022-06-26 15:55:32 Re: Add LZ4 compression in pg_dump