DOCS - Clarify that REFRESH SEQUENCES might be using stale publication data

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: DOCS - Clarify that REFRESH SEQUENCES might be using stale publication data
Date: 2026-07-02 02:58:48
Message-ID: CAHut+PtFkGvZNihGRDoghWNKMfJufEpR9+thbG_8qPQ7RyVN4w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Today I was experimenting with logical replication of sequences and
encountered some "unexpected" behaviour. It makes sense in hindsight,
but at the time it seemed surprising. It turns out that it is possible
to synchronise sequence values (using "ALTER SUBSCRIPTION... REFRESH
SEQUENCES") even when those sequences are not published.

That's because a subscription only knows which sequences are
subscribed to from the `pg_subscription_rel` table, but that
information can be stale if the publication has since stopped
publishing those sequences. In other words, if a sequence was removed
from the publication but REFRESH PUBLICATION hasn't been run, REFRESH
SEQUENCES would continue to synchronise it since it is still in
`pg_subscription_rel`.

The docs do refer to "currently subscribed sequences" but do not
explicitly warn about this gotcha.

PSA: a patch to add a clarifying sentence.

(I also removed an earlier link to "ALTER SUBSCRIPTION ... REFRESH
PUBLICATION", because it did not seem good to have multiple links to
the same place).

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachment Content-Type Size
v1-0001-DOCS-clarify-that-REFRESH-SEQUENCES-might-be-usin.patch application/octet-stream 1.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2026-07-02 03:01:44 Re: proposal - queryid can be used as filter for auto_explain
Previous Message Thom Brown 2026-07-02 02:46:14 Re: Per-thread leak in ECPG's memory.c