Re: Column Filtering in Logical Replication

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>, Rahila Syed <rahilasyed90(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Column Filtering in Logical Replication
Date: 2021-12-31 16:32:27
Message-ID: 20211231163227.GV24477@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> @@ -5963,8 +5967,20 @@ describePublications(const char *pattern)
> {
> /* Get the tables for the specified publication */
> printfPQExpBuffer(&buf,
> - "SELECT n.nspname, c.relname\n"
> - "FROM pg_catalog.pg_class c,\n"
> + "SELECT n.nspname, c.relname, \n");
> + if (pset.sversion >= 150000)
> + appendPQExpBufferStr(&buf,
> + " CASE WHEN pr.prattrs IS NOT NULL THEN\n"
> + " pg_catalog.array_to_string"
> + "(ARRAY(SELECT attname\n"
> + " FROM pg_catalog.generate_series(0, pg_catalog.array_upper(pr.prattrs::int[], 1)) s,\n"
> + " pg_catalog.pg_attribute\n"
> + " WHERE attrelid = c.oid AND attnum = prattrs[s]), ', ')\n"
> + " ELSE NULL END AS columns");
> + else
> + appendPQExpBufferStr(&buf, "NULL as columns");
> + appendPQExpBuffer(&buf,
> + "\nFROM pg_catalog.pg_class c,\n"
> " pg_catalog.pg_namespace n,\n"
> " pg_catalog.pg_publication_rel pr\n"
> "WHERE c.relnamespace = n.oid\n"

I suppose this should use pr.prattrs::pg_catalog.int2[] ?

Did the DatumGetBool issue expose a deficiency in testing ?
I think the !am_partition path was never being hit.

--
Justin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rémi Lapeyre 2021-12-31 17:36:33 Re: Add header support to text format and matching feature
Previous Message Andrew Dunstan 2021-12-31 16:22:49 Re: Extend compatibility of PostgreSQL::Test::Cluster