Change RETURNING to 1 or 2 based on update or insert, remove savepoint r=twobraids