Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for Postgres JDBC driver backward incompatible change #24761

Closed
lukas-krecan opened this issue Mar 22, 2020 · 1 comment
Closed

Prepare for Postgres JDBC driver backward incompatible change #24761

lukas-krecan opened this issue Mar 22, 2020 · 1 comment

Comments

@lukas-krecan
Copy link
Contributor

lukas-krecan commented Mar 22, 2020

Affects: 5.2.4

Postgres driver 42.2.11 introduces this change pgjdbc/pgjdbc#1729. Basically it makes commit fail if a JDBC command in the transaction failed. It is possibly a breaking change since code like this will start to throw an exception on transaction commit.

    @org.springframework.transaction.annotation.Transactional
    public void insert() {
        try {
            jdbcTemplate.update("insert into my_table values('test')");
        } catch(DataAccessException e) {
            // ignored, expected behavior
            logger.info("action=error_on_insert {}", e.getMessage());
        }
    }

It's reproduced here https://github.com/lukas-krecan/datasource-demo

See pgjdbc/pgjdbc#1739 for details and discussion. I do not know if Spring can do something to prevent the issue, I just wanted to give you heads-up.

@lukas-krecan lukas-krecan changed the title Prepare for Postgre backward incompatible change Prepare for Postgres JDBC driver backward incompatible change Mar 22, 2020
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Mar 22, 2020
@jhoeller
Copy link
Contributor

From a transaction semantics perspective, we are expecting such a scenario already since such a late-failing commit attempt is quite common in JTA setups. I'm afraid there isn't much we can do from a cross-version compatibility perspective, and arguably we shouldn't even try since we generally aim for aligning with the underlying resource transaction semantics. If the underlying driver decides to reject transactions with failing statements, then we expose that by design.

@bclozel bclozel removed the status: waiting-for-triage An issue we've not yet triaged or decided on label Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants