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

Output sql_insert with postgres fails if password contains { character #3230

Closed
TunaYagci opened this issue Mar 3, 2025 · 4 comments
Closed

Comments

@TunaYagci
Copy link

Hey there, if the password contains { character, sql_insert for postgres driver fails with:

Failed to send message to sql_insert: parse "postgres://omitted": net/url: invalid userinfo

tested with the latest docker container

@rockwotj
Copy link
Collaborator

rockwotj commented Mar 4, 2025

Hey @TunaYagci you need to URL escape passwords in the dsn.

@TunaYagci
Copy link
Author

Hey @TunaYagci you need to URL escape passwords in the dsn.

You mean escaping the url in my local and using that value in the configuration, right? Assuming I have dsl config like:

postgres://user:testPassword{}@host:5432/db

And I escape the password in my local like:

fmt.Println(url.QueryEscape("testPassword{}")); // outputs testPassword%7B%7D

so I replaced my dsn like:

postgres://user:testPassword%7B%7D@host:5432/db

this solves the net/url issue but sadly leads to connection errors:

Failed to send message to sql_insert: read tcp ip1->ip2:5432: read: connection reset by peer

Can I escape the password directly in the config somehow? I thought DSN field doesn't support interpolation.

@rockwotj
Copy link
Collaborator

rockwotj commented Mar 4, 2025

DSN does not support interpolation and at the moment it is not possible to apply these transformations at the moment for secret values either.

@TunaYagci
Copy link
Author

mine was a network issue, it got resolved now. I think it would be nice if this URL escape detail is mentioned in the docs. thanks for the help!

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