public inbox for [email protected]
help / color / mirror / Atom feedFrom: Peter Smith <[email protected]>
To: PostgreSQL Hackers <[email protected]>
Subject: DOCS - Clarify that REFRESH SEQUENCES might be using stale publication data
Date: Thu, 2 Jul 2026 14:58:48 +1200
Message-ID: <CAHut+PtFkGvZNihGRDoghWNKMfJufEpR9+thbG_8qPQ7RyVN4w@mail.gmail.com> (raw)
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
Attachments:
[application/octet-stream] v1-0001-DOCS-clarify-that-REFRESH-SEQUENCES-might-be-usin.patch (1.8K, ../CAHut+PtFkGvZNihGRDoghWNKMfJufEpR9+thbG_8qPQ7RyVN4w@mail.gmail.com/2-v1-0001-DOCS-clarify-that-REFRESH-SEQUENCES-might-be-usin.patch)
download | inline diff:
From afa7eba400b593e2a73a5fd618e510cef571aee7 Mon Sep 17 00:00:00 2001
From: Peter Smith <[email protected]>
Date: Thu, 2 Jul 2026 14:48:43 +1200
Subject: [PATCH v1] DOCS - clarify that REFRESH SEQUENCES might be using stale
publication data
---
doc/src/sgml/ref/alter_subscription.sgml | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/doc/src/sgml/ref/alter_subscription.sgml b/doc/src/sgml/ref/alter_subscription.sgml
index e4f0b6b16c7..c9ed7745554 100644
--- a/doc/src/sgml/ref/alter_subscription.sgml
+++ b/doc/src/sgml/ref/alter_subscription.sgml
@@ -236,13 +236,19 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <
<listitem>
<para>
Re-synchronize sequence data with the publisher. Unlike
- <link linkend="sql-altersubscription-params-refresh-publication">
- <command>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</command></link> which
+ <literal>REFRESH PUBLICATION</literal> which
only has the ability to synchronize newly added sequences,
<literal>REFRESH SEQUENCES</literal> will re-synchronize the sequence
data for all currently subscribed sequences. It does not add or remove
sequences from the subscription to match the publication.
</para>
+ <para>
+ If the publication's sequence membership has changed,
+ <link linkend="sql-altersubscription-params-refresh-publication">
+ <command>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</command></link>
+ should be run before <literal>REFRESH SEQUENCES</literal> to ensure the
+ subscription's known sequence list is current.
+ </para>
<para>
See <xref linkend="sequence-definition-mismatches"/> for
recommendations on how to handle any warnings about sequence definition
--
2.47.3
view thread (4+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: DOCS - Clarify that REFRESH SEQUENCES might be using stale publication data
In-Reply-To: <CAHut+PtFkGvZNihGRDoghWNKMfJufEpR9+thbG_8qPQ7RyVN4w@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox