The function behaves as expected when in plain SQL, only plpgsql function has the above mentioned problem. regards mk
pgsql-sql by date:
Соглашаюсь с условиями обработки персональных данных