My first instinct is that we need to build the array with appendPGArray() and then append it to the query using appendStringLiteralAH(), as done in the attached patch.
pgsql-bugs by date:
Соглашаюсь с условиями обработки персональных данных