Re: fix "Success" error messages - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: fix "Success" error messages
Date
Msg-id 36d38542-63e9-b73c-09fe-bd5e32e06066@2ndquadrant.com
Whole thread Raw
In response to Re: fix "Success" error messages  (Michael Paquier <michael@paquier.xyz>)
Responses Re: fix "Success" error messages
List pgsql-hackers
On 2019-06-19 04:51, Michael Paquier wrote:
> On Tue, Jun 18, 2019 at 09:13:19AM -0700, Shawn Debnath wrote:
>>>          case SLRU_WRITE_FAILED:
>>>              ereport(ERROR,
>>>                      (errcode_for_file_access(),
>>>                       errmsg("could not access status of transaction %u", xid),
>>> -                     errdetail("Could not write to file \"%s\" at offset %u: %m.",
>>> -                               path, offset)));
>>> +                     errno == 0
>>> +                     ? errdetail("Short write to file \"%s\" at offset %u.", path, offset)
>>> +                     : errdetail("Could not write to file \"%s\" at offset %u: %m.",
>>> +                                 path, offset)));
> 
> There is no point to call errcode_for_file_access() if we know that
> errno is 0.  Not a big deal, still..  The last time I looked at that,
> the best way I could think of would be to replace slru_errcause with a
> proper error string generated at error time.  Perhaps the partial
> read/write case does not justify this extra facility.  I don't know.
> At least that would be more flexible.

Here is an updated patch set that rearranges this a bit according to
your suggestions, and also fixes some similar issues in pg_checksums.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: "ago" times on buildfarm status page
Next
From: Tom Lane
Date:
Subject: Re: assertion at postmaster start