PostgreSQL requires proper types in WHERE statement