warning to publication created and wal_level is not set to logical

Lucas Viecelli <lviecelli199@gmail.com>

From: Lucas Viecelli <lviecelli199@gmail.com>
To: pgsql-hackers@postgresql.org
Date: 2019-03-21T22:45:59Z
Lists: pgsql-hackers

Attachments

Hi everyone,

A very common question among new users is how wal_level works and it
levels. I heard about some situations like that, a user create a new
publication in its master database and he/she simply does not change
wal_level to logical, sometimes, this person lost maintenance window, or a
chance to restart postgres service, usually a production database, and it
will discover that wal_level is not right just in subscription creation.
Attempting to iterate between new (and even experienced) users with logical
replication, I am sending a patch that when an PUBLICATION is created and
the wal_level is different from logical prints a WARNING in console/log:

-> WARNING: `PUBLICATION` created but wal_level `is` not set to logical,
you need to change it before creating any SUBSCRIPTION

Initiatives like this can make a good user experience with PostgreSQL and
its own logical replication.

Thanks

--

*Lucas Viecelli*

<http://www.leosoft.com.br/coopcred>

Commits

  1. Warn if wal_level is too low when creating a publication.