Fixed a bug with counting in the query regular db view models. It only seems to apply to Postgresql.