Fixed Postgre mimic of INSERT REPLACE and affected_rows - should fix #974

Signed-off-by: emanuele <emanuele45@gmail.com>