Fix double table_close of sequence_rel in copy_sequences().
Amit Kapila <akapila@postgresql.org>
Fix double table_close of sequence_rel in copy_sequences(). sequence_rel was declared at batch scope, so when a row is skipped due to concurrent drop or insufficient privileges, the end-of-row cleanup closes the stale pointer from the previous row, tripping the relcache refcount assertion. Move sequence_rel inside the per-row loop. Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com> Reviewed-by: vignesh C <vignesh21@gmail.com> Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com> Discussion: https://postgr.es/m/CAJTYsWWOuw-yfmzotV4jCJ6LLxEsb=STLcGtDYXOxRcU9Te3Pw@mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/replication/logical/sequencesync.c | modified | +3 −3 |
| src/test/subscription/t/036_sequences.pl | modified | +39 −0 |
Discussion
- [PATCH] Fix stale relation close in sequence synchronization 16 messages · 2026-04-28 → 2026-05-01