Skip to content

Commit 1e1149d

Browse files
author
Nikita Glukhov
committed
Minor refactoring of jsonb_set_element()
1 parent 1947dcb commit 1e1149d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/backend/utils/adt/jsonfuncs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4152,17 +4152,17 @@ jsonb_set_element(Datum jsonbdatum, text **path, int path_len,
41524152
{
41534153
Jsonb *jb = DatumGetJsonb(jsonbdatum);
41544154
JsonbValue *newval,
4155-
*res = NULL;
4155+
*res;
41564156
JsonbParseState *state = NULL;
41574157
JsonbIterator *it;
41584158
bool *path_nulls = palloc0(path_len * sizeof(bool));
41594159

41604160
newval = to_jsonb_worker(sourceData, source_type);
4161-
it = JsonbIteratorInit(&jb->root);
41624161

4163-
if (newval->type == jbvArray && newval->val.array.rawScalar == true)
4162+
if (newval->type == jbvArray && newval->val.array.rawScalar)
41644163
*newval = newval->val.array.elems[0];
41654164

4165+
it = JsonbIteratorInit(&jb->root);
41664166

41674167
res = setPath(&it, (Datum *) path, path_nulls, path_len, &state, 0,
41684168
newval, JB_PATH_CREATE);

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