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

fix(pg-v5): Fix databasename for URLs with query element and be more consistent #1882

Merged
merged 1 commit into from
Nov 15, 2021

Conversation

kbarber
Copy link
Contributor

@kbarber kbarber commented Nov 11, 2021

For operations such as pg:psql, we have been assuming that the URL parsed path method is enough to find the database name. This is incorrect when we pass parameters such as sslmode. In general, this problem has been solved with parsePostgresConnectionString but not everything uses it.

This fix removes any custom parsing we are doing of URLs and moves to using this function everywhere to avoid inconsistency.

  • util.databaseNameFromUrl
  • util.getConnectionDetails
  • the pg:copy resolver

Without this, pg:psql was failing on verify-full URL's but with this patch, it works fine.

@kbarber kbarber self-assigned this Nov 11, 2021
@kbarber kbarber added the pg heroku postgresql commmands label Nov 11, 2021
@kbarber kbarber changed the title Handle PostgreSQL URLs that contain query elements fix(pg-v5): Handle PostgreSQL URLs that contain query elements Nov 12, 2021
…consistent

For operations such as pg:psql, we have been assuming that the URL parsed path
method is enough to find the database name. This is incorrect when we pass
parameters such as sslmode. In general, this problem has been solved with
parsePostgresConnectionString but not everything uses it.

This fix removes any custom parsing we are doing of URLs and moves to using
this function everywhere to avoid inconsistency.

* util.databaseNameFromUrl
* util.getConnectionDetails
* the pg:copy resolver

Without this, pg:psql was failing on verify-full URL's but with this patch, it works fine.
@kbarber kbarber changed the title fix(pg-v5): Handle PostgreSQL URLs that contain query elements fix(pg-v5): Fix databasename for URLs with query element and be more consistent Nov 12, 2021
@kbarber kbarber force-pushed the support_url_parameters_for_pgpsql branch from 2734866 to 45862c1 Compare November 12, 2021 16:25
@kbarber kbarber marked this pull request as ready for review November 12, 2021 16:34
@kbarber kbarber requested a review from a team as a code owner November 12, 2021 16:34
Copy link
Contributor

@tevanoff tevanoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 👍

@kbarber
Copy link
Contributor Author

kbarber commented Nov 15, 2021

Looks great! 👍

Thanks for the review :-).

@kbarber kbarber merged commit 5346faf into master Nov 15, 2021
@kbarber kbarber deleted the support_url_parameters_for_pgpsql branch November 15, 2021 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pg heroku postgresql commmands
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants