I'm sorry, everything is in order. Today I looked with fresh eyes, a slight adjustment in the calling function and it works. Thanks for your attention. Best regards. Ps. recently I deal with postgresql and I wanted to consult with you.
pgsql-sql by date:
Соглашаюсь с условиями обработки персональных данных