Re: Refactor to use common function 'get_publications_str'.

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Peter Smith <smithpb2250(at)gmail(dot)com>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Refactor to use common function 'get_publications_str'.
Date: 2024-10-24 06:41:15
Message-ID: ZxnsC_uVZrI1JmBO@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 24, 2024 at 05:27:25PM +1100, Peter Smith wrote:
> Yes, well spotted -- I was aware of that. Originally I had coded a >=
> PG15 check for that pub_names assignment. e.g.
>
> if (walrcv_server_version(LogRepWorkerWalRcvConn) >= 150000)
> GetPublicationsStr(MySubscription->publications, pub_names, true);

I was wondering about putting the call of GetPublicationsStr() in the
first block with the makeStringInfo(), have an Assert checking that
pub_names->data is never NULL in the second block, and destroy the
StringInfo only if it has been allocated.

> But, somehow it seemed messy to do that just to cater for something I
> thought was not particularly likely. OTOH, I am happy to put that
> check back in if you think it is warranted.

I think I would add it. The publication list is not mandatory, but
your patch makes it look so.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-10-24 06:43:26 Re: [BUG FIX] Fix validation of COPY options FORCE_NOT_NULL/FORCE_NULL
Previous Message Joel Jacobson 2024-10-24 06:41:03 Re: [BUG FIX] Fix validation of COPY options FORCE_NOT_NULL/FORCE_NULL