Array is not convenient to use in function, whether there are other methods can be replaced temp table in function
pgsql-hackers by date:
Соглашаюсь с условиями обработки персональных данных