my only question would be. Why isn't that in core already ?
pgsql-hackers by date:
Соглашаюсь с условиями обработки персональных данных