@@ -23,7 +23,8 @@ static int
23
23
flattenJsonPathParseItem (StringInfo buf , JsonPathParseItem * item ,
24
24
bool forbiddenRoot )
25
25
{
26
- int32 pos = buf -> len - VARHDRSZ ; /* position from begining of jsonpath data */
26
+ /* position from begining of jsonpath data */
27
+ int32 pos = buf -> len - JSONPATH_HDRSZ ;
27
28
int32 chld , next ;
28
29
29
30
check_stack_depth ();
@@ -171,7 +172,7 @@ jsonpath_in(PG_FUNCTION_ARGS)
171
172
initStringInfo (& buf );
172
173
enlargeStringInfo (& buf , 4 * len /* estimation */ );
173
174
174
- appendStringInfoSpaces (& buf , VARHDRSZ );
175
+ appendStringInfoSpaces (& buf , JSONPATH_HDRSZ );
175
176
176
177
if (!jsonpath )
177
178
ereport (ERROR ,
@@ -182,6 +183,7 @@ jsonpath_in(PG_FUNCTION_ARGS)
182
183
183
184
res = (JsonPath * )buf .data ;
184
185
SET_VARSIZE (res , buf .len );
186
+ res -> header = JSONPATH_VERSION ;
185
187
186
188
PG_RETURN_JSONPATH_P (res );
187
189
}
@@ -424,7 +426,8 @@ jsonpath_out(PG_FUNCTION_ARGS)
424
426
void
425
427
jspInit (JsonPathItem * v , JsonPath * js )
426
428
{
427
- jspInitByBuffer (v , VARDATA (js ), 0 );
429
+ Assert (js -> header == JSONPATH_VERSION );
430
+ jspInitByBuffer (v , js -> data , 0 );
428
431
}
429
432
430
433
void
0 commit comments