[英]how to build postgres json query for missing property in json?
I have a table A with a column b as jsonb 我有一个表A,列b为jsonb
b
------------------
{"c": 1}
{"c": 1, "d": 2}
how to build a query for rows where d is missing? 如何为缺少d的行建立查询?
SELECT * FROM A WHERE b@>'{"c":1}';
returns all rows while 返回所有行,而
SELECT * FROM A WHERE b@>'{"c":1,"d":null}';
returns none ( due d is not null in first row ); 不返回任何值(由于d在第一行中不为null);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.