查询JSONB [] postgres

时间:2018-11-09 03:01:56

标签: sql postgresql sequelize.js

我在查询JSONB []时遇到了麻烦,我已经尝试过在像这样的postgres上进行原始查询

select * from "Certification" where (test -> 'dea')::jsonb like '%"xyz"%'

但是它显示->运算符上的错误。数据如图所示。提前致谢。我花了2个小时进行搜索,但没有得到如何通过工作示例在JSONB[]中查询postgres的信息。我尝试过的所有示例都没有语法错误运算符enter image description here

1 个答案:

答案 0 :(得分:0)

使用->>代替->->>给出要在其上应用where子句的密钥的值。

select * from "Certification" where test ->> 'dea' like '%"xyz"%';

或者这个

select * from "Certification" where test::jsonb ->> 'dea' like '%"xyz"%';
相关问题