Skip to content

feat(postgres): add PgSocketConnector hook to PgConnectOptions - #4522

Closed
ropoctl wants to merge 1 commit into
transact-rs:mainfrom
ropoctl:feat/pg-socket-connector
Closed

ropoctl wants to merge 1 commit into
transact-rs:mainfrom
ropoctl:feat/pg-socket-connector

Conversation

@ropoctl

@ropoctl ropoctl commented Nov 12, 2026 •

Copy link
Copy Markdown

Does your PR solve an issue?

fixes #4523

Is this a breaking change?

No. PgConnectOptions fields are pub(crate), socket_connector defaults to None (preserving existing TCP, Unix domain socket, and TLS behavior unchanged), and PgSocketConnector + PgConnectOptions::socket_connector are purely additive APIs.

Summary

  • Adds pub trait PgSocketConnector and PgConnectOptions::socket_connector(Arc<dyn PgSocketConnector>) to sqlx-postgres (and re-exports PgSocketConnector from sqlx_postgres / sqlx::postgres).
  • Updates PgStream::connect to use options.socket_connector exclusively when configured, without falling back to TCP or Unix domain sockets on error.
  • Preserves the connector across PgConnectOptions::clone() so PgPool reconnects continue using the application-supplied transport.

@ropoctl
ropoctl force-pushed the feat/pg-socket-connector branch from bce56f4 to b7bb09a Compare November 12, 2026 10:26
@abonander

Copy link
Copy Markdown
Collaborator

This is not the direction I'd like to go in with this API. See #4281, which I still owe a review to.

@abonander abonander closed this Nov 19, 2026
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.

Allow custom transport connector (PgSocketConnector) on PgConnectOptions

2 participants