PostgreSQL Source Code: src/backend/utils/adt/jsonpath.c File Reference (original) (raw)
Go to the source code of this file.
Macros | |
---|---|
#define | read_byte(v, b, p) |
#define | read_int32(v, b, p) |
#define | read_int32_n(v, b, p, n) |
◆ read_byte
| #define read_byte | ( | | v, | | -------------------------------------------------------- | - | | -- | | | b, | | | | | | p | | | | | ) | | | |
Value:
do { \
(p) += 1; \
} while(0) \
Definition at line 961 of file jsonpath.c.
◆ read_int32
| #define read_int32 | ( | | v, | | -------------------------------------------------------- | - | | -- | | | b, | | | | | | p | | | | | ) | | | |
◆ read_int32_n
| #define read_int32_n | ( | | v, | | -------------------------------------------------------- | - | | -- | | | b, | | | | | | p, | | | | | | n | | | | | ) | | | |
Value:
do { \
(v) = (void *)((b) + (p)); \
(p) += sizeof(int32) * (n); \
} while(0) \
Definition at line 971 of file jsonpath.c.
◆ JsonPathDatatypeStatus
Enumerator |
---|
jpdsNonDateTime |
jpdsUnknownDateTime |
jpdsDateTimeZoned |
jpdsDateTimeNonZoned |
Definition at line 1254 of file jsonpath.c.
◆ alignStringInfoInt()
static void alignStringInfoInt ( StringInfo buf) | static |
---|
◆ flattenJsonPathParseItem()
static bool flattenJsonPathParseItem ( StringInfo buf, int * result, struct Node * escontext, JsonPathParseItem * item, int nestingLevel, bool insideArraySubscript ) | static |
---|
Definition at line 239 of file jsonpath.c.
242{
243
247 int argNestingLevel = 0;
248
251
253
254
255
256
257
258
260
261
262
263
264
266
267 switch (item->type)
268 {
277 break;
281 break;
285 break;
301 {
302
303
304
305
306
309
311 chld = pos;
314 nestingLevel + argNestingLevel,
315 insideArraySubscript))
316 return false;
317 *(int32 *) (buf->data + left) = chld - pos;
318
320 chld = pos;
323 nestingLevel + argNestingLevel,
324 insideArraySubscript))
325 return false;
326 *(int32 *) (buf->data + right) = chld - pos;
327 }
328 break;
330 {
332
343
346 nestingLevel,
347 insideArraySubscript))
348 return false;
349 *(int32 *) (buf->data + offs) = chld - pos;
350 }
351 break;
353 argNestingLevel++;
354
365 {
367
369 chld = pos;
372 nestingLevel + argNestingLevel,
373 insideArraySubscript))
374 return false;
375 *(int32 *) (buf->data + arg) = chld - pos;
376 }
377 break;
379 break;
381 break;
384 break;
386 if (nestingLevel <= 0)
387 ereturn(escontext, false,
388 (errcode(ERRCODE_SYNTAX_ERROR),
389 errmsg("@ is not allowed in root expressions")));
390 break;
392 if (!insideArraySubscript)
393 ereturn(escontext, false,
394 (errcode(ERRCODE_SYNTAX_ERROR),
395 errmsg("LAST is allowed only in array subscripts")));
396 break;
398 {
400 int offset;
401 int i;
402
404
405 offset = buf->len;
406
408
409 for (i = 0; i < nelems; i++)
410 {
414
417 nestingLevel, true))
418 return false;
419 frompos -= pos;
420
422 {
425 nestingLevel, true))
426 return false;
427 topos -= pos;
428 }
429 else
430 topos = 0;
431
432 ppos = (int32 *) &buf->data[offset + i * 2 * sizeof(int32)];
433
434 ppos[0] = frompos;
435 ppos[1] = topos;
436 }
437 }
438 break;
446 break;
460 break;
461 default:
462 elog(ERROR, "unrecognized jsonpath item type: %d", item->type);
463 }
464
465 if (item->next)
466 {
468 item->next, nestingLevel,
469 insideArraySubscript))
470 return false;
471 chld -= pos;
473 }
474
475 if (result)
476 *result = pos;
477 return true;
478}
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereturn(context, dummy_value,...)
static void alignStringInfoInt(StringInfo buf)
static bool flattenJsonPathParseItem(StringInfo buf, int *result, struct Node *escontext, JsonPathParseItem *item, int nestingLevel, bool insideArraySubscript)
static int32 reserveSpaceForItemPointer(StringInfo buf)
#define CHECK_FOR_INTERRUPTS()
void check_stack_depth(void)
void appendBinaryStringInfo(StringInfo str, const void *data, int datalen)
void appendStringInfoSpaces(StringInfo str, int count)
void appendStringInfoChar(StringInfo str, char ch)
struct JsonPathParseItem::@154::@157 anybounds
JsonPathParseItem * right
struct JsonPathParseItem::@154::@156 array
struct JsonPathParseItem::@154::@158 like_regex
struct JsonPathParseItem::@154::@156::@160 * elems
struct JsonPathParseItem::@154::@155 args
struct JsonPathParseItem::@154::@159 string
union JsonPathParseItem::@154 value
References alignStringInfoInt(), JsonPathParseItem::anybounds, appendBinaryStringInfo(), appendStringInfoChar(), appendStringInfoSpaces(), arg, JsonPathParseItem::arg, JsonPathParseItem::args, JsonPathParseItem::array, JsonPathParseItem::boolean, buf, CHECK_FOR_INTERRUPTS, check_stack_depth(), JsonPathParseItem::elems, elog, ereturn, errcode(), errmsg(), ERROR, JsonPathParseItem::expr, JsonPathParseItem::first, JsonPathParseItem::flags, flattenJsonPathParseItem(), i, jpiAbs, jpiAdd, jpiAnd, jpiAny, jpiAnyArray, jpiAnyKey, jpiBigint, jpiBool, jpiBoolean, jpiCeiling, jpiCurrent, jpiDate, jpiDatetime, jpiDecimal, jpiDiv, jpiDouble, jpiEqual, jpiExists, jpiFilter, jpiFloor, jpiGreater, jpiGreaterOrEqual, jpiIndexArray, jpiInteger, jpiIsUnknown, jpiKey, jpiKeyValue, jpiLast, jpiLess, jpiLessOrEqual, jpiLikeRegex, jpiMinus, jpiMod, jpiMul, jpiNot, jpiNotEqual, jpiNull, jpiNumber, jpiNumeric, jpiOr, jpiPlus, jpiRoot, jpiSize, jpiStartsWith, jpiString, jpiStringFunc, jpiSub, jpiTime, jpiTimestamp, jpiTimestampTz, jpiTimeTz, jpiType, jpiVariable, JSONPATH_HDRSZ, JsonPathParseItem::last, JsonPathParseItem::left, JsonPathParseItem::len, JsonPathParseItem::like_regex, JsonPathParseItem::nelems, next, JsonPathParseItem::next, JsonPathParseItem::numeric, JsonPathParseItem::pattern, JsonPathParseItem::patternlen, reserveSpaceForItemPointer(), JsonPathParseItem::right, JsonPathParseItem::string, JsonPathParseItem::type, JsonPathParseItem::val, JsonPathParseItem::value, and VARSIZE.
Referenced by flattenJsonPathParseItem(), and jsonPathFromCstring().
◆ jsonpath_in()
◆ jsonpath_out()
◆ jsonpath_recv()
Definition at line 115 of file jsonpath.c.
116{
119 char *str;
120 int nbytes;
121
124 else
125 elog(ERROR, "unsupported jsonpath version number: %d", version);
126
128}
#define PG_GETARG_POINTER(n)
unsigned int pq_getmsgint(StringInfo msg, int b)
char * pq_getmsgtext(StringInfo msg, int rawbytes, int *nbytes)
StringInfoData * StringInfo
References buf, elog, ERROR, JSONPATH_VERSION, jsonPathFromCstring(), PG_GETARG_POINTER, pq_getmsgint(), pq_getmsgtext(), and str.
◆ jsonpath_send()
Definition at line 147 of file jsonpath.c.
148{
153
156
161
163}
#define PG_RETURN_BYTEA_P(x)
void pfree(void *pointer)
void pq_sendtext(StringInfo buf, const char *str, int slen)
void pq_begintypsend(StringInfo buf)
bytea * pq_endtypsend(StringInfo buf)
static void pq_sendint8(StringInfo buf, uint8 i)
void initStringInfo(StringInfo str)
References buf, StringInfoData::data, initStringInfo(), JSONPATH_VERSION, jsonPathToCstring(), StringInfoData::len, pfree(), PG_GETARG_JSONPATH_P, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendint8(), pq_sendtext(), and VARSIZE.
◆ jsonPathFromCstring()
static Datum jsonPathFromCstring ( char * in, int len, struct Node * escontext ) | static |
---|
Definition at line 173 of file jsonpath.c.
174{
178
180 return (Datum) 0;
181
182 if (!jsonpath)
184 (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
185 errmsg("invalid input syntax for type %s: \"%s\"", "jsonpath",
186 in)));
187
190
192
194 jsonpath->expr, 0, false))
195 return (Datum) 0;
196
200 if (jsonpath->lax)
202
204}
#define PG_RETURN_JSONPATH_P(p)
JsonPathParseResult * parsejsonpath(const char *str, int len, struct Node *escontext)
#define SOFT_ERROR_OCCURRED(escontext)
void enlargeStringInfo(StringInfo str, int needed)
#define SET_VARSIZE(PTR, len)
References appendStringInfoSpaces(), buf, enlargeStringInfo(), ereturn, errcode(), errmsg(), JsonPathParseResult::expr, flattenJsonPathParseItem(), JsonPath::header, initStringInfo(), JSONPATH_HDRSZ, JSONPATH_LAX, JSONPATH_VERSION, JsonPathParseResult::lax, len, parsejsonpath(), PG_RETURN_JSONPATH_P, SET_VARSIZE, and SOFT_ERROR_OCCURRED.
Referenced by jsonpath_in(), and jsonpath_recv().
◆ jsonPathToCstring()
static char * jsonPathToCstring ( StringInfo out, JsonPath * in, int estimated_len ) | static |
---|
Definition at line 213 of file jsonpath.c.
214{
217
218 if (!out)
219 {
220 out = &buf;
222 }
224
227
230
231 return out->data;
232}
void jspInit(JsonPathItem *v, JsonPath *js)
static void printJsonPathItem(StringInfo buf, JsonPathItem *v, bool inKey, bool printBracketes)
void appendStringInfoString(StringInfo str, const char *s)
References appendStringInfoString(), buf, StringInfoData::data, enlargeStringInfo(), JsonPath::header, initStringInfo(), JSONPATH_LAX, jspInit(), and printJsonPathItem().
Referenced by jsonpath_out(), and jsonpath_send().
◆ jspGetArg()
Definition at line 1081 of file jsonpath.c.
1082{
1094
1096}
Assert(PointerIsAligned(start, uint64))
void jspInitByBuffer(JsonPathItem *v, char *base, int32 pos)
union JsonPathItem::@147 content
References a, JsonPathItem::arg, Assert(), JsonPathItem::base, JsonPathItem::content, jpiDatetime, jpiExists, jpiFilter, jpiIsUnknown, jpiMinus, jpiNot, jpiPlus, jpiTime, jpiTimestamp, jpiTimestampTz, jpiTimeTz, jspInitByBuffer(), and JsonPathItem::type.
Referenced by executeBoolItem(), executeDateTimeMethod(), executeItemOptUnwrapTarget(), executeUnaryArithmExpr(), extract_jsp_bool_expr(), extract_jsp_path_expr_nodes(), jspIsMutableWalker(), and printJsonPathItem().
◆ jspGetArraySubscript()
Definition at line 1238 of file jsonpath.c.
1240{
1242
1244
1246 return false;
1247
1249
1250 return true;
1251}
struct JsonPathItem::@147::@149::@153 * elems
struct JsonPathItem::@147::@149 array
References JsonPathItem::array, Assert(), JsonPathItem::base, JsonPathItem::content, JsonPathItem::elems, i, jpiIndexArray, jspInitByBuffer(), and JsonPathItem::type.
Referenced by executeItemOptUnwrapTarget(), jspIsMutableWalker(), and printJsonPathItem().
◆ jspGetBool()
◆ jspGetLeftArg()
Definition at line 1166 of file jsonpath.c.
1167{
1183
1185}
struct JsonPathItem::@147::@148 args
References a, JsonPathItem::args, Assert(), JsonPathItem::base, JsonPathItem::content, jpiAdd, jpiAnd, jpiDecimal, jpiDiv, jpiEqual, jpiGreater, jpiGreaterOrEqual, jpiLess, jpiLessOrEqual, jpiMod, jpiMul, jpiNotEqual, jpiOr, jpiStartsWith, jpiSub, jspInitByBuffer(), JsonPathItem::left, and JsonPathItem::type.
Referenced by executeBinaryArithmExpr(), executeBoolItem(), executeItemOptUnwrapTarget(), extract_jsp_bool_expr(), jspIsMutableWalker(), and printJsonPathItem().
◆ jspGetNext()
Definition at line 1099 of file jsonpath.c.
1100{
1102 {
1156
1157 if (a)
1159 return true;
1160 }
1161
1162 return false;
1163}
References a, Assert(), JsonPathItem::base, jpiAbs, jpiAdd, jpiAnd, jpiAny, jpiAnyArray, jpiAnyKey, jpiBigint, jpiBool, jpiBoolean, jpiCeiling, jpiCurrent, jpiDate, jpiDatetime, jpiDecimal, jpiDiv, jpiDouble, jpiEqual, jpiExists, jpiFilter, jpiFloor, jpiGreater, jpiGreaterOrEqual, jpiIndexArray, jpiInteger, jpiIsUnknown, jpiKey, jpiKeyValue, jpiLast, jpiLess, jpiLessOrEqual, jpiLikeRegex, jpiMinus, jpiMod, jpiMul, jpiNot, jpiNotEqual, jpiNull, jpiNumber, jpiNumeric, jpiOr, jpiPlus, jpiRoot, jpiSize, jpiStartsWith, jpiString, jpiStringFunc, jpiSub, jpiTime, jpiTimestamp, jpiTimestampTz, jpiTimeTz, jpiType, jpiVariable, jspHasNext, jspInitByBuffer(), JsonPathItem::nextPos, and JsonPathItem::type.
Referenced by appendBoolResult(), executeBinaryArithmExpr(), executeDateTimeMethod(), executeItemOptUnwrapTarget(), executeKeyValueMethod(), executeNextItem(), executeNumericItemMethod(), executeUnaryArithmExpr(), extract_jsp_path_expr_nodes(), jspIsMutableWalker(), and printJsonPathItem().
◆ jspGetNumeric()
◆ jspGetRightArg()
Definition at line 1188 of file jsonpath.c.
References a, JsonPathItem::args, Assert(), JsonPathItem::base, JsonPathItem::content, jpiAdd, jpiAnd, jpiDecimal, jpiDiv, jpiEqual, jpiGreater, jpiGreaterOrEqual, jpiLess, jpiLessOrEqual, jpiMod, jpiMul, jpiNotEqual, jpiOr, jpiStartsWith, jpiSub, jspInitByBuffer(), JsonPathItem::right, and JsonPathItem::type.
Referenced by executeBinaryArithmExpr(), executeBoolItem(), executeItemOptUnwrapTarget(), extract_jsp_bool_expr(), jspIsMutableWalker(), and printJsonPathItem().
◆ jspGetString()
Definition at line 1226 of file jsonpath.c.
1227{
1231
1232 if (len)
1235}
References Assert(), JsonPathItem::content, JsonPathItem::data, JsonPathItem::datalen, jpiKey, jpiString, jpiVariable, len, JsonPathItem::type, and JsonPathItem::value.
Referenced by executeDateTimeMethod(), executeItemOptUnwrapTarget(), getJsonPathItem(), getJsonPathVariable(), jsonb_ops__add_path_item(), jsonb_path_ops__add_path_item(), jspIsMutableWalker(), and printJsonPathItem().
◆ jspInit()
◆ jspInitByBuffer()
Definition at line 990 of file jsonpath.c.
991{
992 v->base = base + pos;
993
995 pos = INTALIGN((uintptr_t) (base + pos)) - (uintptr_t) base;
997
998 switch (v->type)
999 {
1019 break;
1024
1028 break;
1046 break;
1059 break;
1064 break;
1068 break;
1074 break;
1075 default:
1076 elog(ERROR, "unrecognized jsonpath item type: %d", v->type);
1077 }
1078}
#define read_byte(v, b, p)
#define read_int32_n(v, b, p, n)
#define read_int32(v, b, p)
struct JsonPathItem::@147::@150 anybounds
struct JsonPathItem::@147::@152 like_regex
References JsonPathItem::anybounds, JsonPathItem::arg, JsonPathItem::args, JsonPathItem::array, JsonPathItem::base, JsonPathItem::content, JsonPathItem::data, JsonPathItem::datalen, JsonPathItem::elems, elog, ERROR, JsonPathItem::expr, JsonPathItem::first, JsonPathItem::flags, INTALIGN, jpiAbs, jpiAdd, jpiAnd, jpiAny, jpiAnyArray, jpiAnyKey, jpiBigint, jpiBool, jpiBoolean, jpiCeiling, jpiCurrent, jpiDate, jpiDatetime, jpiDecimal, jpiDiv, jpiDouble, jpiEqual, jpiExists, jpiFilter, jpiFloor, jpiGreater, jpiGreaterOrEqual, jpiIndexArray, jpiInteger, jpiIsUnknown, jpiKey, jpiKeyValue, jpiLast, jpiLess, jpiLessOrEqual, jpiLikeRegex, jpiMinus, jpiMod, jpiMul, jpiNot, jpiNotEqual, jpiNull, jpiNumber, jpiNumeric, jpiOr, jpiPlus, jpiRoot, jpiSize, jpiStartsWith, jpiString, jpiStringFunc, jpiSub, jpiTime, jpiTimestamp, jpiTimestampTz, jpiTimeTz, jpiType, jpiVariable, JsonPathItem::last, JsonPathItem::left, JsonPathItem::like_regex, JsonPathItem::nelems, JsonPathItem::nextPos, JsonPathItem::pattern, JsonPathItem::patternlen, read_byte, read_int32, read_int32_n, JsonPathItem::right, JsonPathItem::type, and JsonPathItem::value.
Referenced by executeBoolItem(), jspGetArg(), jspGetArraySubscript(), jspGetLeftArg(), jspGetNext(), jspGetRightArg(), jspInit(), jspIsMutableWalker(), and printJsonPathItem().
◆ jspIsMutable()
Definition at line 1280 of file jsonpath.c.
1281{
1284
1289 cxt.mutable = false;
1290
1293
1294 return cxt.mutable;
1295}
static enum JsonPathDatatypeStatus jspIsMutableWalker(JsonPathItem *jpi, struct JsonPathMutableContext *cxt)
References JsonPathMutableContext::current, JsonPath::header, jpdsNonDateTime, JSONPATH_LAX, jspInit(), jspIsMutableWalker(), JsonPathMutableContext::lax, JsonPathMutableContext::mutable, JsonPathMutableContext::varexprs, and JsonPathMutableContext::varnames.
Referenced by contain_mutable_functions_walker().
◆ jspIsMutableWalker()
Definition at line 1301 of file jsonpath.c.
1302{
1305
1307 {
1311
1312 switch (jpi->type)
1313 {
1316 break;
1317
1321 break;
1322
1324 {
1326
1330
1331 cxt->current = prevStatus;
1332 break;
1333 }
1334
1336 {
1341
1343
1345 {
1348
1350 continue;
1351
1353 {
1354 case DATEOID:
1355 case TIMEOID:
1356 case TIMESTAMPOID:
1358 break;
1359
1360 case TIMETZOID:
1361 case TIMESTAMPTZOID:
1363 break;
1364
1365 default:
1367 break;
1368 }
1369
1370 break;
1371 }
1372 break;
1373 }
1374
1384
1387
1388
1389
1390
1391
1396 leftStatus != rightStatus))
1398 break;
1399
1408 break;
1409
1423 break;
1424
1427 {
1430
1433
1435 }
1436
1437
1439 if (!cxt->lax)
1441 break;
1442
1446 break;
1447
1450 {
1451 char *template;
1452
1455 {
1457 break;
1458 }
1459
1463 else
1465 }
1466 else
1467 {
1469 }
1470 break;
1471
1476 break;
1477
1478
1483 break;
1484
1487
1490
1505 break;
1506
1512 break;
1513
1518 break;
1519
1520 }
1521
1523 break;
1524
1525 jpi = &next;
1526 }
1527
1528 return status;
1529}
bool datetime_format_has_tz(const char *fmt_str)
void jspGetLeftArg(JsonPathItem *v, JsonPathItem *a)
void jspGetArg(JsonPathItem *v, JsonPathItem *a)
char * jspGetString(JsonPathItem *v, int32 *len)
bool jspGetArraySubscript(JsonPathItem *v, JsonPathItem *from, JsonPathItem *to, int i)
bool jspGetNext(JsonPathItem *v, JsonPathItem *a)
void jspGetRightArg(JsonPathItem *v, JsonPathItem *a)
Oid exprType(const Node *expr)
#define lfirst_node(type, lc)
#define forboth(cell1, list1, cell2, list2)
enum JsonPathDatatypeStatus current
References JsonPathItem::anybounds, arg, JsonPathItem::arg, JsonPathItem::array, Assert(), JsonPathItem::base, JsonPathItem::content, JsonPathMutableContext::current, datetime_format_has_tz(), JsonPathItem::expr, exprType(), JsonPathItem::first, forboth, i, jpdsDateTimeNonZoned, jpdsDateTimeZoned, jpdsNonDateTime, jpdsUnknownDateTime, jpiAbs, jpiAdd, jpiAnd, jpiAny, jpiAnyArray, jpiAnyKey, jpiBigint, jpiBool, jpiBoolean, jpiCeiling, jpiCurrent, jpiDate, jpiDatetime, jpiDecimal, jpiDiv, jpiDouble, jpiEqual, jpiExists, jpiFilter, jpiFloor, jpiGreater, jpiGreaterOrEqual, jpiIndexArray, jpiInteger, jpiIsUnknown, jpiKey, jpiKeyValue, jpiLast, jpiLess, jpiLessOrEqual, jpiLikeRegex, jpiMinus, jpiMod, jpiMul, jpiNot, jpiNotEqual, jpiNull, jpiNumber, jpiNumeric, jpiOr, jpiPlus, jpiRoot, jpiSize, jpiStartsWith, jpiString, jpiStringFunc, jpiSub, jpiSubscript, jpiTime, jpiTimestamp, jpiTimestampTz, jpiTimeTz, jpiType, jpiVariable, jspGetArg(), jspGetArraySubscript(), jspGetLeftArg(), jspGetNext(), jspGetRightArg(), jspGetString(), jspInitByBuffer(), jspIsMutableWalker(), JsonPathMutableContext::lax, len, lfirst, lfirst_node, JsonPathItem::like_regex, JsonPathMutableContext::mutable, name, JsonPathItem::nelems, next, String::sval, JsonPathItem::type, JsonPathMutableContext::varexprs, and JsonPathMutableContext::varnames.
Referenced by jspIsMutable(), and jspIsMutableWalker().
◆ jspOperationName()
Definition at line 843 of file jsonpath.c.
844{
845 switch (type)
846 {
848 return "&&";
850 return "||";
852 return "==";
854 return "!=";
856 return "<";
858 return ">";
860 return "<=";
862 return ">=";
865 return "+";
868 return "-";
870 return "*";
872 return "/";
874 return "%";
876 return "type";
878 return "size";
880 return "abs";
882 return "floor";
884 return "ceiling";
886 return "double";
888 return "datetime";
890 return "keyvalue";
892 return "starts with";
894 return "like_regex";
896 return "bigint";
898 return "boolean";
900 return "date";
902 return "decimal";
904 return "integer";
906 return "number";
908 return "string";
910 return "time";
912 return "time_tz";
914 return "timestamp";
916 return "timestamp_tz";
917 default:
918 elog(ERROR, "unrecognized jsonpath item type: %d", type);
919 return NULL;
920 }
921}
References elog, ERROR, jpiAbs, jpiAdd, jpiAnd, jpiBigint, jpiBoolean, jpiCeiling, jpiDate, jpiDatetime, jpiDecimal, jpiDiv, jpiDouble, jpiEqual, jpiFloor, jpiGreater, jpiGreaterOrEqual, jpiInteger, jpiKeyValue, jpiLess, jpiLessOrEqual, jpiLikeRegex, jpiMinus, jpiMod, jpiMul, jpiNotEqual, jpiNumber, jpiOr, jpiPlus, jpiSize, jpiStartsWith, jpiStringFunc, jpiSub, jpiTime, jpiTimestamp, jpiTimestampTz, jpiTimeTz, jpiType, and type.
Referenced by executeBinaryArithmExpr(), executeDateTimeMethod(), executeItemOptUnwrapTarget(), executeKeyValueMethod(), executeNumericItemMethod(), executeUnaryArithmExpr(), and printJsonPathItem().
◆ operationPriority()
Definition at line 924 of file jsonpath.c.
925{
926 switch (op)
927 {
929 return 0;
931 return 1;
939 return 2;
942 return 3;
946 return 4;
949 return 5;
950 default:
951 return 6;
952 }
953}
References jpiAdd, jpiAnd, jpiDiv, jpiEqual, jpiGreater, jpiGreaterOrEqual, jpiLess, jpiLessOrEqual, jpiMinus, jpiMod, jpiMul, jpiNotEqual, jpiOr, jpiPlus, jpiStartsWith, and jpiSub.
Referenced by printJsonPathItem().
◆ printJsonPathItem()
Definition at line 521 of file jsonpath.c.
523{
525 int i;
527 char *str;
528
531
532 switch (v->type)
533 {
536 break;
540 break;
549 break;
553 else
555 break;
570 if (printBracketes)
583 if (printBracketes)
585 break;
591 break;
597 break;
600 if (printBracketes)
607 if (printBracketes)
609 break;
612 break;
614 if (inKey)
617 break;
621 {
625
626 if (i)
628
630
632 {
635 }
636 }
638 break;
640 if (inKey)
642
647 {
650 else
653 }
660 else
664 break;
666 if (inKey)
670 break;
674 break;
678 break;
683 break;
689 break;
695 break;
698 break;
701 break;
704 break;
707 break;
710 break;
713 break;
717 {
720 }
722 break;
725 break;
728 break;
730 if (printBracketes)
732
737
739
743
745 {
747
758
760 }
761
762 if (printBracketes)
764 break;
767 break;
770 break;
773 break;
777 {
780 }
782 {
786 }
788 break;
791 break;
794 break;
797 break;
801 {
804 }
806 break;
810 {
813 }
815 break;
819 {
822 }
824 break;
828 {
831 }
833 break;
834 default:
835 elog(ERROR, "unrecognized jsonpath item type: %d", v->type);
836 }
837
840}
Datum numeric_out(PG_FUNCTION_ARGS)
#define DirectFunctionCall1(func, arg1)
void escape_json_with_len(StringInfo buf, const char *str, int len)
bool jspGetBool(JsonPathItem *v)
Numeric jspGetNumeric(JsonPathItem *v)
const char * jspOperationName(JsonPathItemType type)
static int operationPriority(JsonPathItemType op)
static Datum NumericGetDatum(Numeric X)
static char * DatumGetCString(Datum X)
static struct cvec * range(struct vars *v, chr a, chr b, int cases)
void appendStringInfo(StringInfo str, const char *fmt,...)
References JsonPathItem::anybounds, appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), JsonPathItem::arg, JsonPathItem::args, JsonPathItem::array, Assert(), JsonPathItem::base, buf, CHECK_FOR_INTERRUPTS, check_stack_depth(), JsonPathItem::content, DatumGetCString(), DirectFunctionCall1, elog, ERROR, escape_json_with_len(), JsonPathItem::expr, JsonPathItem::first, JsonPathItem::flags, i, jpiAbs, jpiAdd, jpiAnd, jpiAny, jpiAnyArray, jpiAnyKey, jpiBigint, jpiBool, jpiBoolean, jpiCeiling, jpiCurrent, jpiDate, jpiDatetime, jpiDecimal, jpiDiv, jpiDouble, jpiEqual, jpiExists, jpiFilter, jpiFloor, jpiGreater, jpiGreaterOrEqual, jpiIndexArray, jpiInteger, jpiIsUnknown, jpiKey, jpiKeyValue, jpiLast, jpiLess, jpiLessOrEqual, jpiLikeRegex, jpiMinus, jpiMod, jpiMul, jpiNot, jpiNotEqual, jpiNull, jpiNumber, jpiNumeric, jpiOr, jpiPlus, jpiRoot, jpiSize, jpiStartsWith, jpiString, jpiStringFunc, jpiSub, jpiTime, jpiTimestamp, jpiTimestampTz, jpiTimeTz, jpiType, jpiVariable, JSP_REGEX_DOTALL, JSP_REGEX_ICASE, JSP_REGEX_MLINE, JSP_REGEX_QUOTE, JSP_REGEX_WSPACE, jspGetArg(), jspGetArraySubscript(), jspGetBool(), jspGetLeftArg(), jspGetNext(), jspGetNumeric(), jspGetRightArg(), jspGetString(), jspHasNext, jspInitByBuffer(), jspOperationName(), JsonPathItem::last, JsonPathItem::left, len, JsonPathItem::like_regex, JsonPathItem::nelems, numeric_out(), NumericGetDatum(), operationPriority(), JsonPathItem::pattern, JsonPathItem::patternlen, PG_UINT32_MAX, printJsonPathItem(), range(), JsonPathItem::right, str, and JsonPathItem::type.
Referenced by jsonPathToCstring(), and printJsonPathItem().