Skip to content

Commit 654809e

Browse files
committed
Fix a couple of trivial issues in jsonb.c
Typo "aggreagate" appeared three times, and the return value of function JsonbIteratorNext() was being assigned to an int variable in a bunch of places.
1 parent 3f190f6 commit 654809e

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/backend/utils/adt/jsonb.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ JsonbToCString(StringInfo out, JsonbContainer *in, int estimated_len)
424424
{
425425
bool first = true;
426426
JsonbIterator *it;
427-
int type = 0;
427+
JsonbIteratorToken type;
428428
JsonbValue v;
429429
int level = 0;
430430
bool redo_switch = false;
@@ -506,7 +506,7 @@ JsonbToCString(StringInfo out, JsonbContainer *in, int estimated_len)
506506
first = false;
507507
break;
508508
default:
509-
elog(ERROR, "unknown flag of jsonb iterator");
509+
elog(ERROR, "unknown jsonb iterator token type");
510510
}
511511
}
512512

@@ -824,7 +824,7 @@ datum_to_jsonb(Datum val, bool is_null, JsonbInState *result,
824824
case JSONBTYPE_JSONB:
825825
{
826826
Jsonb *jsonb = DatumGetJsonb(val);
827-
int type;
827+
JsonbIteratorToken type;
828828
JsonbIterator *it;
829829

830830
it = JsonbIteratorInit(&jsonb->root);
@@ -1519,7 +1519,7 @@ jsonb_agg_transfn(PG_FUNCTION_ARGS)
15191519
JsonbIterator *it;
15201520
Jsonb *jbelem;
15211521
JsonbValue v;
1522-
int type;
1522+
JsonbIteratorToken type;
15231523

15241524
if (val_type == InvalidOid)
15251525
ereport(ERROR,
@@ -1591,7 +1591,7 @@ jsonb_agg_transfn(PG_FUNCTION_ARGS)
15911591
case WJB_VALUE:
15921592
if (v.type == jbvString)
15931593
{
1594-
/* copy string values in the aggreagate context */
1594+
/* copy string values in the aggregate context */
15951595
char *buf = palloc(v.val.string.len + 1);;
15961596
snprintf(buf, v.val.string.len + 1, "%s", v.val.string.val);
15971597
v.val.string.val = buf;
@@ -1607,6 +1607,8 @@ jsonb_agg_transfn(PG_FUNCTION_ARGS)
16071607
result->res = pushJsonbValue(&result->parseState,
16081608
type, &v);
16091609
break;
1610+
default:
1611+
elog(ERROR, "unknown jsonb iterator token type");
16101612
}
16111613
}
16121614

@@ -1667,7 +1669,7 @@ jsonb_object_agg_transfn(PG_FUNCTION_ARGS)
16671669
Jsonb *jbkey,
16681670
*jbval;
16691671
JsonbValue v;
1670-
int type;
1672+
JsonbIteratorToken type;
16711673

16721674
if (!AggCheckCallContext(fcinfo, &aggcontext))
16731675
{
@@ -1750,7 +1752,7 @@ jsonb_object_agg_transfn(PG_FUNCTION_ARGS)
17501752
case WJB_ELEM:
17511753
if (v.type == jbvString)
17521754
{
1753-
/* copy string values in the aggreagate context */
1755+
/* copy string values in the aggregate context */
17541756
char *buf = palloc(v.val.string.len + 1);;
17551757
snprintf(buf, v.val.string.len + 1, "%s", v.val.string.val);
17561758
v.val.string.val = buf;
@@ -1808,7 +1810,7 @@ jsonb_object_agg_transfn(PG_FUNCTION_ARGS)
18081810
case WJB_VALUE:
18091811
if (v.type == jbvString)
18101812
{
1811-
/* copy string values in the aggreagate context */
1813+
/* copy string values in the aggregate context */
18121814
char *buf = palloc(v.val.string.len + 1);;
18131815
snprintf(buf, v.val.string.len + 1, "%s", v.val.string.val);
18141816
v.val.string.val = buf;
@@ -1825,6 +1827,8 @@ jsonb_object_agg_transfn(PG_FUNCTION_ARGS)
18251827
single_scalar ? WJB_VALUE : type,
18261828
&v);
18271829
break;
1830+
default:
1831+
elog(ERROR, "unknown jsonb iterator token type");
18281832
}
18291833
}
18301834

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy