简体   繁体   English

Postgres中JSON查询中的OR子句

[英]OR clause inside JSON query in Postgres

In Postgres JSONB, is it possible to do something like this: 在Postgres JSONB中,是否可以执行以下操作:

where (
  description ->'Auditor'->'1'->'Internal|External' is not null
)

Instead of this: 而不是这个:

where (
  description ->'Auditor'->'1'->'Internal' is not null
  or
  description ->'Auditor'->'1'->'External' is not null
)

You can check whether a jsonb value has any of a set of keys with ?| 您可以检查jsonb值是否包含任何一组键?| :

where description->'Auditor'->'1' ?| array ['Internal','External']

Relevant documentation 相关文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM