[#652] Properly report permission denied error in sql search