Fixed generated SQL for tagged_with :any

Closes #519.
That work only in PG .