I need to UNION ALL a JSON column in Postgres 9.2. But Postgres replies with this error:
ERROR: could not identify an equality operator for type json SQL state: 42883 Character: 9
To the query:
(select cast('{"billingcode" : "' || billingcode || '"}' as JSON)
from billing_2012_08 limit 10)
union
(select cast('{"charged" : "' || charged || '"}' as JSON)
from sending_response_2012_08 limit 10)
What's wrong here?
It seems that Postgres doesn't have an equality operator for the json data type.
If this is correct, why?
As an example trying to figure out the problem, this works fine:
(select cast('{"billingcode" : "' || billingcode || '"}' as JSON)
from billing_2012_08 limit 10)
union all
(select cast('{"charged" : "' || charged || '"}' as JSON)
from sending_response_2012_08 limit 10)
Note, UNION ALL just "adds" results, as opposed to just UNION which eliminates duplicate values.