]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix double table_close of sequence_rel in copy_sequences().
authorAmit Kapila <akapila@postgresql.org>
Thu, 30 Apr 2026 10:57:11 +0000 (16:27 +0530)
committerAmit Kapila <akapila@postgresql.org>
Thu, 30 Apr 2026 11:09:39 +0000 (16:39 +0530)
commit2bf6c9ff71c976d0a9fb6c31d6e1da02550b5278
treeae0d75e6a9feafd4bfdae7cdbb03e299d6f3e822
parent5941e7f092233adb5415b2a12addea48a97a6618
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
src/backend/replication/logical/sequencesync.c
src/test/subscription/t/036_sequences.pl