Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit54547bd

Browse files
committed
Add all structured objects passed to pushJsonbValue piecewise.
Commit9b74f32 did this for objects oftype jbvBinary, but in trying further to simplify some of the new jsonbcode I discovered that objects of type jbvObject or jbvArray passed asWJB_ELEM or WJB_VALUE also caused problems. These too are now addedcomponent by component.Backpatch to 9.4.
1 parent79f2b5d commit54547bd

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

‎src/backend/utils/adt/jsonb_util.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
*Values of typejvbBinary,which are rolled up arrays and objects,
513-
* are unpacked before being added to the result.
512+
*All non-scalar types (jvbBinary,jbvArray and jbvObject) passed as
513+
*elements or valuesare unpacked before being added to the result.
514514
*/
515515
JsonbValue*
516516
pushJsonbValue(JsonbParseState**pstate,JsonbIteratorTokenseq,
@@ -522,14 +522,18 @@ pushJsonbValue(JsonbParseState **pstate, JsonbIteratorToken seq,
522522
JsonbIteratorTokentok;
523523

524524
if (!jbval|| (seq!=WJB_ELEM&&seq!=WJB_VALUE)||
525-
jbval->type!=jbvBinary)
525+
IsAJsonbScalar(jbval))
526526
{
527527
/* drop through */
528528
returnpushJsonbValueScalar(pstate,seq,jbval);
529529
}
530530

531-
/* unpack the binary and add each piece to the pstate */
532-
it=JsonbIteratorInit(jbval->val.binary.data);
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+
533537
while ((tok=JsonbIteratorNext(&it,&v, false))!=WJB_DONE)
534538
res=pushJsonbValueScalar(pstate,tok,
535539
tok<WJB_BEGIN_ARRAY ?&v :NULL);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp