Thread: Where Clause not being applied to all tables in a publication
When adding more than one table to a logical replication publication with a where clause, the where clause is only applied to a single table in the publication, not all of them.
Basic test case:
testdb=# create table foo (id bigserial primary key);
CREATE TABLE
testdb=# create table bar (id bigserial primary key);
CREATE TABLE
testdb=# CREATE PUBLICATION test_pub for table foo,bar WHERE (id = 1);
CREATE PUBLICATION
testdb=# select * from pg_publication_tables \gx
-[ RECORD 1 ]--------
pubname | test_pub
schemaname | public
tablename | foo
attnames | {id}
rowfilter |
-[ RECORD 2 ]--------
pubname | test_pub
schemaname | public
tablename | bar
attnames | {id}
rowfilter | (id = 1)
CREATE TABLE
testdb=# create table bar (id bigserial primary key);
CREATE TABLE
testdb=# CREATE PUBLICATION test_pub for table foo,bar WHERE (id = 1);
CREATE PUBLICATION
testdb=# select * from pg_publication_tables \gx
-[ RECORD 1 ]--------
pubname | test_pub
schemaname | public
tablename | foo
attnames | {id}
rowfilter |
-[ RECORD 2 ]--------
pubname | test_pub
schemaname | public
tablename | bar
attnames | {id}
rowfilter | (id = 1)
Thanks,
Brad
On Wednesday, August 30, 2023, Brad Nicholson <brad.nicholson@instacart.com> wrote:
When adding more than one table to a logical replication publication with a where clause, the where clause is only applied to a single table in the publication, not all of them.
The observed behavior is precisely what the syntax describes.
David J.