Attached is a slightly updated version, with a bit simpler implementation of foreach_delete_current. Instead of decrementing i and then adding 1 to it when indexing the list, it now indexes the list using a postfix decrement.
pgsql-hackers by date:
Соглашаюсь с условиями обработки персональных данных