Skip to content

Fix executeBatch in auto-commit mode#261

Merged
staticlibs merged 1 commit intoduckdb:mainfrom
staticlibs:batch_autocommit_rollback
Jun 14, 2025
Merged

Fix executeBatch in auto-commit mode#261
staticlibs merged 1 commit intoduckdb:mainfrom
staticlibs:batch_autocommit_rollback

Conversation

@staticlibs
Copy link
Collaborator

This change fixes the problem when connection is left in inconsistent state when executeBatch throws constraint (or some other) error with auto-commit enabled.

In #213 executeBatch was changed to effectively disable auto-commit for the whole batch. In this case the rollback on error needs to be handled inside executeBatch too.

Testing: new tests added that cover constrain violation with executeBatch.

Fixes: #259

This change fixes the problem when connection is left in inconsistent
state when `executeBatch` throws constraint (or some other) error with
auto-commit enabled.

In duckdb#213 `executeBatch` was changed to effectively disable auto-commit
for the whole batch. In this case the rollback on error needs to be
handled inside `executeBatch` too.

Testing: new tests added that cover constrain violation with
`executeBatch`.

Fixes: duckdb#259
@staticlibs staticlibs merged commit 18eb33d into duckdb:main Jun 14, 2025
19 of 20 checks passed
@staticlibs staticlibs deleted the batch_autocommit_rollback branch June 14, 2025 09:24
staticlibs added a commit to staticlibs/duckdb-java that referenced this pull request Jun 15, 2025
This is a backport of the PR duckdb#261 to `v1.3-ossivalis` stable branch.

This change fixes the problem when connection is left in inconsistent
state when `executeBatch` throws constraint (or some other) error with
auto-commit enabled.

In duckdb#213 `executeBatch` was changed to effectively disable auto-commit
for the whole batch. In this case the rollback on error needs to be
handled inside `executeBatch` too.

Testing: new tests added that cover constrain violation with
`executeBatch`.

Fixes: duckdb#259
staticlibs added a commit that referenced this pull request Jun 16, 2025
This is a backport of the PR #261 to `v1.3-ossivalis` stable branch.

This change fixes the problem when connection is left in inconsistent
state when `executeBatch` throws constraint (or some other) error with
auto-commit enabled.

In #213 `executeBatch` was changed to effectively disable auto-commit
for the whole batch. In this case the rollback on error needs to be
handled inside `executeBatch` too.

Testing: new tests added that cover constrain violation with
`executeBatch`.

Fixes: #259
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

Successfully merging this pull request may close these issues.

Regression in 1.3.0.0 Current transaction is aborted (please ROLLBACK) when running faulty JDBC batch statements even if auto commit is set to true

1 participant