Re: Add common function ReplicationOriginName. - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: Add common function ReplicationOriginName.
Date
Msg-id CAJ7c6TMFioOjjU8AaK+edBqDbpA=bhoQsDaGHjrK1Uurz_-22A@mail.gmail.com
Whole thread Raw
In response to Re: Add common function ReplicationOriginName.  (Peter Smith <smithpb2250@gmail.com>)
Responses Re: Add common function ReplicationOriginName.
List 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

pgsql-hackers by date:

Previous
From: Zhang Mingli
Date:
Subject: Re: Add more docs for pg_surgery?
Next
From: Robert Haas
Date:
Subject: Re: has_privs_of_role vs. is_member_of_role, redux