Re: Column Filtering in Logical Replication - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Column Filtering in Logical Replication
Date
Msg-id 202107210014.py4k662aarq5@alvherre.pgsql
Whole thread Raw
In response to Re: Column Filtering in Logical Replication  (Rahila Syed <rahilasyed90@gmail.com>)
List pgsql-hackers
Hello,

I think this looks good regarding the PublicationRelationInfo API that was
discussed.

Looking at OpenTableList(), I think you forgot to update the comment --
it says "open relations specified by a RangeVar list", but the list is
now of PublicationTable.  Also I think it would be good to say that the
returned tables are PublicationRelationInfo, maybe such as "In the
returned list of PublicationRelationInfo, the tables are locked ..."

In AlterPublicationTables() I was confused by some code that seemed
commented a bit too verbosely (for a moment I thought the whole list was
being copied into a different format).  May I suggest something more
compact like

            /* Not yet in list; open it and add it to the list */
            if (!found)
            {
                Relation    oldrel;
                PublicationRelationInfo *pubrel;
               
                oldrel = table_open(oldrelid, ShareUpdateExclusiveLock);

                /* Wrap it in PublicationRelationInfo */
                pubrel = palloc(sizeof(PublicationRelationInfo));
                pubrel->relation = oldrel;
                pubrel->relid = oldrelid;
                pubrel->columns = NIL;        /* not needed */

                delrels = lappend(delrels, pubrel);
            }

Thanks!

-- 
Álvaro Herrera           39°49'30"S 73°17'W  —  https://www.EnterpriseDB.com/



pgsql-hackers by date:

Previous
From: Zhihong Yu
Date:
Subject: Re: Have I found an interval arithmetic bug?
Next
From: Michael Paquier
Date:
Subject: Re: Micro-optimizations to avoid some strlen calls.