Repository navigation
fix(spanner): dispatch PG SET SPANNER.EXCLUDE_TXN_FROM_CHANGE_STREAMS correctly - #15282
Merged
Merged
Conversation
… correctly ## Problem Statement - On PostgreSQL-dialect Cloud Spanner connections, executing `SET SPANNER.EXCLUDE_TXN_FROM_CHANGE_STREAMS = true` (or `TO true`) did not exclude subsequent transactions from change streams and instead toggled `SPANNER.RETURN_COMMIT_STATS`. - As a result, transactions explicitly marked to be excluded from change streams were still emitted to change streams, while commit statistics were unexpectedly enabled. ## Solution - Route PostgreSQL `SET SPANNER.EXCLUDE_TXN_FROM_CHANGE_STREAMS` statements to the change-stream exclusion setting instead of the commit-stats setting. - Executing `SET SPANNER.EXCLUDE_TXN_FROM_CHANGE_STREAMS` after a transaction has started or while a batch is active now fails with `FAILED_PRECONDITION` instead of silently mutating `SPANNER.RETURN_COMMIT_STATS`, matching GoogleSQL behavior.
Contributor
There was a problem hiding this comment.
Code Review
This pull request corrects the client-side statement method mapping for SET_EXCLUDE_TXN_FROM_CHANGE_STREAMS in PostgreSQL and expands test coverage by parameterizing ExcludeTxnFromChangeStreamsMockServerTest across all dialects. However, the parameterized test setup contains a critical issue: the @Parameters method returns a 1D array of Dialect values instead of a 2D array or an Iterable of arrays, which will lead to a ClassCastException during JUnit 4 test initialization.
olavloite
approved these changes
Dec 1, 2026
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.
Problem Statement
SET SPANNER.EXCLUDE_TXN_FROM_CHANGE_STREAMS = true(orTO true) did not exclude subsequent transactions from change streams and instead toggledSPANNER.RETURN_COMMIT_STATS.Solution
SET SPANNER.EXCLUDE_TXN_FROM_CHANGE_STREAMSstatements to the change-stream exclusion setting instead of the commit-stats setting.SET SPANNER.EXCLUDE_TXN_FROM_CHANGE_STREAMSafter a transaction has started or while a batch is active now fails withFAILED_PRECONDITIONinstead of silently mutatingSPANNER.RETURN_COMMIT_STATS, matching GoogleSQL behavior.