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

Add a new example usage that reminds the user to utilize the escape method for the connection string #1897

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

karminski
Copy link

For certain Golang database driver libraries, such as go-sql-driver the connection string is automatically escaped by the library itself. Therefore, I believe it is crucial to inform users whether the connection string requires escaping or not.

…d for the connection string.

Add new example usage code to remind the user to use the escape method for the connection string.
@jackc
Copy link
Owner

jackc commented Feb 6, 2024

The example would no longer represent idiomatic usage. If the application is has the host, user name, password, etc. individually then it should call pgx.ParseConfig("") and manually set the fields on the returned *pgx.ConnConfig. In this case, the password would not need to be escaped.

@jackc
Copy link
Owner

jackc commented Feb 6, 2024

I think that adding a note to the ParseConfig function to this effect would be better. Possible the note would simply mention that URLs are parsed by the Go standard URL parser and must be properly escaped.

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.

2 participants