Right. Shame on me for not checking the docs before posting. Simply stated, this is undefined behavior.
pgsql-bugs by date:
Соглашаюсь с условиями обработки персональных данных