我有一个叫做“log_data”的JSON类型的列,其中存储的数据格式为[{"key":"test123123","identity":"user@test.it","identity_type":"email"}]
。
我想要统计给定键和给定值的记录数:
不起作用
SELECT count (distinct esas_logs.log_id) AS "count" FROM "esas_logs" WHERE log_data->0->>'identity' = 'user@test.it'
[2016-06-30 13:59:18] [42883] ERROR: operator does not exist: json = unknown
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.