add fix main DB programming rights query to tableHistory.sql