Subject: Re: Column Filtering in Logical Replication

From: Alvaro Herrera <[email-masked]>
Date: Mon, 3 Jan 2022 12:01:59 -0300

On 2022-Jan-03, Justin Pryzby wrote:

> Yes, I know both paths are hit now that it uses GetBool.
> 
> What I'm wondering is why tests didn't fail when one path wasn't hit - when it
> said am_partition=DatumGetChar(); if (!am_partition){}

Ah!

> I suppose it's because the am_partition=true case correctly handles
> nonpartitions.
> 
> Maybe the !am_partition case should be removed, and add a comment that
> pg_partition_tree(pg_partition_root(%u))) also handles non-partitions.
> Or maybe that's inefficient...

Hmm, that doesn't sound true.  Running the query manually, you get an
empty list if you use pg_partition_tree(pg_partition_root) with a
non-partition.  Maybe what was happening is that all columns were being
transmitted instead of only the required columns.  Maybe you're right
that the test isn't complete enough.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/