Closed PuercoPop closed 10 months ago
The Unix socket fallback is not implemented in this library - in libpq it depends on knowledge of the Postgres Unix socket directory which is set at Postgres compilation time and varies between distros.
@sfackler Ok, so should I close the issue? Is it worth it detect that syntax was used and notify the that that syntax is not supported?
Yeah unfortunately there isn't really anything we can do to make this work like it does for libpq.
Ej. the URL
postgresql:://myuser@/mydb
is rejected by rust-postgres but is accepted by psql. ej. The following command succedsBut when calling
Client::connect("postgresql:://myuser@/mydb", NoTls)
we getFrom the PostgreSQL documentation this is a valid URL. Quoting relevant sections below:
And the grammar marks the host as optional as well
I looked briefly into how would fixing the issue would look like and iiuc I need to make the following test pass.
One point of contention is what should the host_path be set to if the host is omitted. The documentation above only talks above standard unix-domain socket directory. The following link suggests that it should be
/tmp
on a vanilla PostgreSQL install. But that Debian and derivatives use /var/run/postgresql. In NixOS (my scenario) the default unix-domain socket directory is /run/postgresql. :shrug:Note that although I encountered this error in production it is not a blocker as the workaround is straightforward.