Fix vague comment in jsonb documentation
authorAlexander Korotkov
Tue, 9 Mar 2021 15:16:03 +0000 (18:16 +0300)
committerAlexander Korotkov
Tue, 9 Mar 2021 15:16:03 +0000 (18:16 +0300)
The sample query fails because of an attempt to update the key of a numeric.
But the comment says it's just because of the missing object key.  That's not
correct because jsonb subscription automatically adds missing keys.

Reported-by: Nikita Konev
doc/src/sgml/json.sgml

index e16dd6973d2c03882795c6e63ace9ffeff405656..6ab836548b29f27d51b4c8309843685db06646d1 100644 (file)
@@ -648,7 +648,8 @@ SELECT ('[1, "2", null]'::jsonb)[1];
 UPDATE table_name SET jsonb_field['key'] = '1';
 
 -- This will raise an error if any record's jsonb_field['a']['b'] is something
--- other than an object. For example, the value {"a": 1} has no 'b' key.
+-- other than an object. For example, the value {"a": 1} has a numeric value
+-- of the key 'a'.
 UPDATE table_name SET jsonb_field['a']['b']['c'] = '1';
 
 -- Filter records using a WHERE clause with subscripting. Since the result of