On Tue, Nov 1, 2016 at 2:03 AM, Mithun Cy <mithun...@enterprisedb.com> wrote: > On Thu, Oct 27, 2016 at 11:15 PM, Robert Haas <robertmh...@gmail.com> wrote: >> Thanks. Here's a new version with a fix for that issue and also a fix >> for PQconnectionNeedsPassword(), which was busted in v1. > I did some more testing of the patch for both URI and (host, port) parameter > pairs. I did test for ipv4, ipv6, UDS type of sockets, Also tested different > password using .pgpass. I did not see any major issue with. All seems to > work as defined. Tested the behaviors of API PQport, PQhost, PQpass, PQreset > all works as defined. > > I also have following observation which can be considered if it is valid. > > 1. URI do not support UDS, where as (host,port) pair support same. > But there is one problem with this, instead of reporting it, we discard the > URI input (@conninfo_uri_parse_options) and try to connect to default unix > socket > > [mithun@localhost bin]$ ./psql > postgres:///home/mithun:5555,127.0.0.1:5555/postgres -U mithun > psql: could not connect to server: No such file or directory > Is the server running locally and accepting > connections on Unix domain socket "/tmp/.s.PGSQL.5432"? > server is running on both the sockets.
That's the wrong syntax. If you look in https://www.postgresql.org/docs/devel/static/libpq-connect.html under "32.1.1.2. Connection URIs", it gives an example of how to include a slash in a pathname. You have to use %2F, or else the URL parser will think you're starting a new section of the URI. I believe this works fine if you use the correct syntax. > 2. If we fail to connect we get an error message for each of the addrinfo we > tried to connect, wondering if we could simplify same. Just a suggestion. > [mithun@localhost bin]$ ./psql postgres://,,,,,,,/postgres > psql: could not connect to server: Connection refused > Is the server running on host "" (::1) and accepting > TCP/IP connections on port 5432? > could not connect to server: Connection refused > Is the server running on host "" (127.0.0.1) and accepting > TCP/IP connections on port 5432? > could not connect to server: Connection refused > Is the server running on host "" (::1) and accepting > TCP/IP connections on port 5432? > could not connect to server: Connection refused > Is the server running on host "" (127.0.0.1) and accepting > TCP/IP connections on port 5432? > could not connect to server: Connection refused > Is the server running on host "" (::1) and accepting > TCP/IP connections on port 5432? > could not connect to server: Connection refused > Is the server running on host "" (127.0.0.1) and accepting > TCP/IP connections on port 5432? > could not connect to server: Connection refused > Is the server running on host "" (::1) and accepting > TCP/IP connections on port 5432? > could not connect to server: Connection refused > Is the server running on host "" (127.0.0.1) and accepting > TCP/IP connections on port 5432? > could not connect to server: Connection refused > Is the server running on host "" (::1) and accepting > TCP/IP connections on port 5432? > could not connect to server: Connection refused > Is the server running on host "" (127.0.0.1) and accepting > TCP/IP connections on port 5432? > could not connect to server: Connection refused > Is the server running on host "" (::1) and accepting > TCP/IP connections on port 5432? > could not connect to server: Connection refused > Is the server running on host "" (127.0.0.1) and accepting > TCP/IP connections on port 5432? > could not connect to server: Connection refused > Is the server running on host "" (::1) and accepting > TCP/IP connections on port 5432? > could not connect to server: Connection refused > Is the server running on host "" (127.0.0.1) and accepting > TCP/IP connections on port 5432? > could not connect to server: Connection refused > Is the server running on host "" (::1) and accepting > TCP/IP connections on port 5432? > could not connect to server: Connection refused > Is the server running on host "" (127.0.0.1) and accepting > TCP/IP connections on port 5432? That output seems fine to me. In a real connection string, you're not likely to have so many duplicated addresses, and it's good for the error message to make clear which addresses were tried and what happened for each one. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers