Re: Allowing printf("%m") only where it actually works

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Allowing printf("%m") only where it actually works
Date: 2018-09-25 15:48:29
Message-ID: 20180925154829.rbjxmmcpd5z7ueyq@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2018-Sep-25, Tom Lane wrote:

> Michael Paquier <michael(at)paquier(dot)xyz> writes:

> > Ok. I won't fight hard on that. Why changing the error message from
> > "could not load netmsg.dll" to "unrecognized winsock error" then? The
> > original error string is much more verbose to grab the context.
>
> As the code stands, what you'll get told about is the error code
> returned by the failed LoadLibrary call; the original winsock error
> code is reported nowhere. I think that's backwards.

I agree that the winsock problem is the main one we should be reporting,
including its numeric error code. Even if we can't translate it, the
numeric value can be translated by web-searching, if it comes to that.

> We could possibly write something like
>
> sprintf(wserrbuf, "winsock error %d (could not load netmsg.dll to translate: error code %lu)", err, GetLastError())));
>
> but I'm unconvinced that that's useful.

Actually I think it *is* useful to do it like this, because then the
user knows to fix the netmsg.dll problem so that they can continue to
investigate the winsock problem. If we don't report the secondary error
message, how are users going to figure out how to fix the problem?

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Dilger 2018-09-25 15:54:48 Re: FETCH FIRST clause PERCENT option
Previous Message Tom Lane 2018-09-25 15:14:12 Re: PG vs macOS Mojave