Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom parameters in pg connection string #1554

Closed
mhamann opened this issue Nov 23, 2021 · 2 comments
Closed

Custom parameters in pg connection string #1554

mhamann opened this issue Nov 23, 2021 · 2 comments

Comments

@mhamann
Copy link

mhamann commented Nov 23, 2021

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:pass@free-tier.gcp-us-central1.cockroachlabs.cloud: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?

@abonander
Copy link
Collaborator

That's actually being worked on in #1539 right now.

@abonander
Copy link
Collaborator

Closed by #1539

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

No branches or pull requests

2 participants