首页 > 解决方案 > 在存储过程 postgresql 中查找 jsonb 数组长度

问题描述

我通过在存储过程中使用 array_append 函数推送 jsonb 对象创建了一个 jsonb 数组(jsonb [])。但在那之后,我找不到那个 jsonb[] 的长度。我尝试过使用 jsonb_array_length(jsonb[])。但它显示错误,如“错误:函数 jsonb_array_length(jsonb[]) 不存在”。有人可以帮忙吗?

我的 jsonb 数组(flexibleWorkouts)类似于 {"{\"workoutId\": 1, \"workoutType\": \"Flexibility\", \"workoutCategory\": \"Activity\"}"}

我的代码是

jsonb_array_length(flexibleWorkouts)

标签: postgresqlstored-procedures

解决方案


推荐阅读