Re: Allowing printf("%m") only where it actually works - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Allowing printf("%m") only where it actually works
Date
Msg-id 20180528150125.j2x3mp62ssbeg3h5@alvherre.pgsql
Whole thread Raw
In response to Re: Allowing printf("%m") only where it actually works  (Thomas Munro <thomas.munro@enterprisedb.com>)
Responses Re: Allowing printf("%m") only where it actually works  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2018-May-27, Thomas Munro wrote:

> Out of curiosity I tried adding a GetLastError variable for Windows
> (to hide the function of that name and break callers) to the earlier
> experimental patch (attached).  I had to give it an initial value to
> get rid of a warning about an unused variable (by my reading of the
> documentation, __pragma(warning(suppress:4101)) can be used in macros
> (unlike #pragma) and should shut that warning up, but it doesn't work
> for me, not sure why).  Of course that produces many errors since we
> do that all over the place:
> 
> https://ci.appveyor.com/project/macdice/postgres/build/1.0.184

Ouch.

This seems to say that we oughta assign GetLastError() to saved_errno
during errstart, then use %m in the errmsg() instead.

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


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Undo logs
Next
From: "Nishant, Fnu"
Date:
Subject: Re: found xmin from before relfrozenxid on pg_catalog.pg_authid