@ -439,10 +439,10 @@ flattenJsonPathParseItem(StringInfo buf, int *result, struct Node *escontext,
break ;
break ;
case jpiType :
case jpiType :
case jpiSize :
case jpiSize :
case jpiDouble :
case jpiAbs :
case jpiAbs :
case jpiCeiling :
case jpiFloor :
case jpiFloor :
case jpiCeiling :
case jpiDouble :
case jpiKeyValue :
case jpiKeyValue :
break ;
break ;
default :
default :
@ -610,6 +610,18 @@ printJsonPathItem(StringInfo buf, JsonPathItem *v, bool inKey,
if ( printBracketes )
if ( printBracketes )
appendStringInfoChar ( buf , ' ) ' ) ;
appendStringInfoChar ( buf , ' ) ' ) ;
break ;
break ;
case jpiPlus :
case jpiMinus :
if ( printBracketes )
appendStringInfoChar ( buf , ' ( ' ) ;
appendStringInfoChar ( buf , v - > type = = jpiPlus ? ' + ' : ' - ' ) ;
jspGetArg ( v , & elem ) ;
printJsonPathItem ( buf , & elem , false ,
operationPriority ( elem . type ) < =
operationPriority ( v - > type ) ) ;
if ( printBracketes )
appendStringInfoChar ( buf , ' ) ' ) ;
break ;
case jpiFilter :
case jpiFilter :
appendStringInfoString ( buf , " ?( " ) ;
appendStringInfoString ( buf , " ?( " ) ;
jspGetArg ( v , & elem ) ;
jspGetArg ( v , & elem ) ;
@ -700,35 +712,23 @@ printJsonPathItem(StringInfo buf, JsonPathItem *v, bool inKey,
v - > content . anybounds . first ,
v - > content . anybounds . first ,
v - > content . anybounds . last ) ;
v - > content . anybounds . last ) ;
break ;
break ;
case jpiPlus :
case jpiMinus :
if ( printBracketes )
appendStringInfoChar ( buf , ' ( ' ) ;
appendStringInfoChar ( buf , v - > type = = jpiPlus ? ' + ' : ' - ' ) ;
jspGetArg ( v , & elem ) ;
printJsonPathItem ( buf , & elem , false ,
operationPriority ( elem . type ) < =
operationPriority ( v - > type ) ) ;
if ( printBracketes )
appendStringInfoChar ( buf , ' ) ' ) ;
break ;
case jpiType :
case jpiType :
appendStringInfoString ( buf , " .type() " ) ;
appendStringInfoString ( buf , " .type() " ) ;
break ;
break ;
case jpiSize :
case jpiSize :
appendStringInfoString ( buf , " .size() " ) ;
appendStringInfoString ( buf , " .size() " ) ;
break ;
break ;
case jpiDouble :
appendStringInfoString ( buf , " .double() " ) ;
break ;
case jpiAbs :
case jpiAbs :
appendStringInfoString ( buf , " .abs() " ) ;
appendStringInfoString ( buf , " .abs() " ) ;
break ;
break ;
case jpiFloor :
appendStringInfoString ( buf , " .floor() " ) ;
break ;
case jpiCeiling :
case jpiCeiling :
appendStringInfoString ( buf , " .ceiling() " ) ;
appendStringInfoString ( buf , " .ceiling() " ) ;
break ;
break ;
case jpiFloor :
case jpiDouble :
appendStringInfoString ( buf , " .floor () " ) ;
appendStringInfoString ( buf , " .double () " ) ;
break ;
break ;
case jpiDatetime :
case jpiDatetime :
appendStringInfoString ( buf , " .datetime( " ) ;
appendStringInfoString ( buf , " .datetime( " ) ;
@ -771,11 +771,11 @@ jspOperationName(JsonPathItemType type)
return " <= " ;
return " <= " ;
case jpiGreaterOrEqual :
case jpiGreaterOrEqual :
return " >= " ;
return " >= " ;
case jpiAdd :
case jpiPlus :
case jpiPlus :
case jpiAdd :
return " + " ;
return " + " ;
case jpiSub :
case jpiMinus :
case jpiMinus :
case jpiSub :
return " - " ;
return " - " ;
case jpiMul :
case jpiMul :
return " * " ;
return " * " ;
@ -783,26 +783,26 @@ jspOperationName(JsonPathItemType type)
return " / " ;
return " / " ;
case jpiMod :
case jpiMod :
return " % " ;
return " % " ;
case jpiStartsWith :
return " starts with " ;
case jpiLikeRegex :
return " like_regex " ;
case jpiType :
case jpiType :
return " type " ;
return " type " ;
case jpiSize :
case jpiSize :
return " size " ;
return " size " ;
case jpiKeyValue :
return " keyvalue " ;
case jpiDouble :
case jpiDouble :
return " double " ;
return " double " ;
case jpiAbs :
case jpiAbs :
return " abs " ;
return " abs " ;
case jpiCeiling :
return " ceiling " ;
case jpiFloor :
case jpiFloor :
return " floor " ;
return " floor " ;
case jpiCeiling :
return " ceiling " ;
case jpiDatetime :
case jpiDatetime :
return " datetime " ;
return " datetime " ;
case jpiKeyValue :
return " keyvalue " ;
case jpiStartsWith :
return " starts with " ;
case jpiLikeRegex :
return " like_regex " ;
default :
default :
elog ( ERROR , " unrecognized jsonpath item type: %d " , type ) ;
elog ( ERROR , " unrecognized jsonpath item type: %d " , type ) ;
return NULL ;
return NULL ;
@ -893,10 +893,10 @@ jspInitByBuffer(JsonPathItem *v, char *base, int32 pos)
case jpiAnyKey :
case jpiAnyKey :
case jpiType :
case jpiType :
case jpiSize :
case jpiSize :
case jpiDouble :
case jpiAbs :
case jpiAbs :
case jpiCeiling :
case jpiFloor :
case jpiFloor :
case jpiCeiling :
case jpiDouble :
case jpiKeyValue :
case jpiKeyValue :
case jpiLast :
case jpiLast :
break ;
break ;
@ -935,9 +935,9 @@ jspInitByBuffer(JsonPathItem *v, char *base, int32 pos)
case jpiNot :
case jpiNot :
case jpiExists :
case jpiExists :
case jpiIsUnknown :
case jpiIsUnknown :
case jpiFilter :
case jpiPlus :
case jpiPlus :
case jpiMinus :
case jpiMinus :
case jpiFilter :
case jpiDatetime :
case jpiDatetime :
read_int32 ( v - > content . arg , base , pos ) ;
read_int32 ( v - > content . arg , base , pos ) ;
break ;
break ;
@ -989,6 +989,13 @@ jspGetNext(JsonPathItem *v, JsonPathItem *a)
v - > type = = jpiRoot | |
v - > type = = jpiRoot | |
v - > type = = jpiVariable | |
v - > type = = jpiVariable | |
v - > type = = jpiLast | |
v - > type = = jpiLast | |
v - > type = = jpiAdd | |
v - > type = = jpiSub | |
v - > type = = jpiMul | |
v - > type = = jpiDiv | |
v - > type = = jpiMod | |
v - > type = = jpiPlus | |
v - > type = = jpiMinus | |
v - > type = = jpiEqual | |
v - > type = = jpiEqual | |
v - > type = = jpiNotEqual | |
v - > type = = jpiNotEqual | |
v - > type = = jpiGreater | |
v - > type = = jpiGreater | |
@ -999,19 +1006,12 @@ jspGetNext(JsonPathItem *v, JsonPathItem *a)
v - > type = = jpiOr | |
v - > type = = jpiOr | |
v - > type = = jpiNot | |
v - > type = = jpiNot | |
v - > type = = jpiIsUnknown | |
v - > type = = jpiIsUnknown | |
v - > type = = jpiAdd | |
v - > type = = jpiPlus | |
v - > type = = jpiSub | |
v - > type = = jpiMinus | |
v - > type = = jpiMul | |
v - > type = = jpiDiv | |
v - > type = = jpiMod | |
v - > type = = jpiType | |
v - > type = = jpiType | |
v - > type = = jpiSize | |
v - > type = = jpiSize | |
v - > type = = jpiDouble | |
v - > type = = jpiAbs | |
v - > type = = jpiAbs | |
v - > type = = jpiCeiling | |
v - > type = = jpiFloor | |
v - > type = = jpiFloor | |
v - > type = = jpiCeiling | |
v - > type = = jpiDouble | |
v - > type = = jpiDatetime | |
v - > type = = jpiDatetime | |
v - > type = = jpiKeyValue | |
v - > type = = jpiKeyValue | |
v - > type = = jpiStartsWith | |
v - > type = = jpiStartsWith | |