diff options
author | Bruce Momjian <bruce@momjian.us> | 2014-04-22 18:19:07 -0400 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2014-04-22 18:19:07 -0400 |
commit | 26cd1d7d9513b2b490efc746551ec5a786b56212 (patch) | |
tree | 27154d3e39e456c1da0a4f85b1aec3ccf009f495 /doc/src | |
parent | 19fa6161dd6ba85b6c88b3476d165745dd5192d9 (diff) | |
download | postgresql-26cd1d7d9513b2b490efc746551ec5a786b56212.tar.gz postgresql-26cd1d7d9513b2b490efc746551ec5a786b56212.zip |
docs: add results for JSON operator examples
Patch by Sehrope Sarkuni
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/func.sgml | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 148f0bc2378..0c8fc67cc62 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -10099,6 +10099,7 @@ table2-mapping <entry>Right Operand Type</entry> <entry>Description</entry> <entry>Example</entry> + <entry>Example Result</entry> </row> </thead> <tbody> @@ -10106,37 +10107,43 @@ table2-mapping <entry><literal>-></literal></entry> <entry>int</entry> <entry>Get JSON array element</entry> - <entry><literal>'[1,2,3]'::json->2</literal></entry> + <entry><literal>'[{"a":"foo"},{"a":"bar"},{"a":"baz"}]'::json->2</literal></entry> + <entry><literal>{"a":"baz"}</literal></entry> </row> <row> <entry><literal>-></literal></entry> <entry>text</entry> <entry>Get JSON object field</entry> - <entry><literal>'{"a":1,"b":2}'::json->'b'</literal></entry> + <entry><literal>'{"a": {"b":"foo"}}'::json->'a'</literal></entry> + <entry><literal>{"b":"foo"}</literal></entry> </row> <row> <entry><literal>->></literal></entry> <entry>int</entry> <entry>Get JSON array element as text</entry> <entry><literal>'[1,2,3]'::json->>2</literal></entry> + <entry><literal>3</literal></entry> </row> <row> <entry><literal>->></literal></entry> <entry>text</entry> <entry>Get JSON object field as text</entry> <entry><literal>'{"a":1,"b":2}'::json->>'b'</literal></entry> + <entry><literal>2</literal></entry> </row> <row> <entry><literal>#></literal></entry> <entry>text[]</entry> - <entry>Get JSON object at specified path</entry> - <entry><literal>'{"a":[1,2,3],"b":[4,5,6]}'::json#>'{a,2}'</literal></entry> + <entry>Get JSON object at specified path</entry> + <entry><literal>'{"a": {"b":{"c": "foo"}}}'::json#>'{a,b}'</literal></entry> + <entry><literal>{"c": "foo"}</literal></entry> </row> <row> <entry><literal>#>></literal></entry> <entry>text[]</entry> <entry>Get JSON object at specified path as text</entry> <entry><literal>'{"a":[1,2,3],"b":[4,5,6]}'::json#>>'{a,2}'</literal></entry> + <entry><literal>3</literal></entry> </row> </tbody> </tgroup> |