Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb292ee7

Browse files
committed
docs: add JSONB containment example of a key and empty object
Backpatch through 9.5
1 parent23d29ce commitb292ee7

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)

[8]ページ先頭

©2009-2025 Movatter.jp