Skip to content

Commit b852dc4

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 7e2a18a commit b852dc4

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

doc/src/sgml/func.sgml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10333,32 +10333,36 @@ table2-mapping
1033310333
<row>
1033410334
<entry><literal>@&gt;</literal></entry>
1033510335
<entry><type>jsonb</type></entry>
10336-
<entry>Does the left JSON value contain within it the right value?</entry>
10336+
<entry>Does the left JSON value contain the right JSON
10337+
path/value entries at the top level?</entry>
1033710338
<entry><literal>'{"a":1, "b":2}'::jsonb &#64;&gt; '{"b":2}'::jsonb</literal></entry>
1033810339
</row>
1033910340
<row>
1034010341
<entry><literal>&lt;@</literal></entry>
1034110342
<entry><type>jsonb</type></entry>
10342-
<entry>Is the left JSON value contained within the right value?</entry>
10343+
<entry>Are the left JSON path/value entries contained at the top level within
10344+
the right JSON value?</entry>
1034310345
<entry><literal>'{"b":2}'::jsonb &lt;@ '{"a":1, "b":2}'::jsonb</literal></entry>
1034410346
</row>
1034510347
<row>
1034610348
<entry><literal>?</literal></entry>
1034710349
<entry><type>text</type></entry>
10348-
<entry>Does the key/element <emphasis>string</emphasis> exist within
10349-
the JSON value?</entry>
10350+
<entry>Does the <emphasis>string</emphasis> exist as a top-level
10351+
key within the JSON value?</entry>
1035010352
<entry><literal>'{"a":1, "b":2}'::jsonb ? 'b'</literal></entry>
1035110353
</row>
1035210354
<row>
1035310355
<entry><literal>?|</literal></entry>
1035410356
<entry><type>text[]</type></entry>
10355-
<entry>Do any of these key/element <emphasis>strings</emphasis> exist?</entry>
10357+
<entry>Do any of these array <emphasis>strings</emphasis>
10358+
exist as top-level keys?</entry>
1035610359
<entry><literal>'{"a":1, "b":2, "c":3}'::jsonb ?| array['b', 'c']</literal></entry>
1035710360
</row>
1035810361
<row>
1035910362
<entry><literal>?&amp;</literal></entry>
1036010363
<entry><type>text[]</type></entry>
10361-
<entry>Do all of these key/element <emphasis>strings</emphasis> exist?</entry>
10364+
<entry>Do all of these array <emphasis>strings</emphasis> exist
10365+
as top-level keys?</entry>
1036210366
<entry><literal>'["a", "b"]'::jsonb ?&amp; array['a', 'b']</literal></entry>
1036310367
</row>
1036410368
<row>

doc/src/sgml/json.sgml

Lines changed: 3 additions & 2 deletions
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

Lines changed: 3 additions & 3 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy