Skip to content

fix(spanner): fix PG SHOW isolation level statements - #14904

Open
rayudu3745 wants to merge 1 commit into
googleapis:mainfrom
rayudu3745:fix/show-transaction-isolation
Open

rayudu3745 wants to merge 1 commit into
googleapis:mainfrom
rayudu3745:fix/show-transaction-isolation

Conversation

@rayudu3745

Copy link
Copy Markdown
Contributor

For PostgreSQL-dialect databases, the isolation level SHOW statements returned Java enum names and did not resolve an unspecified isolation level:

Statement Before After
SHOW TRANSACTION ISOLATION LEVEL / SHOW default_transaction_isolation with no isolation level set on the connection ISOLATION_LEVEL_UNSPECIFIED the database default, e.g. repeatable read (serializable if the database has no default)
Same, with an explicit level (e.g. REPEATABLE_READ) REPEATABLE_READ repeatable read
SHOW transaction_isolation not supported (SHOW queries are not supported) same as SHOW TRANSACTION ISOLATION LEVEL

PostgreSQL drivers expect the PostgreSQL names. For example, pgjdbc's getTransactionIsolation() does not recognize REPEATABLE_READ.

Changes

  • Resolve an unspecified isolation level with DatabaseClient#getDatabaseDefaultIsolationLevel() (chore(spanner): expose database default isolation level #14806), falling back to SERIALIZABLE when the database has no default. If this client does not recognize the database default, the statement fails with FAILED_PRECONDITION.
  • Return PostgreSQL isolation level names (serializable, repeatable read).
  • Add SHOW transaction_isolation, the PostgreSQL name for SHOW TRANSACTION ISOLATION LEVEL.

@rayudu3745
rayudu3745 requested review from a team as code owners November 3, 2026 11:56

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for retrieving and formatting the transaction isolation level, resolving unspecified isolation levels to the database default, and formatting them appropriately based on the dialect (such as PostgreSQL). It also introduces the SHOW [VARIABLE] TRANSACTION_ISOLATION client-side statement for PostgreSQL, along with comprehensive unit and integration tests to verify these behaviors. I have no feedback to provide as the review comment was filtered out.

@rayudu3745

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Spanner connection statement executor to correctly resolve and format transaction isolation levels, specifically handling PostgreSQL-specific formatting (e.g., 'serializable' and 'repeatable read') and resolving unspecified isolation levels to the database default. It also introduces support for the SHOW [VARIABLE] TRANSACTION_ISOLATION client-side statement in the PostgreSQL dialect, along with comprehensive unit and integration tests to verify these behaviors. There are no review comments provided, and I have no additional feedback on these changes.

@rayudu3745
rayudu3745 requested a review from olavloite November 3, 2026 12:24

This branch has not been deployed

No deployments
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.

1 participant