Fix filtering by tag for PostgreSQL

This pull request fixes filtering by tag when using PostgreSQL (see issue #15).