Re: [PATCH] pg_createsubscriber: add hint to wal_level error

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: joaovictor(dot)rito(at)gmail(dot)com
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] pg_createsubscriber: add hint to wal_level error
Date: 2026-11-19 05:04:44
Message-ID: 20261119.140444.1281636689412055560.horikyota.ntt@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

At Wed, 18 Nov 2026 22:45:13 -0300, Joao Rito <joaovictor(dot)rito(at)gmail(dot)com> wrote in
> The error reported when the publisher has wal_level = minimal says what
> is required but not how to fix it. The neighboring errors about
> max_replication_slots and max_wal_senders already carry a hint. Add one
> here, using the wording of the equivalent hint in slot.c.

> pg_log_error("publisher requires \"wal_level\" >= \"replica\"");
> + pg_log_error_hint("Change \"wal_level\" to be \"replica\" or higher.");

I don't particularly think this is necessary, since the main message
already clearly states the requirement. However, a quick search turned
up a few other messages worth looking at in this context.

Here are a few observations.

1. We could perhaps make the following messages clearer by specifying
the required values directly in the main messages, rather than in
the hints or details.

./backend/access/transam/xlog.c:10003:
errmsg("WAL level not sufficient for making an online backup"),
errhint("\"wal_level\" must be set to \"replica\" or \"logical\" at server start.")));
./backend/access/transam/xlog.c:10339:
errmsg("WAL level not sufficient for making an online backup"),
errhint("\"wal_level\" must be set to \"replica\" or \"logical\" at server start.")));
./backend/commands/repack.c:983:
errmsg("cannot execute %s in this configuration",
errdetail("This operation requires \"wal_level\" to be set to \"replica\" or higher."));
./backend/commands/subscriptioncmds.c:3513:
errmsg("cannot execute %s in this configuration",
errdetail("This operation requires \"wal_level\" to be set to \"replica\" or higher."));

2. There are many messages like the following, where the hint seems to
repeat part of the requirement already stated in the main message.
However, I don't see much need to change them.

./backend/replication/logical/logical.c:172:
errmsg("logical decoding on standby requires \"effective_wal_level\" >= \"logical\" on the primary"),
errhint("Set \"wal_level\" >= \"logical\" or create at least one logical slot when \"wal_level\" = \"replica\".")));

3. The main message and hint in the following case don't seem quite
aligned: the former refers to replication slot synchronization, while
the latter refers to logical decoding.

./backend/replication/logical/slotsync.c:1265:
errmsg("replication slot synchronization requires \"effective_wal_level\" >= \"logical\" on the primary"),
errhint("To enable logical decoding on primary, set \"wal_level\" >= \"logical\" or create at least one logical slot when \"wal_level\" = \"replica\"."));

There may be more examples, but these are just a few that caught my
attention.

Regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shihao zhong 2026-11-19 05:06:38 Re: CREATE TABLE LIKE with INHERITS skips checks on generated columns
Previous Message shihao zhong 2026-11-19 05:01:29 Re: pgsql: Don't trust NOT NULL on virtual generated columns of partitioned