Skip to content

Commit 8ea2d2b

Browse files
author
Nikita Glukhov
committed
Optimize JsonToJsonValue() for jsonv containers
1 parent 9951a7b commit 8ea2d2b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/backend/utils/adt/json_generic.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,9 @@ jsonvContainerOps =
562562
JsonValue *
563563
JsonToJsonValue(Json *json, JsonValue *jv)
564564
{
565+
if (JsonRoot(json)->ops == &jsonvContainerOps)
566+
return (JsonValue *) JsonRoot(json)->data;
567+
565568
if (!jv)
566569
jv = palloc(sizeof(JsonValue));
567570

src/backend/utils/adt/jsonb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -862,11 +862,11 @@ datum_to_jsonb(Datum val, bool is_null, JsonbInState *result,
862862
{
863863
JsonbIteratorToken type;
864864

865-
JsonToJsonValue(jsonb, &jb);
866865

867866
if (result->parseState)
868867
{
869-
pushScalarJsonbValue(&result->parseState, &jb,
868+
pushScalarJsonbValue(&result->parseState,
869+
JsonToJsonValue(jsonb, &jb),
870870
false, false);
871871
return;
872872
}

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