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

Commitc23b7fd

Browse files
author
Nikita Glukhov
committed
Simplify json container pushing
1 parent563371f commitc23b7fd

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
@@ -5061,24 +5061,9 @@ setPathObject(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
50615061
}
50625062

50635063
(void)pushJsonbValue(st,r,&k);
5064-
r=JsonbIteratorNext(it,&v, false);
5065-
(void)pushJsonbValue(st,r,r<WJB_BEGIN_ARRAY ?&v :NULL);
5066-
if (r==WJB_BEGIN_ARRAY||r==WJB_BEGIN_OBJECT)
5067-
{
5068-
intwalking_level=1;
5069-
5070-
while (walking_level!=0)
5071-
{
5072-
r=JsonbIteratorNext(it,&v, false);
5073-
5074-
if (r==WJB_BEGIN_ARRAY||r==WJB_BEGIN_OBJECT)
5075-
++walking_level;
5076-
if (r==WJB_END_ARRAY||r==WJB_END_OBJECT)
5077-
--walking_level;
5078-
5079-
(void)pushJsonbValue(st,r,r<WJB_BEGIN_ARRAY ?&v :NULL);
5080-
}
5081-
}
5064+
r=JsonbIteratorNext(it,&v, true);
5065+
Assert(r==WJB_VALUE);
5066+
(void)pushJsonbValue(st,r,&v);
50825067
}
50835068
}
50845069

@@ -5219,26 +5204,9 @@ setPathArray(JsonbIterator **it, Datum *path_elems, bool *path_nulls,
52195204
}
52205205
else
52215206
{
5222-
r=JsonbIteratorNext(it,&v, false);
5223-
5224-
(void)pushJsonbValue(st,r,r<WJB_BEGIN_ARRAY ?&v :NULL);
5225-
5226-
if (r==WJB_BEGIN_ARRAY||r==WJB_BEGIN_OBJECT)
5227-
{
5228-
intwalking_level=1;
5229-
5230-
while (walking_level!=0)
5231-
{
5232-
r=JsonbIteratorNext(it,&v, false);
5233-
5234-
if (r==WJB_BEGIN_ARRAY||r==WJB_BEGIN_OBJECT)
5235-
++walking_level;
5236-
if (r==WJB_END_ARRAY||r==WJB_END_OBJECT)
5237-
--walking_level;
5238-
5239-
(void)pushJsonbValue(st,r,r<WJB_BEGIN_ARRAY ?&v :NULL);
5240-
}
5241-
}
5207+
r=JsonbIteratorNext(it,&v, true);
5208+
Assert(r==WJB_ELEM);
5209+
(void)pushJsonbValue(st,r,&v);
52425210
}
52435211
}
52445212

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp