handle postgresql transaction errors