From 198692344b4246711c6cd452e42533a80a37703f Mon Sep 17 00:00:00 2001 From: Bertrand Drouvot Date: Tue, 10 Feb 2026 10:20:56 +0000 Subject: [PATCH] Fix failed assertion in pgactive_queue_truncate() When DDL replication is not enabled, two TRUNCATEs produces: TRAP: failed Assert("IsOidList(list)"), File: "list.c" TRUNCATE TABLE(ExceptionalCondition+0x9e)[0xb91fcf] TRUNCATE TABLE(lappend_oid+0x37)[0x7f8885] pgactive.so(pgactive_queue_truncate+0x154)[0x7d55b7367693] because the pgactive_truncated_tables is not reset to NIL when DDL replication is not enabled. This commit fixes it. That's probably related to #310. --- src/pgactive_ddlrep_truncate.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pgactive_ddlrep_truncate.c b/src/pgactive_ddlrep_truncate.c index b39e72c5..0ebfb690 100644 --- a/src/pgactive_ddlrep_truncate.c +++ b/src/pgactive_ddlrep_truncate.c @@ -319,6 +319,13 @@ pgactive_queue_truncate(PG_FUNCTION_ARGS) if (replorigin_session_origin != InvalidRepOriginId) PG_RETURN_VOID(); /* XXX return type? */ + /* + * If DDL replication is not enabled, we need to set + * pgactive_truncated_tables to NIL to avoid stale pointer. + */ + if (pgactive_skip_ddl_replication && pgactive_truncated_tables != NIL) + pgactive_truncated_tables = NIL; + /* Make sure the list change survives the trigger call. */ oldcontext = MemoryContextSwitchTo(TopTransactionContext); pgactive_truncated_tables = lappend_oid(pgactive_truncated_tables,