On 2020-11-10 07:24, Michael Paquier wrote:
>> Can you sketch how you would structure this? I realize it's not very
>> elegant, but I couldn't come up with a better way that didn't involve having
>> to duplicate some of the error messages into multiple branches.
>
> I think that I would use a StringInfo to build each sentence of the
> hint separately. The first sentence, "Is another postmaster already
> running on port %d?" is already known. Then the second sentence could
> be built depending on the two other conditions.
I'm not sure concatenating sentences like that is okay for translatability.
> FWIW, I think that it
> is confusing to mention in the hint to remove a socket file that
> cannot be removed.
Thinking about it further, I think the hint in the Unix-domain socket
case is bogus. A socket in the file-system namespace never reports
EADDRINUSE anyway, it just overwrites the file. For sockets in the
abstract namespace, you can get this error, but of course there is no
file to remove.
Perhaps we should change the hint in both the Unix and the IP cases to:
"Is another postmaster already running at this address?"
(This also resolves the confusing reference to "port" in the Unix case.)
Or we just drop the hint in the Unix case. The primary error message is
clear enough.
--
Peter Eisentraut
2ndQuadrant, an EDB company
https://www.2ndquadrant.com/