Excited! Thanks for the discussion and the fix!
The bug seems to be solved well. And usage of PG_FINALLY can make it more elegantly. However, for the version lacking of PG_FINALLY, should the patch be written like that:
---
/* free context, call shutdown callback */
FreeDecodingContext(ctx);
ReplicationSlotRelease();
InvalidateSystemCaches();
}
PG_CATCH();
{
+
+ /* free context, call shutdown callback */
+ if (ctx != NULL)
+ FreeDecodingContext(ctx);
+
+ ReplicationSlotRelease();
----
Best regards!
At 2023-08-18 12:21:53, "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com> wrote:
Here is a new version patch which addressed this based on PG15.