On Mon, Aug 20, 2018 at 7:32 AM Fabien COELHO <coe...@cri.ensmp.fr> wrote: > sh> psql "host=localhost,127.0.0.2,, hostaddr=127.0.0.1,,127.0.0.3," > # attempt 1 is 127.0.0.1 identified as localhost > # attempt 2 is 127.0.0.2 > # attempt 3 is 127.0.0.3 identified as the default, whatever it is > # attempt 4 is really the default
I think this patch is a solution in search of a problem. It's true that the above example is very confusing, but there's no reason for everybody to ever do that. It's like saying that C is a bad programming language because people can do this: https://www.ioccc.org/2018/anderson/prog.c Well, no. The fact that a programming language -- or a connection string -- can be used to create incomprehensible constructs is an artifact of it being powerful and flexible, not a defect. What users should do is just use host. If that causes name lookups they want to avoid, they should instead use both host and hostaddr. If they do that, they'll be fine. If they do strange things like specify host and hostaddr strings that don't match, then yes, it won't work very well. But the documentation already says that, so I don't really see why we need to change anything here. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company