Re: BUG #19500: pgrepack logical decoding plugin can crash assert builds via SQL decoding API

Álvaro Herrera <alvherre@kurilemu.de>

From: Alvaro Herrera <alvherre@kurilemu.de>
To: "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>
Cc: Antonin Houska <ah@cybertec.at>, Srinath Reddy Sadipiralla <srinath2133@gmail.com>, "n.kalinin@postgrespro.ru" <n.kalinin@postgrespro.ru>, "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2026-06-08T19:50:16Z
Lists: pgsql-bugs

Attachments

On 2026-Jun-05, Zhijie Hou (Fujitsu) wrote:

> I have no objection to the proposed approach. But I would like to confirm
> whether reporting an ERROR in the startup callback (when the context is not a
> REPACK decoding worker) is considered acceptable.
> 
> Like:
> 
> repack_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt,
> 			   bool is_init)
> ...
> 	if (!AmRepackWorker())
> 		ereport(ERROR,
> 				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
> 				errmsg("this plugin can only be used by REPACK (CONCURRENTLY)"));

Hmm, yeah, that works for me, we can ditch the magic number then.  I'm
considering something like the attached.  I added the test case and
edited nearby comments.  Will stare some more at it tomorrow ...

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Disallow direct use of the pgrepack logical decoding plugin