Re: Increase footprint of %m and reduce strerror()

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2019-12-06T05:09:05Z
Lists: pgsql-hackers

Attachments

On Thu, Dec 05, 2019 at 12:29:29PM +0900, Kyotaro Horiguchi wrote:
> At Thu, 05 Dec 2019 12:06:54 +0900 (JST), Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote in 
>> So, (IIUC) do we replace fprintf()s for error reporting together (but
>> maybe in a separate patch)?

I guess that we should do that at the end of the day.  A lookup at the
in-core tools I see three areas which stand out compared to the rest:
- pg_waldump, and attached is a patch for it.
- pgbench.  However for this one we also have some status messages
showing up in stderr output, and the TAP tests have dependencies with
the output generated.  This part is not plugged into the generic
logging facility yet, and we have 162 places where fprintf/stderr is
used, so that's kind of messy.
- pg_standby.  For this one, we may actually be closer to just remove
it from the tree :)
--
Michael

Commits

  1. Replace use of strerror() with %s by %m in pg_waldump

  2. Implement %m in src/port/snprintf.c, and teach elog.c to rely on that.