agora inbox for pgsql-docs@postgresql.org
help / color / mirror / Atom feedDocumentation should state what happens, when a commit fails
7+ messages / 5 participants
[nested] [flat]
* Documentation should state what happens, when a commit fails
@ 2025-05-28 08:08 PG Doc comments form <noreply@postgresql.org>
2025-05-28 13:06 ` Re: Documentation should state what happens, when a commit fails Laurenz Albe <laurenz.albe@cybertec.at>
0 siblings, 1 reply; 7+ messages in thread
From: PG Doc comments form @ 2025-05-28 08:08 UTC (permalink / raw)
To: pgsql-docs@lists.postgresql.org; +Cc: mark@makr.zone
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/17/sql-commit.html
Description:
Deferrable constraints, deadlocks and possibly other deferred or lazily
evaluated rules are checked upon commit.
What happens if they are not met and the commit statement fails? Does the
transaction then implicitly rollback? Or do I need an explicit rollback?
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Documentation should state what happens, when a commit fails
2025-05-28 08:08 Documentation should state what happens, when a commit fails PG Doc comments form <noreply@postgresql.org>
@ 2025-05-28 13:06 ` Laurenz Albe <laurenz.albe@cybertec.at>
2025-05-28 14:04 ` Re: Documentation should state what happens, when a commit fails David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: Laurenz Albe @ 2025-05-28 13:06 UTC (permalink / raw)
To: mark@makr.zone; pgsql-docs@lists.postgresql.org
On Wed, 2025-05-28 at 08:08 +0000, PG Doc comments form wrote:
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/17/sql-commit.html
> Description:
>
> Deferrable constraints, deadlocks and possibly other deferred or lazily
> evaluated rules are checked upon commit.
> What happens if they are not met and the commit statement fails? Does the
> transaction then implicitly rollback? Or do I need an explicit rollback?
I think it would be good to mention that a failed COMMIT automatically
performs a ROLLBACK. Do you want to suggest a patch?
Yours,
Laurenz Albe
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Documentation should state what happens, when a commit fails
2025-05-28 08:08 Documentation should state what happens, when a commit fails PG Doc comments form <noreply@postgresql.org>
2025-05-28 13:06 ` Re: Documentation should state what happens, when a commit fails Laurenz Albe <laurenz.albe@cybertec.at>
@ 2025-05-28 14:04 ` David G. Johnston <david.g.johnston@gmail.com>
2025-05-28 14:47 ` RE: Documentation should state what happens, when a commit fails mark maker <mark@makr.zone>
0 siblings, 1 reply; 7+ messages in thread
From: David G. Johnston @ 2025-05-28 14:04 UTC (permalink / raw)
To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: mark@makr.zone <mark@makr.zone>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
On Wednesday, May 28, 2025, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
> On Wed, 2025-05-28 at 08:08 +0000, PG Doc comments form wrote:
> > The following documentation comment has been logged on the website:
> >
> > Page: https://www.postgresql.org/docs/17/sql-commit.html
> > Description:
> >
> > Deferrable constraints, deadlocks and possibly other deferred or lazily
> > evaluated rules are checked upon commit.
> > What happens if they are not met and the commit statement fails? Does the
> > transaction then implicitly rollback? Or do I need an explicit rollback?
>
> I think it would be good to mention that a failed COMMIT automatically
> performs a ROLLBACK. Do you want to suggest a patch?
Feel free to review mine for this topic and suggest additions.
https://commitfest.postgresql.org/patch/5546/
David J.
^ permalink raw reply [nested|flat] 7+ messages in thread
* RE: Documentation should state what happens, when a commit fails
2025-05-28 08:08 Documentation should state what happens, when a commit fails PG Doc comments form <noreply@postgresql.org>
2025-05-28 13:06 ` Re: Documentation should state what happens, when a commit fails Laurenz Albe <laurenz.albe@cybertec.at>
2025-05-28 14:04 ` Re: Documentation should state what happens, when a commit fails David G. Johnston <david.g.johnston@gmail.com>
@ 2025-05-28 14:47 ` mark maker <mark@makr.zone>
2025-05-28 14:59 ` Re: Documentation should state what happens, when a commit fails David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: mark maker @ 2025-05-28 14:47 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
Wow, great improvement, thanks!
The "tutorial-transactions" opens a new question that might be useful to
know: when a transaction enters the aborted state at an early point in
time (as has now become clear), does this mean it will also relinquish
any locks and predicate locks early, or will it still hold onto those
until explicitly rolled back by command?
_Mark
*From:* David G. Johnston <david.g.johnston@gmail.com>
*Sent:* Wednesday, May 28, 2025 at 4:04 PM UTC+2
*To:* Laurenz Albe <laurenz.albe@cybertec.at>
*Cc:* mark@makr.zone <mark@makr.zone>, pgsql-docs@lists.postgresql.org
<pgsql-docs@lists.postgresql.org>
*Subject:* RE: Documentation should state what happens, when a commit fails
> On Wednesday, May 28, 2025, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
>
> On Wed, 2025-05-28 at 08:08 +0000, PG Doc comments form wrote:
> > The following documentation comment has been logged on the website:
> >
> > Page: https://www.postgresql.org/docs/17/sql-commit.html
> <https://www.postgresql.org/docs/17/sql-commit.html;
> > Description:
> >
> > Deferrable constraints, deadlocks and possibly other deferred or
> lazily
> > evaluated rules are checked upon commit.
> > What happens if they are not met and the commit statement fails?
> Does the
> > transaction then implicitly rollback? Or do I need an explicit
> rollback?
>
> I think it would be good to mention that a failed COMMIT automatically
> performs a ROLLBACK. Do you want to suggest a patch?
>
>
> Feel free to review mine for this topic and suggest additions.
>
> https://commitfest.postgresql.org/patch/5546/
>
> David J.
>
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Documentation should state what happens, when a commit fails
2025-05-28 08:08 Documentation should state what happens, when a commit fails PG Doc comments form <noreply@postgresql.org>
2025-05-28 13:06 ` Re: Documentation should state what happens, when a commit fails Laurenz Albe <laurenz.albe@cybertec.at>
2025-05-28 14:04 ` Re: Documentation should state what happens, when a commit fails David G. Johnston <david.g.johnston@gmail.com>
2025-05-28 14:47 ` RE: Documentation should state what happens, when a commit fails mark maker <mark@makr.zone>
@ 2025-05-28 14:59 ` David G. Johnston <david.g.johnston@gmail.com>
2025-05-28 15:09 ` Re: Documentation should state what happens, when a commit fails Dave Cramer <davecramer@postgres.rocks>
0 siblings, 1 reply; 7+ messages in thread
From: David G. Johnston @ 2025-05-28 14:59 UTC (permalink / raw)
To: mark maker <mark@makr.zone>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
On Wed, May 28, 2025 at 7:47 AM mark maker <mark@makr.zone> wrote:
> Wow, great improvement, thanks!
>
> The "tutorial-transactions" opens a new question that might be useful to
> know: when a transaction enters the aborted state at an early point in time
> (as has now become clear), does this mean it will also relinquish any locks
> and predicate locks early, or will it still hold onto those until
> explicitly rolled back by command?
>
I suppose if the system knows there are no savepoints in progress it could
release the locks and whatnot...not sure if it knows that and acts upon
that knowledge if it does. Easy enough to test with two psql sessions if
you want to give it a go before I or someone else gets around to it.
David J.
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Documentation should state what happens, when a commit fails
2025-05-28 08:08 Documentation should state what happens, when a commit fails PG Doc comments form <noreply@postgresql.org>
2025-05-28 13:06 ` Re: Documentation should state what happens, when a commit fails Laurenz Albe <laurenz.albe@cybertec.at>
2025-05-28 14:04 ` Re: Documentation should state what happens, when a commit fails David G. Johnston <david.g.johnston@gmail.com>
2025-05-28 14:47 ` RE: Documentation should state what happens, when a commit fails mark maker <mark@makr.zone>
2025-05-28 14:59 ` Re: Documentation should state what happens, when a commit fails David G. Johnston <david.g.johnston@gmail.com>
@ 2025-05-28 15:09 ` Dave Cramer <davecramer@postgres.rocks>
2025-05-28 18:49 ` Re: Documentation should state what happens, when a commit fails Laurenz Albe <laurenz.albe@cybertec.at>
0 siblings, 1 reply; 7+ messages in thread
From: Dave Cramer @ 2025-05-28 15:09 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: mark maker <mark@makr.zone>; Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
On Wed, 28 May 2025 at 10:59, David G. Johnston <david.g.johnston@gmail.com>
wrote:
> On Wed, May 28, 2025 at 7:47 AM mark maker <mark@makr.zone> wrote:
>
>> Wow, great improvement, thanks!
>>
>> The "tutorial-transactions" opens a new question that might be useful to
>> know: when a transaction enters the aborted state at an early point in time
>> (as has now become clear), does this mean it will also relinquish any locks
>> and predicate locks early, or will it still hold onto those until
>> explicitly rolled back by command?
>>
>
> I suppose if the system knows there are no savepoints in progress it could
> release the locks and whatnot...not sure if it knows that and acts upon
> that knowledge if it does. Easy enough to test with two psql sessions if
> you want to give it a go before I or someone else gets around to it.
>
Somewhat annoying feature of this behaviour is that when COMMIT is issued
on an aborted transaction no error is reported.
Most drivers work around this problem by keeping track of the previous
error and reporting an error on the COMMIT.
Dave
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Documentation should state what happens, when a commit fails
2025-05-28 08:08 Documentation should state what happens, when a commit fails PG Doc comments form <noreply@postgresql.org>
2025-05-28 13:06 ` Re: Documentation should state what happens, when a commit fails Laurenz Albe <laurenz.albe@cybertec.at>
2025-05-28 14:04 ` Re: Documentation should state what happens, when a commit fails David G. Johnston <david.g.johnston@gmail.com>
2025-05-28 14:47 ` RE: Documentation should state what happens, when a commit fails mark maker <mark@makr.zone>
2025-05-28 14:59 ` Re: Documentation should state what happens, when a commit fails David G. Johnston <david.g.johnston@gmail.com>
2025-05-28 15:09 ` Re: Documentation should state what happens, when a commit fails Dave Cramer <davecramer@postgres.rocks>
@ 2025-05-28 18:49 ` Laurenz Albe <laurenz.albe@cybertec.at>
0 siblings, 0 replies; 7+ messages in thread
From: Laurenz Albe @ 2025-05-28 18:49 UTC (permalink / raw)
To: Dave Cramer <davecramer@postgres.rocks>; David G. Johnston <david.g.johnston@gmail.com>; +Cc: mark maker <mark@makr.zone>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
On Wed, 2025-05-28 at 11:09 -0400, Dave Cramer wrote:
> Somewhat annoying feature of this behaviour is that when COMMIT is issued on an aborted transaction no error is reported.
> Most drivers work around this problem by keeping track of the previous error and reporting an error on the COMMIT.
We have been there before:
https://postgr.es/m/b9fb50dc-0f6e-15fb-6555-8ddb86f4aa71%40postgresfriends.org
Nothing came of that discussion though.
Yours,
Laurenz Albe
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2025-05-28 18:49 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-05-28 08:08 Documentation should state what happens, when a commit fails PG Doc comments form <noreply@postgresql.org>
2025-05-28 13:06 ` Laurenz Albe <laurenz.albe@cybertec.at>
2025-05-28 14:04 ` David G. Johnston <david.g.johnston@gmail.com>
2025-05-28 14:47 ` mark maker <mark@makr.zone>
2025-05-28 14:59 ` David G. Johnston <david.g.johnston@gmail.com>
2025-05-28 15:09 ` Dave Cramer <davecramer@postgres.rocks>
2025-05-28 18:49 ` Laurenz Albe <laurenz.albe@cybertec.at>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox