Re: wrong sequence value in dump file - Mailing list pgsql-hackers

From Fabrice Chapuis
Subject Re: wrong sequence value in dump file
Date
Msg-id CAA5-nLCP6C=5v4JX0xV5L+2cT6d6BJqg0u0uU=VH_2yv12R3vg@mail.gmail.com
Whole thread Raw
In response to Re: wrong sequence value in dump file  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Ok, effectively the dump comes from a standby. Thanks for your explanation.

Best regards,

Fabrice

On Wed, Jul 16, 2025 at 5:06 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Fabrice Chapuis <fabrice636861@gmail.com> writes:
> When dumping with pg_dump and the directory option, I got a sequence value
> that is greater in the dump file than the sequence in the source database.

Perhaps you were dumping from a standby server?  It's normal for
a standby to show a value up to 32 counts more than the primary,
because of some tricks that sequence.c plays to reduce the number
of WAL records generated for nextval().

                        regards, tom lane

pgsql-hackers by date:

Previous
From: Jacob Champion
Date:
Subject: Re: Explicitly enable meson features in CI
Next
From: Yura Sokolov
Date:
Subject: Re: Read-Write optimistic lock (Re: sinvaladt.c: remove msgnumLock, use atomic operations on maxMsgNum)