Skip to content

Commit 9429f3f

Browse files
author
Nikita Glukhov
committed
Return back JsonInit()
This reverts commit 7fbff1afd2632039d28122cd852001957884134e.
1 parent e133dea commit 9429f3f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/backend/utils/adt/json_generic.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,24 @@ JsonToJsonValue(Json *json, JsonValue *jv)
6969
return JsonValueInitBinary(jv, &json->root);
7070
}
7171

72+
static void
73+
JsonInit(Json *json)
74+
{
75+
const void *data = DatumGetPointer(json->obj.value);
76+
struct varlena *detoasted_data;
77+
78+
Assert(JsonContainerDataPtr(&json->root) || data);
79+
80+
if (JsonContainerDataPtr(&json->root) || !data) /* FIXME */
81+
return;
82+
83+
detoasted_data = PG_DETOAST_DATUM(json->obj.value);
84+
json->obj.value = PointerGetDatum(detoasted_data);
85+
json->obj.freeValue |= data != detoasted_data;
86+
87+
json->root.ops->init(&json->root, json->obj.value);
88+
}
89+
7290
static Json *
7391
JsonExpand(Json *tmp, Datum value, bool freeValue, JsonContainerOps *ops)
7492
{

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