Problem solved. (My early transactions worked because they were Inserts. When they become Updates, this caused an error because of a subsequent call to pg_fetch_array that didn't make sense.) thank you, george
pgsql-general by date:
Соглашаюсь с условиями обработки персональных данных