Repository navigation
Respect the port in DATABASE_URL for PostgreSQL Unix sockets - #6877
Open
officialasishkumar wants to merge 1 commit into
Open
officialasishkumar wants to merge 1 commit into
officialasishkumar wants to merge 1 commit into
Conversation
When `DATABASE_URL` pointed to a Unix socket directory (a `%2F`-encoded host or an empty host with a `host` query parameter), the port was dropped. PostgreSQL appends the port to the name of the socket file (`.s.PGSQL.<port>`), so Postgrex always connected to `.s.PGSQL.5432` and instances running on another port could not be reached over a socket. The port is now read from the URL authority (`postgresql://user:pass@%2Frun%2Fpostgresql:5433/db`) or from the `port` query parameter (`postgresql:///db?host=/run/postgresql&port=5433`) and passed to the repo config. A port that is not an integer raises an `ArgumentError` on boot instead of being silently ignored.
|
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Part of #5593 (the
portpart of the report)When
DATABASE_URLpoints to a Unix socket directory (a%2F-encoded host, or an empty host with ahostquery parameter), the port was dropped. PostgreSQL appends the port to the socket file name (.s.PGSQL.<port>), so Postgrex always connected to.s.PGSQL.5432and a server listening on another port could not be reached over a socket.The port is now read from the URL authority or from the
portquery parameter and passed to the repo config:A port that is not an integer raises an
ArgumentErroron boot instead of being silently ignored. URLs without a port behave as before.Tests
Changelog
Documentation
Dark mode