How do I union queries where the model contains a JSON field?
Doing a bit of searching, it looks like the UNION operation is trying to take out duplicates and needs to compare the JSON content... is there any way in the union from peewee that I can specify that I'd like only apply distinct on say `id`? Yes, you need to use UNION ALL if you don't want duplicates removed (which is why you're getting that error). You can use `.union_all()` or the addition operator overload. Thanks, I came across that option in my searches.

So you're saying that if I am concerned about duplicates, I can `.union_all()`, and then use `.distinct(model.id)`?

I was typing this out below before you responded but then I got consumed by something else:

"Trying out `BinaryJSONField` instead of `JSONField` now and this seems to work (using union and BinaryJSONFields), but I'm not sure what the implications are of changing our whole schema to use `BinaryJSONField` instead of `JSONField` everywhere. Are these supposed to be interchangeable or will changing the schema change the data in some way?"

I'd imagine the we don't want to be doing JSON equality operations anyway to filter distinct records so I'll try out using distinct after union_all. Thanks again for the help! This is a part of the SQL specification, that UNION must perform some type of equality to remove duplicates, whereas UNION ALL is not constrained in that way.
If I have two or more queries to join (say q1, q2 and q3) and I'm using set operations on them like: 

`query = q1 & q2` or `query = q2 | q3` or `query = q1 - q3`

I know that there is a limitation that the selected columns for these should be the same, but I'm finding that I get the errors:

`peewee.ProgrammingError: could not identify an equality operator for type json`
`psycopg2.errors.UndefinedFunction: could not identify an equality operator for type json`

whenever all fields are selected and the model includes a `JSONField` from `playhouse.postgres_ext`

Is this any way to resolve this? My use case is that I'm passing a list of queries through to another function where I want to union them and so I don't have the luxury of adding `.where(xyz)` statements onto an exiting query to limit the selection using multiple where filters. Also, the set operations seem more powerful in general as passing a list of where params is quite limiting.