jsquery
data type for jsonb inspection
jsquery : data type for jsonb inspection
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 2770 | jsquery | jsquery | 1.2 |
FEAT | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | pgbson pgjq pg_jsonschema jsonschema pg_projection documentdb mongo_fdw jsonb_plperl jsonb_plpython3u jsonb_plperlu |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG | 1.2 |
18 17 16 15 14 | jsquery |
- |
| RPM | PGDG | 1.2 |
18 17 16 15 14 | jsquery_$v |
- |
| DEB | PGDG | 1.2 |
18 17 16 15 14 | postgresql-$v-jsquery |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 |
| el8.aarch64 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 |
| el9.x86_64 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 |
| el9.aarch64 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 |
| el10.x86_64 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 |
| el10.aarch64 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 |
| d12.x86_64 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 |
| d12.aarch64 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 |
| d13.x86_64 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 |
| d13.aarch64 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 |
| u22.x86_64 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 |
| u22.aarch64 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 |
| u24.x86_64 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 |
| u24.aarch64 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 |
| u26.x86_64 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 |
| u26.aarch64 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 | PGDG 1.2 |
Source
github.com/postgrespro/jsquery
jsquery-1.2.tar.gz
Install
Make sure PGDG repo available:
Install this extension with pig:
Create this extension with:
Usage
JsQuery provides a query language for JSONB data, similar to what tsquery does for full-text search. It offers a concise way to search nested objects and arrays with index support via GIN.
Operators
| Operator | Description |
|---|---|
@@ |
Match operator: test whether a jsonb value matches a jsquery expression |
Query Syntax
Expressions follow the pattern path operator value:
Binary operators:
=(equality),>,>=,<,<=(comparison)IN(list membership)&&(overlap),@>(contains),<@(contained in)
Unary operators:
= *(existence check)IS ARRAY,IS NUMERIC,IS OBJECT,IS STRING,IS BOOLEAN(type checking)
Path Expressions
| Symbol | Meaning |
|---|---|
# |
Any array index |
#N |
Specific array index N |
% |
Any object key |
* |
Any sequence of keys/indexes |
@# |
Array/object length |
$ |
Entire document |
“Every” semantics (all elements must match):
#:– all array elements%:– all object keys*:– all nested paths
Examples
Simple value matching:
Logical combinations:
Array element matching (find array elements where both conditions hold):
Object key range matching:
GIN Indexing
Two operator classes for different query patterns:
Optimizer hints for index usage: