Re: row filtering for logical replication - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: row filtering for logical replication
Date
Msg-id 202201201426.d5rduokb7ufi@alvherre.pgsql
Whole thread Raw
In response to Re: row filtering for logical replication  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: row filtering for logical replication
RE: row filtering for logical replication
List pgsql-hackers
On 2022-Jan-20, Amit Kapila wrote:

> It returns an invalid column referenced in an RF if any but if not
> then it helps to form pubactions which is anyway required at a later
> point in the caller. The idea is that when we are already traversing
> publications we should store/gather as much info as possible.

I think this design isn't quite awesome.

> I think probably the API name is misleading, maybe we should name it
> something like ValidateAndFetchPubInfo, ValidateAndRememberPubInfo, or
> something along these lines?

Maybe RelationBuildReplicationPublicationDesc or just
RelationBuildPublicationDesc are good names for a routine that fill in
the publication aspect of the relcache entry, as a parallel to
RelationBuildPartitionDesc.

> >  Maybe this was meant to be "validate RF
> > expressions" and return, perhaps, a bitmapset of all invalid columns
> > referenced?
> 
> Currently, we stop as soon as we find the first invalid column.

That seems quite strange.  (And above you say "gather as much info as
possible", so why stop at the first one?)

> >  (What is an invalid column in the first place?)
> 
> A column that is referenced in the row filter but is not part of
> Replica Identity.

I do wonder how do these invalid columns reach the table definition in
the first place.  Shouldn't these be detected at DDL time and prohibited
from getting into the definition?

... so if I do
  ADD TABLE foobar WHERE (col_not_in_replident = 42)
then I should get an error immediately, rather than be forced to
construct a relcache entry with "invalid" data in it.  Likewise if I
change the replica identity to one that causes one of these to be
invalid.  Isn't this the same approach we discussed for column
filtering?

-- 
Álvaro Herrera              Valdivia, Chile  —  https://www.EnterpriseDB.com/
Voy a acabar con todos los humanos / con los humanos yo acabaré
voy a acabar con todos (bis) / con todos los humanos acabaré ¡acabaré! (Bender)



pgsql-hackers by date:

Previous
From: James Coleman
Date:
Subject: Re: Document atthasmissing default optimization avoids verification table scan
Next
From: Robert Haas
Date:
Subject: Re: preserving db/ts/relfilenode OIDs across pg_upgrade (was Re: storing an explicit nonce)