Refactor to use common function 'get_publications_str'.

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Refactor to use common function 'get_publications_str'.
Date: 2024-10-23 04:44:03
Message-ID: CAHut+PtJMk4bKXqtpvqVy9ckknCgK9P6=FeG8zHF=6+Em_Snpw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

During a code review, it was noticed that there are several places
within logical replication where a comma-separated list of publication
names is built explicitly. There is already a utility function (called
'get_publications_str') for doing this, but it was not being used in
every place it could have been.

This is a refactoring patch to make better use of the existing function.

Changes:

- The function has been moved and renamed to 'GetPublicationsStr'
because it is no longer static.

- Now function GetPublicationsStr is also being called from
tablesync.c, fetch_remote_table_info().

- I found fetch_remote_table_info() was building the same publication
list multiple times. In passing, fixed this to make the list only
once.

- Similarly, there was a duplicate list building code in
subscriptioncmds.c fetch_table_list(). Not a performance hit -- just
more code than needed. In passing, simplified this too.

~~~

Please take a look at the attached patch v1.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachment Content-Type Size
v1-0001-Refactor-to-use-common-function-GetPublicationsSt.patch application/octet-stream 10.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rahila Syed 2024-10-23 04:50:16 Re: Enhancing Memory Context Statistics Reporting
Previous Message Michel Pelletier 2024-10-23 04:15:30 Re: Using Expanded Objects other than Arrays from plpgsql