Skip to content

Custom parameters in pg connection string #1554

@mhamann

Description

@mhamann

I'm attempting to use the Postgres driver for SQLx to connect to a hosted CockroachDB. Due to the server implementation, the connection requires passing in some custom parameters, so the connection string looks like this:

let pool = PgPool::connect(
  "postgres://user:[email protected]:26257/db?options=--cluster%3Dmy-serverless-db-1234"
).await?;

Based on the error I get back (Error: error returned from database: codeParamsRoutingFailed: missing cluster name in connection string), it seems like SQLx is dropping the unknown options param from the query string because it's unrecognized.

Is there a good workaround for this presently or would we need to add support for an arbitrary map of options when connection?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions