无法按类型jsonb的字段中的节点筛选

问题描述

表有两列: id data

数据的类型为 jsonb

json:

  "weight": {
    "qty": 300,"unit": {
      "name": "gram","title": {
        "en": "g"
      }
    }
  

我想按json的节点 weight qty 进行过滤。

此处查询

SELECT
(product.data #>'{weight,qty}') AS weight
FROM product 
WHERE weight = 300
order by id desc

但是我得到了错误

ERROR:  column "weight" does not exist
LINE 4: WHERE weight = 123
              ^
sql state: 42703
Character: 70

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)