I'll break them into three pieces- superuser() cleanup, GetUserId() -> has_privs_of_role(), and the additional-role-attributes patch will just depend on the others.
pgsql-hackers by date:
Соглашаюсь с условиями обработки персональных данных