更新时间:2023-02-05 15:04:03
出现问题是因为->>
运算符无法遍历数组:
The problem arises because ->>
operator cannot walk through array:
json_array_elements
函数取消嵌套json数组; json_array_elements
function;以下查询可解决问题:
WITH
A AS (
SELECT
Id
,jsonb_array_elements(gps_data_json) AS point
FROM trip
)
SELECT *
FROM A
WHERE (point->>'mode') = 'WALK';