在Postgres JSONB中,是否可以这样做:
where (
description ->'Auditor'->'1'->'Internal|External' is not null
)
而不是:
where (
description ->'Auditor'->'1'->'Internal' is not null
or
description ->'Auditor'->'1'->'External' is not null
)
答案 0 :(得分:3)
您可以使用?|
检查jsonb值是否包含任何一组键:
where description->'Auditor'->'1' ?| array ['Internal','External']