小编Die*_*oza的帖子

JION数据类型上的UNION ALL

我需要在Postgres 9.2中使用JSON数据类型执行UNION ALL,但在执行此操作时,Postgres会回复此错误:

ERROR: could not identify an equality operator for type json SQL  
state: 42883  
Character: 9
Run Code Online (Sandbox Code Playgroud)

查询:

(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)

postgresql union json compare postgresql-9.2

6
推荐指数
1
解决办法
4157
查看次数

标签 统计

compare ×1

json ×1

postgresql ×1

postgresql-9.2 ×1

union ×1