Skip to content

feat(source/postgres): add queryExecMode to managed sources#3378

Open
Swing-G wants to merge 1 commit into
googleapis:mainfrom
Swing-G:feat/source-postgres-query-exec-mode
Open

feat(source/postgres): add queryExecMode to managed sources#3378
Swing-G wants to merge 1 commit into
googleapis:mainfrom
Swing-G:feat/source-postgres-query-exec-mode

Conversation

@Swing-G

@Swing-G Swing-G commented Jun 8, 2026

Copy link
Copy Markdown

Description

Adds queryExecMode support to the AlloyDB for PostgreSQL and Cloud SQL for PostgreSQL sources, using the same pgx query execution mode parser as the PostgreSQL source.

This lets managed Postgres sources opt into modes such as simple_protocol when prepared statement caching is not compatible with the connection pooler.

PR Checklist

  • Make sure you reviewed CONTRIBUTING.md
  • Make sure to open an issue as a bug/issue before writing your code
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)
  • Make sure to add ! if this involve a breaking change

Tests:

  • GOTOOLCHAIN=local go test -count=1 ./internal/sources/postgres ./internal/sources/alloydbpg ./internal/sources/cloudsqlpg

Fixes #2385.

@Swing-G Swing-G requested review from a team as code owners June 8, 2026 08:14
@google-cla

google-cla Bot commented Jun 8, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@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 introduces support for configuring the queryExecMode (pgx query execution mode) for AlloyDB and Cloud SQL PostgreSQL sources. It adds the queryExecMode field to the respective configuration structs with validation, updates the connection pool initialization to apply this setting, and adds unit tests to verify parsing of valid and invalid execution modes. Additionally, it extracts the common query execution mode parsing logic into a shared helper function ParsePGXQueryExecMode in internal/sources/pgx.go and refactors the existing Postgres source to use it. No review comments were provided, so there is no feedback to address.

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.

Support field to update pgx QueryExecMode in postgres source

2 participants