Skip to content

Commit b292ee7

Browse files
committed
docs: add JSONB containment example of a key and empty object
Backpatch through 9.5
1 parent 23d29ce commit b292ee7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

doc/src/sgml/json.sgml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ SELECT '[1, 2, 3]'::jsonb @> '[1, 2, 2]'::jsonb;
280280

281281
-- The object with a single pair on the right side is contained
282282
-- within the object on the left side:
283-
SELECT '{"product": "PostgreSQL", "version": 9.4, "jsonb":true}'::jsonb @> '{"version":9.4}'::jsonb;
283+
SELECT '{"product": "PostgreSQL", "version": 9.4, "jsonb": true}'::jsonb @> '{"version": 9.4}'::jsonb;
284284

285285
-- The array on the right side is <emphasis>not</> considered contained within the
286286
-- array on the left, even though a similar array is nested within it:
@@ -291,6 +291,9 @@ SELECT '[1, 2, [1, 3]]'::jsonb @&gt; '[[1, 3]]'::jsonb;
291291

292292
-- Similarly, containment is not reported here:
293293
SELECT '{"foo": {"bar": "baz"}}'::jsonb @&gt; '{"bar": "baz"}'::jsonb; -- yields false
294+
295+
-- A top-level key and an empty object is contained:
296+
SELECT '{"foo": {"bar": "baz"}}'::jsonb @&gt; '{"foo": {}}'::jsonb;
294297
</programlisting>
295298

296299
<para>

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