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

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Allowing printf("%m") only where it actually works
Дата
Msg-id 20180925154829.rbjxmmcpd5z7ueyq@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: Allowing printf("%m") only where it actually works  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Allowing printf("%m") only where it actually works  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2018-Sep-25, Tom Lane wrote:

> Michael Paquier <michael@paquier.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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PG vs macOS Mojave
Следующее
От: Mark Dilger
Дата:
Сообщение: Re: FETCH FIRST clause PERCENT option