change history_scan_database to match fetch_history() semantics.