Re: Using the %m printf format more

From: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Using the %m printf format more
Date: 2024-03-22 13:58:24
Message-ID: 87cyrmjrlr.fsf@wibble.ilmari.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> writes:

> Michael Paquier <michael(at)paquier(dot)xyz> writes:
>
>> On Wed, Mar 13, 2024 at 02:33:52PM +0100, Peter Eisentraut wrote:
>>> The 0002 patch looks sensible. It would be good to fix that, otherwise it
>>> could have some confusing outcomes in the future.
>>
>> You mean if we begin to use %m in future callers of
>> emit_tap_output_v(), hypothetically? That's a fair argument.
>
> Yeah, developers would rightfully expect to be able to use %m with
> anything that takes a printf format string. Case in point: when I was
> first doing the conversion I did change the bail() and diag() calls in
> pg_regress to %m, and only while I was preparing the patch for
> submission did I think to check the actual implementation to see if it
> was safe to do so.
>
> The alternative would be to document that you can't use %m with these
> functions, which is silly IMO, given how simple the fix is.
>
> One minor improvement I can think of is to add a comment by the
> save_errno declaration noting that it's needed in order to support %m.

Here's an updated patch that adds such a comment. I'll add it to the
commitfest later today unless someone commits it before then.

> - ilmari

Attachment Content-Type Size
v2-0001-Save-errno-in-emit_tap_output_v-and-use-m-in-call.patch text/x-diff 8.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sergey Prokhorenko 2024-03-22 13:58:59 Re: UUID v7
Previous Message Bertrand Drouvot 2024-03-22 13:47:34 Re: Introduce XID age and inactive timeout based replication slot invalidation