Perform correct filtering when the database used is not the default (0)