Firebird: Handle COMMIT/ROLLBACK via transaction manager API in script execution#40665
Firebird: Handle COMMIT/ROLLBACK via transaction manager API in script execution#40665fdcastel wants to merge 1 commit intodbeaver:develfrom
Conversation
Analysis of Cross-Database ImpactWhat the original code actually did (for databases like PostgreSQL/MySQL)When encountering
So the original code was already broken for manual commit mode — it was committing twice via the JDBC API, plus once as raw SQL. That databases like PostgreSQL tolerated this is incidental. What the fix doesWith the fix, encountering
Using The real concern:
|
|
Moving this out of draft for now. Seeking for guidance. |
|
Your PR will broke other databases, where execute of |
Hmm, I was under the impression that it wouldn’t, but I’m still learning. Could you share some examples? Is there an existing test suite that covers this (or perhaps one I’m not running)? I tried to run a quick check with DuckDB and SQLite, but both reject a |
|
Yes, but you mentioned PostgreSQL in your message
|
Sure. But I don't have one to test right now. I made this a week ago, in another system, far from where I am now. I'm still unsure what you want me to do for this to go ahead. Please, help me to understand: what from the OP or its follow-up isn't clear? There are no repro cases I can work against. There are no tests in the codebase for this. I may add them, but I will need a pointer. |
Broadens scope from Firebird-only to multi-database so we can regression-guard upstream PRs that touch shared DBeaver internals. - CI: install Firebird via PSFirebird (New-FirebirdEnvironment + Start-FirebirdInstance) instead of the Inno-Setup silent installer; reuse the pre-installed PostgreSQL service on windows-latest runners. - New plugin local.dbeaver.postgresql.ui.test/ with a regression guard for dbeaver/dbeaver#40665 (script execution of COMMIT/ROLLBACK must keep working on databases that previously accepted raw COMMIT). - Refactor ConnectionUtil.createConnectionViaAPI to take a driver search term; add createPostgreSQLConnectionViaAPI wrapper. - Widen artifact and JUnit report globs to plugins/*/target/surefire-reports.
… #40665
- New plugin local.dbeaver.postgresql.ui.test/ mirroring the Firebird one.
* PostgreSQLConnectionTest — creates a connection via the DBeaver API and
asserts it appears in the navigator.
* ScriptCommitRollbackTest — runs the repro script from dbeaver/dbeaver#40665
(DDL + INSERTs + COMMIT + ROLLBACK) via Alt+X and asserts no error dialog.
Guards against the PR's COMMIT/ROLLBACK interception regressing on databases
that historically accepted them as raw SQL.
- Refactor support plugin's ConnectionUtil: extract createConnectionViaAPI
(driverSearchTerm, displayName, ...) so Firebird and PostgreSQL can share the
fast programmatic-registration path; updateConnectionViaAPI takes the search
term too.
- CI workflow now also starts the pre-installed PostgreSQL service on
windows-latest (fastest option, no download), resets the postgres password,
creates the ui_test database, and passes -Dpostgres.* alongside -Dfirebird.*.
Artifact + JUnit-report globs widened to plugins/*/target/... so both test
plugins are covered. Firebird install continues to use the official
Inno-Setup installer unchanged.
- README updated to describe the multi-database scope.
… #40665
- New plugin local.dbeaver.postgresql.ui.test/ mirroring the Firebird one.
* PostgreSQLConnectionTest — creates a connection via the DBeaver API and
asserts it appears in the navigator.
* ScriptCommitRollbackTest — runs the repro script from dbeaver/dbeaver#40665
(DDL + INSERTs + COMMIT + ROLLBACK) via Alt+X and asserts no error dialog.
Guards against the PR's COMMIT/ROLLBACK interception regressing on databases
that historically accepted them as raw SQL.
- Refactor support plugin's ConnectionUtil: extract createConnectionViaAPI
(driverSearchTerm, displayName, ...) so Firebird and PostgreSQL can share the
fast programmatic-registration path; updateConnectionViaAPI takes the search
term too.
- CI workflow now also starts the pre-installed PostgreSQL service on
windows-latest (fastest option, no download), resets the postgres password,
creates the ui_test database, and passes -Dpostgres.* alongside -Dfirebird.*.
Artifact + JUnit-report globs widened to plugins/*/target/... so both test
plugins are covered. Firebird install continues to use the official
Inno-Setup installer unchanged.
- README updated to describe the multi-database scope.
… #40665
- New plugin local.dbeaver.postgresql.ui.test/ mirroring the Firebird one.
* PostgreSQLConnectionTest — creates a connection via the DBeaver API and
asserts it appears in the navigator.
* ScriptCommitRollbackTest — runs the repro script from dbeaver/dbeaver#40665
(DDL + INSERTs + COMMIT + ROLLBACK) via Alt+X and asserts no error dialog.
Guards against the PR's COMMIT/ROLLBACK interception regressing on databases
that historically accepted them as raw SQL.
- Refactor support plugin's ConnectionUtil: extract createConnectionViaAPI
(driverSearchTerm, displayName, ...) so Firebird and PostgreSQL can share the
fast programmatic-registration path; updateConnectionViaAPI takes the search
term too.
- CI workflow now also starts the pre-installed PostgreSQL service on
windows-latest (fastest option, no download), resets the postgres password,
creates the ui_test database, and passes -Dpostgres.* alongside -Dfirebird.*.
Artifact + JUnit-report globs widened to plugins/*/target/... so both test
plugins are covered. Firebird install continues to use the official
Inno-Setup installer unchanged.
- README updated to describe the multi-database scope.
… #40665
- New plugin local.dbeaver.postgresql.ui.test/ mirroring the Firebird one.
* PostgreSQLConnectionTest — creates a connection via the DBeaver API and
asserts it appears in the navigator.
* ScriptCommitRollbackTest — runs the repro script from dbeaver/dbeaver#40665
(DDL + INSERTs + COMMIT + ROLLBACK) via Alt+X and asserts no error dialog.
Guards against the PR's COMMIT/ROLLBACK interception regressing on databases
that historically accepted them as raw SQL.
- Refactor support plugin's ConnectionUtil: extract createConnectionViaAPI
(driverSearchTerm, displayName, ...) so Firebird and PostgreSQL can share the
fast programmatic-registration path; updateConnectionViaAPI takes the search
term too.
- CI workflow now also starts the pre-installed PostgreSQL service on
windows-latest (fastest option, no download), resets the postgres password,
creates the ui_test database, and passes -Dpostgres.* alongside -Dfirebird.*.
Artifact + JUnit-report globs widened to plugins/*/target/... so both test
plugins are covered. Firebird install continues to use the official
Inno-Setup installer unchanged.
- README updated to describe the multi-database scope.
… #40665
- New plugin local.dbeaver.postgresql.ui.test/ mirroring the Firebird one.
* PostgreSQLConnectionTest — creates a connection via the DBeaver API and
asserts it appears in the navigator.
* ScriptCommitRollbackTest — runs the repro script from dbeaver/dbeaver#40665
(DDL + INSERTs + COMMIT + ROLLBACK) via Alt+X and asserts no error dialog.
Guards against the PR's COMMIT/ROLLBACK interception regressing on databases
that historically accepted them as raw SQL.
- Refactor support plugin's ConnectionUtil: extract createConnectionViaAPI
(driverSearchTerm, displayName, ...) so Firebird and PostgreSQL can share the
fast programmatic-registration path; updateConnectionViaAPI takes the search
term too.
- CI workflow now also starts the pre-installed PostgreSQL service on
windows-latest (fastest option, no download), resets the postgres password,
creates the ui_test database, and passes -Dpostgres.* alongside -Dfirebird.*.
Artifact + JUnit-report globs widened to plugins/*/target/... so both test
plugins are covered. Firebird install continues to use the official
Inno-Setup installer unchanged.
- README updated to describe the multi-database scope.
… #40665
- New plugin local.dbeaver.postgresql.ui.test/ mirroring the Firebird one.
* PostgreSQLConnectionTest — creates a connection via the DBeaver API and
asserts it appears in the navigator.
* ScriptCommitRollbackTest — runs the repro script from dbeaver/dbeaver#40665
(DDL + INSERTs + COMMIT + ROLLBACK) via Alt+X and asserts no error dialog.
Guards against the PR's COMMIT/ROLLBACK interception regressing on databases
that historically accepted them as raw SQL.
- Refactor support plugin's ConnectionUtil: extract createConnectionViaAPI
(driverSearchTerm, displayName, ...) so Firebird and PostgreSQL can share the
fast programmatic-registration path; updateConnectionViaAPI takes the search
term too.
- CI workflow now also starts the pre-installed PostgreSQL service on
windows-latest (fastest option, no download), resets the postgres password,
creates the ui_test database, and passes -Dpostgres.* alongside -Dfirebird.*.
Artifact + JUnit-report globs widened to plugins/*/target/... so both test
plugins are covered. Firebird install continues to use the official
Inno-Setup installer unchanged.
- README updated to describe the multi-database scope.
… #40665
- New plugin local.dbeaver.postgresql.ui.test/ mirroring the Firebird one.
* PostgreSQLConnectionTest — creates a connection via the DBeaver API and
asserts it appears in the navigator.
* ScriptCommitRollbackTest — runs the repro script from dbeaver/dbeaver#40665
(DDL + INSERTs + COMMIT + ROLLBACK) via Alt+X and asserts no error dialog.
Guards against the PR's COMMIT/ROLLBACK interception regressing on databases
that historically accepted them as raw SQL.
- Refactor support plugin's ConnectionUtil: extract createConnectionViaAPI
(driverSearchTerm, displayName, ...) so Firebird and PostgreSQL can share the
fast programmatic-registration path; updateConnectionViaAPI takes the search
term too.
- CI workflow now also starts the pre-installed PostgreSQL service on
windows-latest (fastest option, no download), resets the postgres password,
creates the ui_test database, and passes -Dpostgres.* alongside -Dfirebird.*.
Artifact + JUnit-report globs widened to plugins/*/target/... so both test
plugins are covered. Firebird install continues to use the official
Inno-Setup installer unchanged.
- README updated to describe the multi-database scope.
… #40665
- New plugin local.dbeaver.postgresql.ui.test/ mirroring the Firebird one.
* PostgreSQLConnectionTest — creates a connection via the DBeaver API and
asserts it appears in the navigator.
* ScriptCommitRollbackTest — runs the repro script from dbeaver/dbeaver#40665
(DDL + INSERTs + COMMIT + ROLLBACK) via Alt+X and asserts no error dialog.
Guards against the PR's COMMIT/ROLLBACK interception regressing on databases
that historically accepted them as raw SQL.
- Refactor support plugin's ConnectionUtil: extract createConnectionViaAPI
(driverSearchTerm, displayName, ...) so Firebird and PostgreSQL can share the
fast programmatic-registration path; updateConnectionViaAPI takes the search
term too.
- CI workflow now also starts the pre-installed PostgreSQL service on
windows-latest (fastest option, no download), resets the postgres password,
creates the ui_test database, and passes -Dpostgres.* alongside -Dfirebird.*.
Artifact + JUnit-report globs widened to plugins/*/target/... so both test
plugins are covered. Firebird install continues to use the official
Inno-Setup installer unchanged.
- README updated to describe the multi-database scope.
… #40665
- New plugin local.dbeaver.postgresql.ui.test/ mirroring the Firebird one.
* PostgreSQLConnectionTest — creates a connection via the DBeaver API and
asserts it appears in the navigator.
* ScriptCommitRollbackTest — runs the repro script from dbeaver/dbeaver#40665
(DDL + INSERTs + COMMIT + ROLLBACK) via Alt+X and asserts no error dialog.
Guards against the PR's COMMIT/ROLLBACK interception regressing on databases
that historically accepted them as raw SQL.
- Refactor support plugin's ConnectionUtil: extract createConnectionViaAPI
(driverSearchTerm, displayName, ...) so Firebird and PostgreSQL can share the
fast programmatic-registration path; updateConnectionViaAPI takes the search
term too.
- CI workflow now also starts the pre-installed PostgreSQL service on
windows-latest (fastest option, no download), resets the postgres password,
creates the ui_test database, and passes -Dpostgres.* alongside -Dfirebird.*.
Artifact + JUnit-report globs widened to plugins/*/target/... so both test
plugins are covered. Firebird install continues to use the official
Inno-Setup installer unchanged.
- README updated to describe the multi-database scope.
… #40665
- New plugin local.dbeaver.postgresql.ui.test/ mirroring the Firebird one.
* PostgreSQLConnectionTest — creates a connection via the DBeaver API and
asserts it appears in the navigator.
* ScriptCommitRollbackTest — runs the repro script from dbeaver/dbeaver#40665
(DDL + INSERTs + COMMIT + ROLLBACK) via Alt+X and asserts no error dialog.
Guards against the PR's COMMIT/ROLLBACK interception regressing on databases
that historically accepted them as raw SQL.
- Refactor support plugin's ConnectionUtil: extract createConnectionViaAPI
(driverSearchTerm, displayName, ...) so Firebird and PostgreSQL can share the
fast programmatic-registration path; updateConnectionViaAPI takes the search
term too.
- CI workflow now also starts the pre-installed PostgreSQL service on
windows-latest (fastest option, no download), resets the postgres password,
creates the ui_test database, and passes -Dpostgres.* alongside -Dfirebird.*.
Artifact + JUnit-report globs widened to plugins/*/target/... so both test
plugins are covered. Firebird install continues to use the official
Inno-Setup installer unchanged.
- README updated to describe the multi-database scope.
… #40665
- New plugin local.dbeaver.postgresql.ui.test/ mirroring the Firebird one.
* PostgreSQLConnectionTest — creates a connection via the DBeaver API and
asserts it appears in the navigator.
* ScriptCommitRollbackTest — runs the repro script from dbeaver/dbeaver#40665
(DDL + INSERTs + COMMIT + ROLLBACK) via Alt+X and asserts no error dialog.
Guards against the PR's COMMIT/ROLLBACK interception regressing on databases
that historically accepted them as raw SQL.
- Refactor support plugin's ConnectionUtil: extract createConnectionViaAPI
(driverSearchTerm, displayName, ...) so Firebird and PostgreSQL can share the
fast programmatic-registration path; updateConnectionViaAPI takes the search
term too.
- CI workflow now also starts the pre-installed PostgreSQL service on
windows-latest (fastest option, no download), resets the postgres password,
creates the ui_test database, and passes -Dpostgres.* alongside -Dfirebird.*.
Artifact + JUnit-report globs widened to plugins/*/target/... so both test
plugins are covered. Firebird install continues to use the official
Inno-Setup installer unchanged.
- README updated to describe the multi-database scope.
… #40665
- New plugin local.dbeaver.postgresql.ui.test/ mirroring the Firebird one.
* PostgreSQLConnectionTest — creates a connection via the DBeaver API and
asserts it appears in the navigator.
* ScriptCommitRollbackTest — runs the repro script from dbeaver/dbeaver#40665
(DDL + INSERTs + COMMIT + ROLLBACK) via Alt+X and asserts no error dialog.
Guards against the PR's COMMIT/ROLLBACK interception regressing on databases
that historically accepted them as raw SQL.
- Refactor support plugin's ConnectionUtil: extract createConnectionViaAPI
(driverSearchTerm, displayName, ...) so Firebird and PostgreSQL can share the
fast programmatic-registration path; updateConnectionViaAPI takes the search
term too.
- CI workflow now also starts the pre-installed PostgreSQL service on
windows-latest (fastest option, no download), resets the postgres password,
creates the ui_test database, and passes -Dpostgres.* alongside -Dfirebird.*.
Artifact + JUnit-report globs widened to plugins/*/target/... so both test
plugins are covered. Firebird install continues to use the official
Inno-Setup installer unchanged.
- README updated to describe the multi-database scope.
… #40665
- New plugin local.dbeaver.postgresql.ui.test/ mirroring the Firebird one.
* PostgreSQLConnectionTest — creates a connection via the DBeaver API and
asserts it appears in the navigator.
* ScriptCommitRollbackTest — runs the repro script from dbeaver/dbeaver#40665
(DDL + INSERTs + COMMIT + ROLLBACK) via Alt+X and asserts no error dialog.
Guards against the PR's COMMIT/ROLLBACK interception regressing on databases
that historically accepted them as raw SQL.
- Refactor support plugin's ConnectionUtil: extract createConnectionViaAPI
(driverSearchTerm, displayName, ...) so Firebird and PostgreSQL can share the
fast programmatic-registration path; updateConnectionViaAPI takes the search
term too.
- CI workflow now also starts the pre-installed PostgreSQL service on
windows-latest (fastest option, no download), resets the postgres password,
creates the ui_test database, and passes -Dpostgres.* alongside -Dfirebird.*.
Artifact + JUnit-report globs widened to plugins/*/target/... so both test
plugins are covered. Firebird install continues to use the official
Inno-Setup installer unchanged.
- README updated to describe the multi-database scope.
… #40665
- New plugin local.dbeaver.postgresql.ui.test/ mirroring the Firebird one.
* PostgreSQLConnectionTest — creates a connection via the DBeaver API and
asserts it appears in the navigator.
* ScriptCommitRollbackTest — runs the repro script from dbeaver/dbeaver#40665
(DDL + INSERTs + COMMIT + ROLLBACK) via Alt+X and asserts no error dialog.
Guards against the PR's COMMIT/ROLLBACK interception regressing on databases
that historically accepted them as raw SQL.
- Refactor support plugin's ConnectionUtil: extract createConnectionViaAPI
(driverSearchTerm, displayName, ...) so Firebird and PostgreSQL can share the
fast programmatic-registration path; updateConnectionViaAPI takes the search
term too.
- CI workflow now also starts the pre-installed PostgreSQL service on
windows-latest (fastest option, no download), resets the postgres password,
creates the ui_test database, and passes -Dpostgres.* alongside -Dfirebird.*.
Artifact + JUnit-report globs widened to plugins/*/target/... so both test
plugins are covered. Firebird install continues to use the official
Inno-Setup installer unchanged.
- README updated to describe the multi-database scope.
… #40665
- New plugin local.dbeaver.postgresql.ui.test/ mirroring the Firebird one.
* PostgreSQLConnectionTest — creates a connection via the DBeaver API and
asserts it appears in the navigator.
* ScriptCommitRollbackTest — runs the repro script from dbeaver/dbeaver#40665
(DDL + INSERTs + COMMIT + ROLLBACK) via Alt+X and asserts no error dialog.
Guards against the PR's COMMIT/ROLLBACK interception regressing on databases
that historically accepted them as raw SQL.
- Refactor support plugin's ConnectionUtil: extract createConnectionViaAPI
(driverSearchTerm, displayName, ...) so Firebird and PostgreSQL can share the
fast programmatic-registration path; updateConnectionViaAPI takes the search
term too.
- CI workflow now also starts the pre-installed PostgreSQL service on
windows-latest (fastest option, no download), resets the postgres password,
creates the ui_test database, and passes -Dpostgres.* alongside -Dfirebird.*.
Artifact + JUnit-report globs widened to plugins/*/target/... so both test
plugins are covered. Firebird install continues to use the official
Inno-Setup installer unchanged.
- README updated to describe the multi-database scope.
|
Hi team 👋 — this PR has been sitting idle for about two weeks since my last reply, and I wanted to share some new evidence that I hope helps move the review forward. To rigorously address the concern that this change could break PostgreSQL (or other databases that historically accepted raw Results against
The manual-commit variant is the one that actually exercises this PR's routing path, since in auto-commit mode Screenshot artifacts from the run are attached to the CI job:
For anyone who'd like to reproduce this locally or just try the fix, unofficial pre-release Windows/Linux/macOS builds with this PR merged are at:
If there is a concrete scenario where the new routing is expected to misbehave, I'd be very happy to turn it into a failing test case — the harness is designed so that adding one is a ~30-line test class. Just let me know what to look for. Marking the PR as ready for review. Thanks for taking another look 🙏 |
When executing SQL scripts (Alt+X), COMMIT and ROLLBACK statements were sent as raw SQL to the database before being handled via the transaction manager API. This caused failures on databases where the JDBC driver manages transactions exclusively through the JDBC API (e.g., Firebird). Skip raw SQL execution for transaction control statements and delegate them to the existing transaction manager handling in the script execution loop, which correctly commits in manual mode and ignores in auto-commit. Assisted by: GitHub Copilot
5b90b8c to
4056936
Compare
Problem
When executing SQL scripts via Alt+X (Execute SQL Script), COMMIT and ROLLBACK statements are sent as raw SQL to the database. This causes failures on databases where the JDBC driver manages transactions exclusively through the JDBC API rather than accepting raw transaction control SQL.
For example, for the following SQL
Firebird fails with:
in both auto-commit and manual commit modes.
Root Cause
In
SQLQueryJob.executeSingleElement(), theExecuteStatement()method sends COMMIT/ROLLBACK as raw SQL before the existinghandleTransactionStatements()logic can handle them via the transaction manager API. The raw SQL execution fails for databases like Firebird, so the transaction manager handling is never reached.Fix
Intercept COMMIT/ROLLBACK statements at the beginning of
ExecuteSingleElement()and return early, delegating transaction handling to the existinghandleTransactionStatements()call in the script execution loop. This correctly:DBCTransactionManagerAPITesting
cd test && mvn clean verify)This PR was generated with AI (GitHub Copilot), supervised and tested by @fdcastel.