Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Remove unnecessary check for jbvBinary in convertJsonbValue.
authorAndrew Dunstan <andrew@dunslane.net>
Wed, 18 Jun 2014 23:28:20 +0000 (19:28 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Wed, 18 Jun 2014 23:32:08 +0000 (19:32 -0400)
The check was confusing and is a condition that should never in fact
happen.

Per gripe from Dmitry Dolgov.

src/backend/utils/adt/jsonb_util.c

index 93bb148232e140d357c0fb60aac04beddc03d43c..04f35bfffc99beb50a635dd00538217fbd502064 100644 (file)
@@ -1314,7 +1314,14 @@ convertJsonbValue(StringInfo buffer, JEntry *header, JsonbValue *val, int level)
    if (!val)
        return;
 
-   if (IsAJsonbScalar(val) || val->type == jbvBinary)
+   /*
+    * A JsonbValue passed as val should never have a type of jbvBinary,
+    * and neither should any of its sub-components. Those values will be
+    * produced by convertJsonbArray and convertJsonbObject, the results of
+    * which will not be passed back to this function as an argument.
+    */
+
+   if (IsAJsonbScalar(val))
        convertJsonbScalar(buffer, header, val);
    else if (val->type == jbvArray)
        convertJsonbArray(buffer, header, val, level);