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.