a fix has gone in to PG17 that sorts this problem.
However, we can't go to 17 yet, so need a solution for 15 and 16.
pgsql-general by date:
Соглашаюсь с условиями обработки персональных данных