From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Amit Kapila <akapila@postgresql.org>
Cc: pgsql-committers <pgsql-committers@lists.postgresql.org>
Subject: Re: pgsql: Allow multiple xacts during table sync in logical replication.
Date: Fri, 12 Feb 2021 17:50:07 -0500
Message-ID: <1610789.1613170207@sss.pgh.pa.us> (raw)
In-Reply-To: <CAA4eK1+zW+XVi67+hiFQ9P2Drh1GEg8+juXNaYDtKWCPx0vw6A@mail.gmail.com>
References: <E1lAO3w-0005Je-0p@gemulon.postgresql.org>
<CAA4eK1+caxb7jD=OWkLEEHs-AMAHQef3QD_pkj2=nZkOX-ziUA@mail.gmail.com>
<1519064.1613099867@sss.pgh.pa.us>
<CAA4eK1+ATy4ES85Ku83MMjZBGza_9OU7w+FV+5m+GxKFCHLkrA@mail.gmail.com>
<CAA4eK1+zW+XVi67+hiFQ9P2Drh1GEg8+juXNaYDtKWCPx0vw6A@mail.gmail.com>
Various buildfarm members are complaining about this patch, eg
caiman | 2021-02-12 15:00:19 | tablesync.c:885:70: warning: argument 3 of type 'char[64]' with mismatched bound [-Warray-parameter=]
caiman | 2021-02-12 15:00:19 | tablesync.c:904:72: warning: argument 3 of type 'char[64]' with mismatched bound [-Warray-parameter=]
That's because of the inconsistency between
extern void ReplicationOriginNameForTablesync(Oid suboid, Oid relid, char *originname);
and
void
ReplicationOriginNameForTablesync(Oid suboid, Oid relid,
char originname[NAMEDATALEN])
Don't do that. Quite aside from the inconsistency, this is pretty
darn unsafe coding technique, because there is exactly nothing
guaranteeing that the caller passes a buffer of the length the
function expects.
I'm not real sure that you could expect a compiler warning for that
even if you'd put the length declaration where callers could see it.
So personally I'd avoid hard-wiring NAMEDATALEN into this API at all,
and have the caller pass sizeof(its buffer) instead.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us, amit.kapila16@gmail.com, akapila@postgresql.org
Subject: Re: pgsql: Allow multiple xacts during table sync in logical replication.
In-Reply-To: <1610789.1613170207@sss.pgh.pa.us>
References: <E1lAO3w-0005Je-0p@gemulon.postgresql.org> <CAA4eK1+caxb7jD=OWkLEEHs-AMAHQef3QD_pkj2=nZkOX-ziUA@mail.gmail.com> <1519064.1613099867@sss.pgh.pa.us> <CAA4eK1+ATy4ES85Ku83MMjZBGza_9OU7w+FV+5m+GxKFCHLkrA@mail.gmail.com> <CAA4eK1+zW+XVi67+hiFQ9P2Drh1GEg8+juXNaYDtKWCPx0vw6A@mail.gmail.com> <1610789.1613170207@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox