Re: BUG #18294: Manual savepoints do not work with JDBC param cleanupSavepoints=true

From: Dave Cramer <davecramer(at)postgres(dot)rocks>
To: obouda(at)gk-software(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18294: Manual savepoints do not work with JDBC param cleanupSavepoints=true
Date: 2024-01-16 14:45:38
Message-ID: CADK3HHJY2fT7gZt6UGY53gerATJwhDERoPCmxqK+8kCO51C-kg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, 15 Jan 2024 at 06:36, PG Bug reporting form <noreply(at)postgresql(dot)org>
wrote:

> The following bug has been logged on the website:
>
> Bug reference: 18294
> Logged by: Ondrej Bouda
> Email address: obouda(at)gk-software(dot)com
> PostgreSQL version: 16.1
> Operating system: Linux
> Description:
>
> We come across a bug when it is not possible to roll back to a manual
> savepoint.
> The rollback fails with error: Error during rollback to savepoint.
> org.postgresql.util.PSQLException: ERROR: savepoint "SAVE_TEST_01" does not
> exist
>
> Steps to reproduce:
> 1/ Connect via JDBC with JDBC params
> autosave=always&cleanupSavepoints=true.
> 2/ Create a manual savepoint: savepoint SAVE_TEST_01;
> 3/ Try to roll back => error: rollback to SAVE_TEST_01;
>
> Reproduced with:
> * JDBC driver ver. 42.7.1
> * PostgreSQL ver. 16.1 + 15.5 + 14.10
>
> The error occurs when using SQL statements as well as when using the JDBC
> API for savepoint/rollback (Connection.setSavepoint +
> Connection.rollback).
>
> The documentation for the cleanupSavepoints parameter reads: "Determines if
> the SAVEPOINT created in autosave mode is released prior to the
> statement."
> * https://jdbc.postgresql.org/documentation/use/
> * I would understand the doc in the way that it should affect just and only
> the savepoint created by the driver due to the autosave=true param
> (therefore, manual savepoints should not be affected).
>

Thank you for the report.

Unfortunately, the way Postgresql works as per

RELEASE SAVEPOINT releases the named savepoint and all active savepoints
that were created after the named savepoint, and frees their resources. All
changes made since the creation of the savepoint that didn't already get
rolled back are merged into the transaction or savepoint that was active
when the named savepoint was created. Changes made after RELEASE SAVEPOINT will
also be part of this active transaction or savepoint.

all savepoints made after will be released.

I'm not sure how to solve this problem

Dave

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2024-01-16 15:53:30 BUG #18299: yum.postgresql.org/keys website is down (404 error) and can't download keys
Previous Message Dmitry Koval 2024-01-16 13:55:34 Re: BUG #18274: Error 'invalid XML content'