Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

+18
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)