bug #4604 Query history not being deleted

Signed-off-by: Marc Delisle <marc@infomarc.info>