aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/jsonb_util.c
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2015-05-26 22:54:55 -0400
committerAndrew Dunstan <andrew@dunslane.net>2015-05-26 22:56:06 -0400
commitc8c6a693ecb69d9f5f83da14e2501bc49f49612b (patch)
tree1de288c569f61be10ecabf8c72a9ddb02adae9ba /src/backend/utils/adt/jsonb_util.c
parent79f0f7cab81b03e930deea6220e8bbc5b46f392a (diff)
downloadpostgresql-c8c6a693ecb69d9f5f83da14e2501bc49f49612b.tar.gz
postgresql-c8c6a693ecb69d9f5f83da14e2501bc49f49612b.zip
Revert "Add all structured objects passed to pushJsonbValue piecewise."
This reverts commit 54547bd87f49326d67051254c363e6597d16ffda. This appears to have been a thinko on my part. I will try to come up wioth a better solution.
Diffstat (limited to 'src/backend/utils/adt/jsonb_util.c')
-rw-r--r--src/backend/utils/adt/jsonb_util.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/backend/utils/adt/jsonb_util.c b/src/backend/utils/adt/jsonb_util.c
index 6e608cb1523..e94c4ccb0bb 100644
--- a/src/backend/utils/adt/jsonb_util.c
+++ b/src/backend/utils/adt/jsonb_util.c
@@ -509,8 +509,8 @@ fillJsonbValue(JsonbContainer *container, int index,
* "raw scalar" pseudo array to append it - the actual scalar should be passed
* next and it will be added as the only member of the array.
*
- * All non-scalar types (jvbBinary, jbvArray and jbvObject) passed as
- * elements or values are unpacked before being added to the result.
+ * Values of type jvbBinary, which are rolled up arrays and objects,
+ * are unpacked before being added to the result.
*/
JsonbValue *
pushJsonbValue(JsonbParseState **pstate, JsonbIteratorToken seq,
@@ -522,18 +522,14 @@ pushJsonbValue(JsonbParseState **pstate, JsonbIteratorToken seq,
JsonbIteratorToken tok;
if (!jbval || (seq != WJB_ELEM && seq != WJB_VALUE) ||
- IsAJsonbScalar(jbval))
+ jbval->type != jbvBinary)
{
/* drop through */
return pushJsonbValueScalar(pstate, seq, jbval);
}
- /* unpack the data and add each piece to the pstate */
- if (jbval->type == jbvBinary)
- it = JsonbIteratorInit(jbval->val.binary.data);
- else
- it = JsonbIteratorInit(jbval);
-
+ /* unpack the binary and add each piece to the pstate */
+ it = JsonbIteratorInit(jbval->val.binary.data);
while ((tok = JsonbIteratorNext(&it, &v, false)) != WJB_DONE)
res = pushJsonbValueScalar(pstate, tok,
tok < WJB_BEGIN_ARRAY ? &v : NULL);