Disallow direct use of the pgrepack logical decoding plugin
Álvaro Herrera <alvherre@kurilemu.de>
Disallow direct use of the pgrepack logical decoding plugin Nothing is to be gained from using pgrepack outside of REPACK (CONCURRENTLY), and it leads to assertion failures in assertion-enabled builds, and to crashes due to bogus memory lifetime in production builds. Reject attempts to do that with a clean error report. Clean up the nearby code a tad while at it. The only functional changes in that are that the output_writer_private context is allocated and partially filled by the pgrepack output plugin; and that ->relid therein is now always present (rather than only in assertion-enabled builds). Other than that it's just minor code rearrangement and added comments. Author: Álvaro Herrera <alvherre@kurilemu.de> Reported-by: Nikita Kalinin <n.kalinin@postgrespro.ru> Suggested-by: Zhijie Hou <houzj.fnst@fujitsu.com> Reviewed-by: Antonin Houska <ah@cybertec.at> (older version) Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com> (older version) Discussion: https://postgr.es/m/19500-38a02529a69353a5@postgresql.org
Files
| Path | Change | +/− |
|---|---|---|
| contrib/test_decoding/expected/repack.out | modified | +11 −0 |
| contrib/test_decoding/sql/repack.sql | modified | +7 −0 |
| src/backend/commands/repack_worker.c | modified | +42 −60 |
| src/backend/replication/pgrepack/pgrepack.c | modified | +19 −1 |
| src/include/commands/repack_internal.h | modified | +0 −2 |
Discussion
- BUG #19500: pgrepack logical decoding plugin can crash assert builds via SQL decoding API 14 messages · 2026-05-28 → 2026-06-09