Tom Lane writes:
I also wonder why -w isn't the default.
Because it is not sufficiently reliable in start mode. See source code and archives.
I think we can improve -w, though. Here's what the code says about the section where it tries to use psql to determine that the postmaster is up and running:
# FIXME: This is horribly misconceived. # 1) If password authentication is set up, the connection will fail. # 2) If a virtual host is set up, the connection may fail. # 3) If network traffic filters are set up tight enough, the connection # may fail. # 4) When no Unix domain sockets are available, the connection will # fail. (Using TCP/IP by default ain't better.) # 5) If the dynamic loader is not set up correctly (for this user/at # this time), psql will fail (to find libpq). # 6) If psql is misconfigured, this may fail.
we could provide a password option to handle 1, and in C we can make the connection ourselves using libpq instead of relying on psql to do it for us, which should account for 5 and 6, I think.
For the cases of 2, 3 and 4 we can either try to detect it from the configuration settings, or suggest that users will need to use -W for such cases. To me it would be strange to have a setup where no connection from the machine where pg is running is possible, but maybe people do such odd things.
We can also try to come up with a better scheme for verifying that we have started properly - I will think about that.
cheers
andrew
---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives?
http://archives.postgresql.org