Данный код после подстановки параметров :player_id, :mob_id, :count
do $$
begin
IF EXISTS (SELECT * FROM player_mob_kills WHERE player_id= :player_id and mob_id= :mob_id) THEN
UPDATE player_mob_kills SET count = count + :count WHERE player_id= :player_id and mob_id= :mob_id;
ELSE
INSERT INTO player_mob_kills (player_id, mob_id, count) VALUES (:player_id, :mob_id, :count);
END IF;
end
$$;
иногда падает с ошибкой
SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint \"player_mob_kills_player_id_mob_id_unique\"\nDETAIL:
Key (player_id, mob_id)=(54298, 23) already exists.