diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2014-08-09 16:35:29 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2014-08-09 16:35:29 -0400 |
commit | 495cadda5ed55f63db9a91d174b6fad0e1816204 (patch) | |
tree | 995668755616c0af93c5d8176acc27c0a36016d0 /doc/src | |
parent | 9da86753735ab89b0ee685aea985b25c4218ca0b (diff) | |
download | postgresql-495cadda5ed55f63db9a91d174b6fad0e1816204.tar.gz postgresql-495cadda5ed55f63db9a91d174b6fad0e1816204.zip |
Further cleanup of JSON-specific error messages.
Fix an obvious typo in json_build_object()'s complaint about invalid
number of arguments, and make the errhint a bit more sensible too.
Per discussion about how to word the improved hint, change the few places
in the documentation that refer to JSON object field names as "names" to
say "keys" instead, since that's what we've said in the vast majority of
places in the docs. Arguably "name" is more correct, since that's the
terminology used in RFC 7159; but we're stuck with "key" in view of the
naming of json_object_keys() so let's at least be self-consistent.
I adjusted a few code comments to match this as well, and failed to
resist the temptation to clean up some odd whitespace choices in the
same area, as well as a useless duplicate PG_ARGISNULL() check. There's
still quite a bit of code that uses the phrase "field name" in non-user-
visible ways, so I left those usages alone.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/func.sgml | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 19c2d6cab6c..13c71af8f01 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -10317,7 +10317,7 @@ table2-mapping <entry> Builds a JSON object out of a variadic argument list. By convention, the argument list consists of alternating - names and values. + keys and values. </entry> <entry><literal>json_build_object('foo',1,'bar',2)</literal></entry> <entry><literal>{"foo": 1, "bar": 2}</literal></entry> @@ -10329,9 +10329,9 @@ table2-mapping <entry> Builds a JSON object out of a text array. The array must have either exactly one dimension with an even number of members, in which case - they are taken as alternating name/value pairs, or two dimensions + they are taken as alternating key/value pairs, or two dimensions such that each inner array has exactly two elements, which - are taken as a name/value pair. + are taken as a key/value pair. </entry> <entry><para><literal>json_object('{a, 1, b, "def", c, 3.5}')</></para> <para><literal>json_object('{{a, 1},{b, "def"},{c, 3.5}}')</></para></entry> @@ -10715,9 +10715,9 @@ table2-mapping <function>json_to_record</> and <function>json_to_recordset</>, type coercion from the JSON is <quote>best effort</> and may not result in desired values for some types. JSON keys are matched to - identical field names in the target row type, and fields that do - not exist in the JSON will simply be NULL. JSON keys that do not - appear in the target row type will be omitted from the output. + identical column names in the target row type. JSON fields that do not + appear in the target row type will be omitted from the output, and + target columns that do not match any JSON field will simply be NULL. </para> </note> |