@?(jsonb,jsonpath)
jsonpath 存在性检查
当前查看 PostgreSQL 18.6。
说明
jsonpath 存在性检查
- 左操作数
- jsonb
- 右操作数
- jsonpath
- 返回类型
- bool
- 实现函数
- jsonb_path_exists_opr(jsonb,jsonpath)
- 操作符种类
- Binary
- 可用于哈希连接
- 否
- 可用于归并连接
- 否
用法
@?(jsonb,jsonpath) → bool英文手册定义
JSON 路径是否为指定的 JSON 值返回任何项?(这只适用于 SQL 标准 JSON 路径表达式,不适用于 谓词检查表达式 ,因为后者总是返回一个值。)
'{"a":[1,2,3,4,5]}'::jsonb @? '$.a[*] ? (@ > 2)' → t
目录记录解读
目录 pg_operator 存储关于操作符的信息。详见 CREATE OPERATOR 和 第 36.14 节 。
声明的操作符家族成员关系
| 索引访问方法 | 操作符家族 | 策略 | 用途 | 排序家族 |
|---|---|---|---|---|
| GIN | jsonb_ops | 15 | 搜索 | |
| GIN | jsonb_path_ops | 15 | 搜索 |
相关条目
文档与源码
- Matching PostgreSQL source archive
- PostgreSQL 18 English manual: catalog-pg-operator.html
- PostgreSQL 18 English manual: catalog-pg-amop.html
- PostgreSQL 18 English manual: functions-json.html
来源构建
- 版本
- 18.6
- 构建
- https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2
- 来源指纹
555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f
版本比较
PostgreSQL 11 → 12: 新增收录。
以下差异保留原始字段名与英文源描述。
--- PostgreSQL 11
+++ PostgreSQL 12
@@ -1 +1,36 @@
-该版未收录
+{
+ "memberships": [
+ {
+ "family": "jsonb_ops",
+ "left_type": "jsonb",
+ "method": "gin",
+ "operator": "@?(jsonb,jsonpath)",
+ "purpose": "search",
+ "right_type": "jsonpath",
+ "sort_family": "",
+ "strategy": "15"
+ },
+ {
+ "family": "jsonb_path_ops",
+ "left_type": "jsonb",
+ "method": "gin",
+ "operator": "@?(jsonb,jsonpath)",
+ "purpose": "search",
+ "right_type": "jsonpath",
+ "sort_family": "",
+ "strategy": "15"
+ }
+ ],
+ "operator": {
+ "commutator": "",
+ "function": "jsonb_path_exists_opr(jsonb,jsonpath)",
+ "hash_join": "f",
+ "kind": "b",
+ "left_type": "jsonb",
+ "merge_join": "f",
+ "negator": "",
+ "result_type": "bool",
+ "right_type": "jsonpath",
+ "symbol": "@?"
+ }
+}
比较已记录的接口与属性,排除来源指纹和构建元数据。某个样本中没有记录,不能据此判断实际引入或移除的版本。
相关条目
导出 JSON · 返回运算符 · 收录范围为 PostgreSQL 12 至 20;最早采样版本不一定是实际引入版本。