BUG #15044: materialized views incompatibility with logicalreplication in postgres 10 - Mailing list pgsql-bugs

From David G. Johnston
Subject BUG #15044: materialized views incompatibility with logicalreplication in postgres 10
Date
Msg-id CAKFQuwbXMMybbA-p11=P3D4Z0gbYq2hyDE1YV3JHRnu+UF3Abw@mail.gmail.com
Whole thread Raw
In response to BUG #15044: materialized views incompatibility with logicalreplication in postgres 10  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #15044: materialized views incompatibility with logical replication in postgres 10  (Chad Trabant <chad@iris.washington.edu>)
List pgsql-bugs
On Thursday, February 1, 2018, PG Bug reporting form <noreply@postgresql.org> wrote:


Bug reference:      15044

The built-in logical replication in postgres 10 is documented as not being
able to replication materialized views, notably here:
https://www.postgresql.org/docs/10/static/logical-replication-restrictions.html

Unfortunately, there appears to be an incompatibility with logical
replication and materialized views.
 
[...]
# Create publication and subscription
psql -p 5433 -d postgres -c "CREATE PUBLICATION pub FOR ALL TABLES;"

[...] 
# Create materialized view on publisher
psql -p 5433 -d postgres -c "CREATE MATERIALIZED VIEW mvid AS SELECT id FROM
testtable;"

With that CREATE MATERIALIZED VIEW statement the replication broken, with
these errors in the subscriber's log:

2018-02-01 16:34:27.639 PST [68409] ERROR:  logical replication target
relation "public.mvid" does not exist

It seems the work-around is to not use "for all tables" in your publication definition.

As described it does seem bugged.  The table matview itself is not being published, as documented, but knowledge of its existence as part of the publication is...

David J.



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #15044: materialized views incompatibility with logicalreplication in postgres 10
Next
From: Chad Trabant
Date:
Subject: Re: BUG #15044: materialized views incompatibility with logical replication in postgres 10