Hi! This patch looks like a good solution for a pain in the ass, I'm too for this patch to be committed. Have looked through the code and agree with Andrei, the code looks good. Just a suggestion - maybe it is worth adding a function for detaching the segment, for cases when we unload and/or re-load the extension?
-- Regards, Nikita Malakhov Postgres Professional The Russian Postgres Company https://postgrespro.ru/