fix bug in database update for postgresql