Re: fix psql \conninfo & \connect when using hostaddr
От | Fabien COELHO |
---|---|
Тема | Re: fix psql \conninfo & \connect when using hostaddr |
Дата | |
Msg-id | alpine.DEB.2.21.1811081107130.22503@lancre обсуждение исходный текст |
Ответ на | Re: fix psql \conninfo & \connect when using hostaddr (Robert Haas <robertmhaas@gmail.com>) |
Список | pgsql-hackers |
Hello Robert, >> psql> \conninfo >> You are connected to database "fabien" as user "fabien" on host "foo" at port "5432". > > I remain of the opinion that this is not a bug. You told it that foo > has address 127.0.0.1 and it believed you; that's YOUR fault. Hmmm. For me, if a user asks \conninfo for connection information, they expect to be told what the connection actually is, regardless of the initial connection string. Another more stricking instance: sh> psql "host=/tmp port=5432 hostaddr=127.0.0.1" ... fabien=# \conninfo You are connected to database "fabien" as user "fabien" via socket in "/tmp" at port "5432". SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off) It says that there is a socket, but there is none. The SSL bit is a giveaway, there is no SSL on Unix-domain sockets. >> sh> psql "host=foo hostaddr=127.0.0.1" >> >> psql> \conninfo >> You are connected to database "fabien" as user "fabien" on host "foo" (address "127.0.0.1") at port "5432". > > Nevertheless, that seems like a reasonable change to the output. Will > your patch show the IP address in all cases or only when hostaddr is > specified? It is always printed, unless both host & address are equal. The rational is that it is also potentially useful for multi-ip dns resolutions, and generating a valid hostaddr allows \connect defaults to reuse the actual same connection, including the IP that was chosen. Also, the added information is quite short, and if a user explicitely asks for connection information, I think they can handle the slightly expanded answer. -- Fabien.
В списке pgsql-hackers по дате отправления: