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

From Alvaro Herrera
Subject Re: Column Filtering in Logical Replication
Date
Msg-id 202109161350.kccziuuu25ex@alvherre.pgsql
Whole thread Raw
In response to Re: Column Filtering in Logical Replication  (vignesh C <vignesh21@gmail.com>)
Responses Re: Column Filtering in Logical Replication  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Re: Column Filtering in Logical Replication  (vignesh C <vignesh21@gmail.com>)
List pgsql-hackers
On 2021-Sep-16, vignesh C wrote:

> diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
> index e3068a374e..c50bb570ea 100644
> --- a/src/backend/parser/gram.y
> +++ b/src/backend/parser/gram.y

Yeah, on a quick glance this looks all wrong.  Your PublicationObjSpec
production should return a node with tag PublicationObjSpec, and
pubobj_expr should not exist at all -- that stuff is just making it all
more confusing.

I think it'd be something like this:

PublicationObjSpec:    
            ALL TABLES
                    {
                        $$ = makeNode(PublicationObjSpec);
                        $$->pubobjtype = PUBLICATIONOBJ_ALL_TABLES;
                        $$->location = @1;
                    }
            | TABLE qualified_name
                    {
                        $$ = makeNode(PublicationObjSpec);
                        $$->pubobjtype = PUBLICATIONOBJ_TABLE;
                        $$->pubobj = $2;
                        $$->location = @1;
                    }
            | ALL TABLES IN_P SCHEMA name
                    {
                        $$ = makeNode(PublicationObjSpec);
                        $$->pubobjtype = PUBLICATIONOBJ_ALL_TABLES_IN_SCHEMA;
                        $$->pubobj = makeRangeVar( ... $5 ... );
                        $$->location = @1;
                    }
            | qualified_name
                    {
                        $$ = makeNode(PublicationObjSpec);
                        $$->pubobjtype = PUBLICATIONOBJ_CONTINUATION;
                        $$->pubobj = $1;
                        $$->location = @1;
                    };

You need a single object name under TABLE, not a list -- this was Tom's
point about needing post-processing to determine how to assign a type to
a object that's what I named PUBLICATIONOBJ_CONTINUATION here.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"Puedes vivir sólo una vez, pero si lo haces bien, una vez es suficiente"



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Column Filtering in Logical Replication
Next
From: Laurenz Albe
Date:
Subject: Re: pgstat_send_connstats() introduces unnecessary timestamp and UDP overhead