是否有任何其他方式来匹配PostgreSQL的布尔值(版本9.3)json对象而不将其转换为字符串?比较PostgreSQL中的布尔值9.3 json对象
我的意思是: 表包含在其jsoncolumn列下列对象:
'{"path":"mypath", "exists": true}'
以下查询获取记录(注意:exists
值取为与->>
文本):
select * from thetable where jsoncolumn ->> 'exists' = 'true';
,这一次没有:
select * from thetable where jsoncolumn -> 'exists' = true;
我想知道是否有更合适的方法来进行布尔比较?
你有没有尝试:'(jsoncolumn - >'exists'):: boolean = true'? –
@a_horse_with_no_name是的,我有。它也没有工作。 – BanzaiTokyo