[corrected typo, sorry] And wouldn't a pure SQL-function solution be: to call an INSERT followed by an UPDATE in its body and ignoring the error? (don't know how ignore that error best though, so that I don't ignore other critical errors)
pgsql-general by date:
Соглашаюсь с условиями обработки персональных данных