feat(c/driver/postgresql): avoid commit/rollback when idle#2685
Merged
Conversation
This avoids spamming the server-side log with "WARNING: there is no transaction in progress" messages. Fixes apache#2673.
There was a problem hiding this comment.
Copilot reviewed 2 out of 4 changed files in this pull request and generated no comments.
Files not reviewed (2)
- c/driver/postgresql/connection.cc: Language not supported
- c/driver/postgresql/postgresql_test.cc: Language not supported
Comments suppressed due to low confidence (1)
python/adbc_driver_postgresql/tests/test_dbapi.py:454
- [nitpick] Consider renaming the local function 'status' to a more descriptive name like 'get_transaction_status' to improve clarity.
def status() -> str:
paleolimbot
approved these changes
Apr 8, 2025
Comment on lines
+1041
to
+1049
| adbc_validation::StreamReader reader; | ||
| ASSERT_THAT(AdbcStatementSetSqlQuery(&statement, "SELECT 1", &error), | ||
| IsOkStatus(&error)); | ||
| ASSERT_THAT(AdbcStatementExecuteQuery(&statement, &reader.stream.value, | ||
| &reader.rows_affected, &error), | ||
| IsOkStatus(&error)); | ||
| ASSERT_NO_FATAL_FAILURE(reader.GetSchema()); | ||
|
|
||
| ASSERT_EQ("active", ConnectionGetOption(&connection, txn_status, &error)); |
Member
There was a problem hiding this comment.
Is this repeat of the above block needed to capture the issue? (If so, maybe briefly explain why somewhere?)
| ASSERT_EQ("active", ConnectionGetOption(&connection, txn_status, &error)); | ||
|
|
||
| // Note that despite the status being "active", this commit still | ||
| // generates a warning on the server. |
Member
There was a problem hiding this comment.
Suggested change
| // generates a warning on the server. | |
| // generates a warning on the server because no changes were made to the database during the transaction. |
(or the actual reason if I guessed wrong 🙂 )
Member
Author
There was a problem hiding this comment.
I believe that's it, I just don't get why ROLLBACK doesn't trigger the same thing
Member
Author
There was a problem hiding this comment.
Ah...I figured it out. We need to explicitly start a new transaction after a ROLLBACK.
colin-rogers-dbt
pushed a commit
to dbt-labs/arrow-adbc
that referenced
this pull request
Jun 10, 2025
This avoids spamming the server-side log with "WARNING: there is no transaction in progress" messages. Also, fix ConnectionRollback not properly starting a new transaction afterwards. Fixes apache#2673.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This avoids spamming the server-side log with "WARNING: there is no transaction in progress" messages.
Also, fix ConnectionRollback not properly starting a new transaction afterwards.
Fixes #2673.