@@ -509,8 +509,8 @@ fillJsonbValue(JsonbContainer *container, int index,
509509 * "raw scalar" pseudo array to append it - the actual scalar should be passed
510510 * next and it will be added as the only member of the array.
511511 *
512- * All non-scalar types ( jvbBinary, jbvArray and jbvObject) passed as
513- * elements or values are unpacked before being added to the result.
512+ * Values of type jvbBinary, which are rolled up arrays and objects,
513+ * are unpacked before being added to the result.
514514 */
515515JsonbValue *
516516pushJsonbValue (JsonbParseState * * pstate , JsonbIteratorToken seq ,
@@ -522,18 +522,14 @@ pushJsonbValue(JsonbParseState **pstate, JsonbIteratorToken seq,
522522 JsonbIteratorToken tok ;
523523
524524 if (!jbval || (seq != WJB_ELEM && seq != WJB_VALUE ) ||
525- IsAJsonbScalar ( jbval ) )
525+ jbval -> type != jbvBinary )
526526 {
527527 /* drop through */
528528 return pushJsonbValueScalar (pstate , seq , jbval );
529529 }
530530
531- /* unpack the data and add each piece to the pstate */
532- if (jbval -> type == jbvBinary )
533- it = JsonbIteratorInit (jbval -> val .binary .data );
534- else
535- it = JsonbIteratorInit (jbval );
536-
531+ /* unpack the binary and add each piece to the pstate */
532+ it = JsonbIteratorInit (jbval -> val .binary .data );
537533 while ((tok = JsonbIteratorNext (& it , & v , false)) != WJB_DONE )
538534 res = pushJsonbValueScalar (pstate , tok ,
539535 tok < WJB_BEGIN_ARRAY ? & v : NULL );
0 commit comments