Skip to content

Commit ca5b66c

Browse files
author
Nikita Glukhov
committed
Add jsonb partial decompression
1 parent 11c9650 commit ca5b66c

File tree

8 files changed

+943
-48
lines changed

8 files changed

+943
-48
lines changed

src/backend/utils/adt/json_generic.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ JsonInit(Json *json)
743743
json->root.ops->init(&json->root, json->obj.value);
744744
}
745745

746-
static Json *
746+
Json *
747747
JsonExpand(Json *tmp, Datum value, bool freeValue, JsonContainerOps *ops)
748748
{
749749
Json *json;
@@ -799,7 +799,8 @@ JsonExpandDatum(Datum value, JsonContainerOps *ops, Json *tmp)
799799
Json *
800800
DatumGetJson(Datum value, JsonContainerOps *ops, Json *tmp)
801801
{
802-
Json *json = JsonExpandDatum(value, ops, tmp);
802+
Json *json = JsonExpandDatum(value, ops, tmp);
803+
803804
JsonInit(json);
804805

805806
return json;
@@ -832,17 +833,21 @@ JsonValueToJson(JsonValue *val)
832833
{
833834
if (val->type == jbvBinary)
834835
{
835-
JsonContainer *jc = val->val.binary.data;
836-
Json *json = JsonExpand(NULL, PointerGetDatum(NULL), false,
837-
jc->ops);
836+
JsonContainer *jc = val->val.binary.data;
837+
Json *json = JsonExpand(NULL, PointerGetDatum(NULL), false,
838+
jc->ops);
839+
838840
json->root = *jc;
841+
839842
return json;
840843
}
841844
else
842845
{
843-
Json *json = JsonExpand(NULL, PointerGetDatum(NULL), false,
844-
&jsonvContainerOps);
846+
Json *json = JsonExpand(NULL, PointerGetDatum(NULL), false,
847+
&jsonvContainerOps);
848+
845849
jsonvInitContainer(&json->root, val);
850+
846851
return json;
847852
}
848853
}

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