aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2015-10-07 10:30:54 -0400
committerBruce Momjian <bruce@momjian.us>2015-10-07 10:30:54 -0400
commitc86555fc80bbbf276de42f43761991212b713575 (patch)
tree1559f9d4f9fe586ff755a5f15df2ca7b88fd08fb
parent9445a1cd3cc6dfae3644e2fe95da77046b507491 (diff)
downloadpostgresql-c86555fc80bbbf276de42f43761991212b713575.tar.gz
postgresql-c86555fc80bbbf276de42f43761991212b713575.zip
docs: add JSONB containment example of a key and empty object
Backpatch through 9.5
-rw-r--r--doc/src/sgml/json.sgml5
1 files changed, 4 insertions, 1 deletions
diff --git a/doc/src/sgml/json.sgml b/doc/src/sgml/json.sgml
index 47146b4c221..118fb35e254 100644
--- a/doc/src/sgml/json.sgml
+++ b/doc/src/sgml/json.sgml
@@ -280,7 +280,7 @@ SELECT '[1, 2, 3]'::jsonb @&gt; '[1, 2, 2]'::jsonb;
-- The object with a single pair on the right side is contained
-- within the object on the left side:
-SELECT '{"product": "PostgreSQL", "version": 9.4, "jsonb":true}'::jsonb @&gt; '{"version":9.4}'::jsonb;
+SELECT '{"product": "PostgreSQL", "version": 9.4, "jsonb": true}'::jsonb @&gt; '{"version": 9.4}'::jsonb;
-- The array on the right side is <emphasis>not</> considered contained within the
-- 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;
-- Similarly, containment is not reported here:
SELECT '{"foo": {"bar": "baz"}}'::jsonb @&gt; '{"bar": "baz"}'::jsonb; -- yields false
+
+-- A top-level key and an empty object is contained:
+SELECT '{"foo": {"bar": "baz"}}'::jsonb @&gt; '{"foo": {}}'::jsonb;
</programlisting>
<para>