On Wed, Feb 5, 2025 at 2:06 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
>
> I've attached the updated patch. The fix needs to be back-patched to
> v16 where logical decoding on standby was introduced.
>
Isn't it better to give the new ERROR near the below code?
RestoreSlotFromDisk()
{
...
if (cp.slotdata.database != InvalidOid && wal_level < WAL_LEVEL_LOGICAL)
ereport(FATAL,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("logical replication slot \"%s\" exists, but \"wal_level\" <
\"logical\"",
NameStr(cp.slotdata.name)),
...
}
If feasible, this will avoid an additional loop over the slots and a
new ERROR will be added at the same place as an existing similar
ERROR.
--
With Regards,
Amit Kapila.