@@ -179,8 +179,8 @@ jsonpath_in(PG_FUNCTION_ARGS)
179
179
{
180
180
char * in = PG_GETARG_CSTRING (0 );
181
181
int32 len = strlen (in );
182
- JsonPathParseItem * jsonpath = parsejsonpath (in , len );
183
- JsonPath * res ;
182
+ JsonPathParseResult * jsonpath = parsejsonpath (in , len );
183
+ JsonPath * res ;
184
184
StringInfoData buf ;
185
185
186
186
initStringInfo (& buf );
@@ -193,11 +193,13 @@ jsonpath_in(PG_FUNCTION_ARGS)
193
193
(errcode (ERRCODE_INVALID_TEXT_REPRESENTATION ),
194
194
errmsg ("invalid input syntax for jsonpath: \"%s\"" , in )));
195
195
196
- flattenJsonPathParseItem (& buf , jsonpath , false);
196
+ flattenJsonPathParseItem (& buf , jsonpath -> expr , false);
197
197
198
198
res = (JsonPath * )buf .data ;
199
199
SET_VARSIZE (res , buf .len );
200
200
res -> header = JSONPATH_VERSION ;
201
+ if (jsonpath -> lax )
202
+ res -> header |= JSONPATH_LAX ;
201
203
202
204
PG_RETURN_JSONPATH_P (res );
203
205
}
@@ -414,6 +416,9 @@ jsonpath_out(PG_FUNCTION_ARGS)
414
416
initStringInfo (& buf );
415
417
enlargeStringInfo (& buf , VARSIZE (in ) /* estimation */ );
416
418
419
+ if (!(in -> header & JSONPATH_LAX ))
420
+ appendBinaryStringInfo (& buf , "strict " , 7 );
421
+
417
422
jspInit (& v , in );
418
423
printJsonPathItem (& buf , & v , false, true);
419
424
@@ -447,7 +452,7 @@ jsonpath_out(PG_FUNCTION_ARGS)
447
452
void
448
453
jspInit (JsonPathItem * v , JsonPath * js )
449
454
{
450
- Assert (js -> header == JSONPATH_VERSION );
455
+ Assert (( js -> header & ~ JSONPATH_LAX ) == JSONPATH_VERSION );
451
456
jspInitByBuffer (v , js -> data , 0 );
452
457
}
453
458
0 commit comments