Here is a more or less straightforward patch to add more use of psprintf() in place of hardcoded palloc(N) + sprintf() and the like.
pgsql-hackers by date:
Соглашаюсь с условиями обработки персональных данных