From 495cadda5ed55f63db9a91d174b6fad0e1816204 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 9 Aug 2014 16:35:29 -0400 Subject: 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. --- doc/src/sgml/func.sgml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'doc/src') 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 Builds a JSON object out of a variadic argument list. By convention, the argument list consists of alternating - names and values. + keys and values. json_build_object('foo',1,'bar',2) {"foo": 1, "bar": 2} @@ -10329,9 +10329,9 @@ table2-mapping 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. json_object('{a, 1, b, "def", c, 3.5}') json_object('{{a, 1},{b, "def"},{c, 3.5}}') @@ -10715,9 +10715,9 @@ table2-mapping json_to_record and json_to_recordset, type coercion from the JSON is 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. -- cgit v1.2.3