Hello! In continuation of the topic I would like to suggest solution. This patch adds several checks to the vulnerable functions above.
pgsql-hackers by date:
Соглашаюсь с условиями обработки персональных данных