Skip to content

Commit 2169e87

Browse files
committed
docs: clarify JSONB operator descriptions
No catalog bump as the catalog changes are for SQL operator comments. Backpatch through 9.5
1 parent 02580df commit 2169e87

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

doc/src/sgml/func.sgml

+10-6
Original file line numberDiff line numberDiff line change
@@ -10331,32 +10331,36 @@ table2-mapping
1033110331
<row>
1033210332
<entry><literal>@&gt;</literal></entry>
1033310333
<entry><type>jsonb</type></entry>
10334-
<entry>Does the left JSON value contain within it the right value?</entry>
10334+
<entry>Does the left JSON value contain the right JSON
10335+
path/value entries at the top level?</entry>
1033510336
<entry><literal>'{"a":1, "b":2}'::jsonb &#64;&gt; '{"b":2}'::jsonb</literal></entry>
1033610337
</row>
1033710338
<row>
1033810339
<entry><literal>&lt;@</literal></entry>
1033910340
<entry><type>jsonb</type></entry>
10340-
<entry>Is the left JSON value contained within the right value?</entry>
10341+
<entry>Are the left JSON path/value entries contained at the top level within
10342+
the right JSON value?</entry>
1034110343
<entry><literal>'{"b":2}'::jsonb &lt;@ '{"a":1, "b":2}'::jsonb</literal></entry>
1034210344
</row>
1034310345
<row>
1034410346
<entry><literal>?</literal></entry>
1034510347
<entry><type>text</type></entry>
10346-
<entry>Does the key/element <emphasis>string</emphasis> exist within
10347-
the JSON value?</entry>
10348+
<entry>Does the <emphasis>string</emphasis> exist as a top-level
10349+
key within the JSON value?</entry>
1034810350
<entry><literal>'{"a":1, "b":2}'::jsonb ? 'b'</literal></entry>
1034910351
</row>
1035010352
<row>
1035110353
<entry><literal>?|</literal></entry>
1035210354
<entry><type>text[]</type></entry>
10353-
<entry>Do any of these key/element <emphasis>strings</emphasis> exist?</entry>
10355+
<entry>Do any of these array <emphasis>strings</emphasis>
10356+
exist as top-level keys?</entry>
1035410357
<entry><literal>'{"a":1, "b":2, "c":3}'::jsonb ?| array['b', 'c']</literal></entry>
1035510358
</row>
1035610359
<row>
1035710360
<entry><literal>?&amp;</literal></entry>
1035810361
<entry><type>text[]</type></entry>
10359-
<entry>Do all of these key/element <emphasis>strings</emphasis> exist?</entry>
10362+
<entry>Do all of these array <emphasis>strings</emphasis> exist
10363+
as top-level keys?</entry>
1036010364
<entry><literal>'["a", "b"]'::jsonb ?&amp; array['a', 'b']</literal></entry>
1036110365
</row>
1036210366
<row>

doc/src/sgml/json.sgml

+3-2
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,9 @@ SELECT '"foo"'::jsonb ? 'foo';
369369
</para>
370370
<para>
371371
The default GIN operator class for <type>jsonb</> supports queries with
372-
the <literal>@&gt;</>, <literal>?</>, <literal>?&amp;</>
373-
and <literal>?|</> operators.
372+
top-level key-exists operators <literal>?</>, <literal>?&amp;</>
373+
and <literal>?|</> operators and path/value-exists operator
374+
<literal>@&gt;</>.
374375
(For details of the semantics that these operators
375376
implement, see <xref linkend="functions-jsonb-op-table">.)
376377
An example of creating an index with this operator class is:

src/include/catalog/pg_operator.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1806,11 +1806,11 @@ DESCR("greater than or equal");
18061806
DATA(insert OID = 3246 ( "@>" PGNSP PGUID b f f 3802 3802 16 3250 0 jsonb_contains contsel contjoinsel ));
18071807
DESCR("contains");
18081808
DATA(insert OID = 3247 ( "?" PGNSP PGUID b f f 3802 25 16 0 0 jsonb_exists contsel contjoinsel ));
1809-
DESCR("exists");
1809+
DESCR("key exists");
18101810
DATA(insert OID = 3248 ( "?|" PGNSP PGUID b f f 3802 1009 16 0 0 jsonb_exists_any contsel contjoinsel ));
1811-
DESCR("exists any");
1811+
DESCR("any key exists");
18121812
DATA(insert OID = 3249 ( "?&" PGNSP PGUID b f f 3802 1009 16 0 0 jsonb_exists_all contsel contjoinsel ));
1813-
DESCR("exists all");
1813+
DESCR("all keys exist");
18141814
DATA(insert OID = 3250 ( "<@" PGNSP PGUID b f f 3802 3802 16 3246 0 jsonb_contained contsel contjoinsel ));
18151815
DESCR("is contained by");
18161816
DATA(insert OID = 3284 ( "||" PGNSP PGUID b f f 3802 3802 3802 0 0 jsonb_concat - - ));

0 commit comments

Comments
 (0)