Re: Add common function ReplicationOriginName.

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>
Subject: Re: Add common function ReplicationOriginName.
Date: 2022-09-27 11:33:50
Message-ID: CAJ7c6TMFioOjjU8AaK+edBqDbpA=bhoQsDaGHjrK1Uurz_-22A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Peter,

> PSA patch v3 to combine the different replication origin name
> formatting in a single function ReplicationOriginNameForLogicalRep as
> suggested.

LGTM except for minor issues with the formatting; fixed.

> I expect you can find more like just this if you look harder than I did.

Thanks. You are right, there are more places that pass int as the
second argument of *nprintf(). I used a command:

$ grep -r nprintf ./ | perl -lne 'print if($_ !~
/nprintf\([^\,]+,\s*(sizeof|([0-9A-Z_ \-]+\,))/ )' > found.txt

... and then re-checked the results manually. This excludes patterns
like *nprintf(..., sizeof(...)) and *nprintf(..., MACRO) and leaves
only something like *nprintf(..., variable). The cases where we
subtract an integer from a Size, etc were ignored.

I don't have a strong opinion on whether we should be really worried
by this. But in case we do, here is the patch. The order of 0001 and
0002 doesn't matter.

As I understand, ecpg uses size_t rather than Size, so for this
library I used size_t. Not 100% sure if the changes I made to
src/backend/utils/adt/jsonb.c add much value. I leave this to the
committer to decide.

--
Best regards,
Aleksander Alekseev

Attachment Content-Type Size
v4-0002-Add-common-function-ReplicationOriginNameForLogic.patch application/octet-stream 8.4 KB
v4-0001-Pass-Size-size_t-as-a-2nd-argument-of-snprintf.patch application/octet-stream 9.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-09-27 11:55:14 Re: has_privs_of_role vs. is_member_of_role, redux
Previous Message Zhang Mingli 2022-09-27 11:18:00 Re: Add more docs for pg_surgery?