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

Commitfe47032

Browse files
author
Nikita Glukhov
committed
Simplify json container pushing
1 parent2b60f86 commitfe47032

File tree

1 file changed

+6
-38
lines changed

1 file changed

+6
-38
lines changed

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

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4991,24 +4991,9 @@ setPathObject(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
49914991
}
49924992

49934993
(void)pushJsonbValue(st,r,&k);
4994-
r=JsonbIteratorNext(it,&v, false);
4995-
(void)pushJsonbValue(st,r,r<WJB_BEGIN_ARRAY ?&v :NULL);
4996-
if (r==WJB_BEGIN_ARRAY||r==WJB_BEGIN_OBJECT)
4997-
{
4998-
intwalking_level=1;
4999-
5000-
while (walking_level!=0)
5001-
{
5002-
r=JsonbIteratorNext(it,&v, false);
5003-
5004-
if (r==WJB_BEGIN_ARRAY||r==WJB_BEGIN_OBJECT)
5005-
++walking_level;
5006-
if (r==WJB_END_ARRAY||r==WJB_END_OBJECT)
5007-
--walking_level;
5008-
5009-
(void)pushJsonbValue(st,r,r<WJB_BEGIN_ARRAY ?&v :NULL);
5010-
}
5011-
}
4994+
r=JsonbIteratorNext(it,&v, true);
4995+
Assert(r==WJB_VALUE);
4996+
(void)pushJsonbValue(st,r,&v);
50124997
}
50134998
}
50144999

@@ -5149,26 +5134,9 @@ setPathArray(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
51495134
}
51505135
else
51515136
{
5152-
r=JsonbIteratorNext(it,&v, false);
5153-
5154-
(void)pushJsonbValue(st,r,r<WJB_BEGIN_ARRAY ?&v :NULL);
5155-
5156-
if (r==WJB_BEGIN_ARRAY||r==WJB_BEGIN_OBJECT)
5157-
{
5158-
intwalking_level=1;
5159-
5160-
while (walking_level!=0)
5161-
{
5162-
r=JsonbIteratorNext(it,&v, false);
5163-
5164-
if (r==WJB_BEGIN_ARRAY||r==WJB_BEGIN_OBJECT)
5165-
++walking_level;
5166-
if (r==WJB_END_ARRAY||r==WJB_END_OBJECT)
5167-
--walking_level;
5168-
5169-
(void)pushJsonbValue(st,r,r<WJB_BEGIN_ARRAY ?&v :NULL);
5170-
}
5171-
}
5137+
r=JsonbIteratorNext(it,&v, true);
5138+
Assert(r==WJB_ELEM);
5139+
(void)pushJsonbValue(st,r,&v);
51725140
}
51735141
}
51745142

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp