我需要在Postgres 9.2中使用JSON数据类型执行UNION ALL,但在执行此操作时,Postgres会回复此错误:
Run Code Online (Sandbox Code Playgroud)ERROR: could not identify an equality operator for type json SQL state: 42883 Character: 9
查询:
(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)
Run Code Online (Sandbox Code Playgroud)
这里有什么问题?
正如我所发现的,似乎Postgres没有为json数据类型定义一个相等的运算符.如果这是正确的,为什么?
作为一个试图找出问题的例子,这很好用:
(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 …
Run Code Online (Sandbox Code Playgroud)