|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "catalog/pg_type.h"#include "lib/stringinfo.h"#include "libpq/pqformat.h"#include "miscadmin.h"#include "nodes/miscnodes.h"#include "nodes/nodeFuncs.h"#include "utils/fmgrprotos.h"#include "utils/formatting.h"#include "utils/json.h"#include "utils/jsonpath.h"
Go to the source code of this file.
Data Structures | |
| struct | JsonPathMutableContext |
Macros | |
| #define | read_byte(v, b, p) |
| #define | read_int32(v, b, p) |
| #define | read_int32_n(v, b, p, n) |
Enumerations | |
| enum | JsonPathDatatypeStatus { jpdsNonDateTime , jpdsUnknownDateTime , jpdsDateTimeZoned , jpdsDateTimeNonZoned } |
| Enumerator | |
|---|---|
| jpdsNonDateTime | |
| jpdsUnknownDateTime | |
| jpdsDateTimeZoned | |
| jpdsDateTimeNonZoned | |
Definition at line 1355 of file jsonpath.c.
|
static |
Definition at line 492 of file jsonpath.c.
References appendStringInfoCharMacro, buf, INTALIGN, and pg_fallthrough.
Referenced by flattenJsonPathParseItem().
|
static |
Definition at line 239 of file jsonpath.c.
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, fb(), 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, jpiStrBtrim, jpiString, jpiStringFunc, jpiStrInitcap, jpiStrLower, jpiStrLtrim, jpiStrReplace, jpiStrRtrim, jpiStrSplitPart, jpiStrUpper, 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, pg_fallthrough, reserveSpaceForItemPointer(), result, JsonPathParseItem::right, JsonPathParseItem::string, JsonPathParseItem::type, JsonPathParseItem::val, JsonPathParseItem::value, and VARSIZE().
Referenced by flattenJsonPathParseItem(), and jsonPathFromCstring().
| Datum jsonpath_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 98 of file jsonpath.c.
References fb(), jsonPathFromCstring(), len, and PG_GETARG_CSTRING.
Referenced by makeJsonTablePathScan().
| Datum jsonpath_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 134 of file jsonpath.c.
References fb(), jsonPathToCstring(), PG_GETARG_JSONPATH_P, PG_RETURN_CSTRING, and VARSIZE().
| Datum jsonpath_recv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 115 of file jsonpath.c.
References buf, elog, ERROR, fb(), JSONPATH_VERSION, jsonPathFromCstring(), PG_GETARG_POINTER, pq_getmsgint(), pq_getmsgtext(), and str.
| Datum jsonpath_send | ( | PG_FUNCTION_ARGS | ) |
Definition at line 147 of file jsonpath.c.
References buf, fb(), initStringInfo(), JSONPATH_VERSION, jsonPathToCstring(), pfree(), PG_GETARG_JSONPATH_P, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendint8(), pq_sendtext(), and VARSIZE().
Definition at line 173 of file jsonpath.c.
References appendStringInfoSpaces(), buf, JsonPath::data, enlargeStringInfo(), ereturn, errcode(), errmsg, fb(), flattenJsonPathParseItem(), JsonPath::header, initStringInfo(), JSONPATH_HDRSZ, JSONPATH_LAX, JSONPATH_VERSION, len, parsejsonpath(), PG_RETURN_JSONPATH_P, SET_VARSIZE(), and SOFT_ERROR_OCCURRED.
Referenced by jsonpath_in(), and jsonpath_recv().
|
static |
Definition at line 213 of file jsonpath.c.
References appendStringInfoString(), buf, StringInfoData::data, enlargeStringInfo(), fb(), JsonPath::header, initStringInfo(), JSONPATH_LAX, jspInit(), and printJsonPathItem().
Referenced by jsonpath_out(), and jsonpath_send().
| void jspGetArg | ( | JsonPathItem * | v, |
| JsonPathItem * | a | ||
| ) |
Definition at line 1167 of file jsonpath.c.
References a, JsonPathItem::arg, Assert, JsonPathItem::base, JsonPathItem::content, jpiDatetime, jpiExists, jpiFilter, jpiIsUnknown, jpiMinus, jpiNot, jpiPlus, jpiStrBtrim, jpiStrLtrim, jpiStrRtrim, jpiTime, jpiTimestamp, jpiTimestampTz, jpiTimeTz, jspInitByBuffer(), and JsonPathItem::type.
Referenced by executeBoolItem(), executeDateTimeMethod(), executeItemOptUnwrapTarget(), executeStringInternalMethod(), executeUnaryArithmExpr(), extract_jsp_bool_expr(), extract_jsp_path_expr_nodes(), jspIsMutableWalker(), and printJsonPathItem().
| bool jspGetArraySubscript | ( | JsonPathItem * | v, |
| JsonPathItem * | from, | ||
| JsonPathItem * | to, | ||
| int | i | ||
| ) |
Definition at line 1339 of file jsonpath.c.
References JsonPathItem::array, Assert, JsonPathItem::base, JsonPathItem::content, JsonPathItem::elems, i, jpiIndexArray, jspInitByBuffer(), and JsonPathItem::type.
Referenced by executeItemOptUnwrapTarget(), jspIsMutableWalker(), and printJsonPathItem().
| bool jspGetBool | ( | JsonPathItem * | v | ) |
Definition at line 1311 of file jsonpath.c.
References Assert, JsonPathItem::content, JsonPathItem::data, jpiBool, JsonPathItem::type, and JsonPathItem::value.
Referenced by getJsonPathItem(), and printJsonPathItem().
| void jspGetLeftArg | ( | JsonPathItem * | v, |
| JsonPathItem * | a | ||
| ) |
Definition at line 1263 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, jpiStrReplace, jpiStrSplitPart, jpiSub, jspInitByBuffer(), JsonPathItem::left, and JsonPathItem::type.
Referenced by executeBinaryArithmExpr(), executeBoolItem(), executeItemOptUnwrapTarget(), executeStringInternalMethod(), extract_jsp_bool_expr(), jspIsMutableWalker(), and printJsonPathItem().
| bool jspGetNext | ( | JsonPathItem * | v, |
| JsonPathItem * | a | ||
| ) |
Definition at line 1188 of file jsonpath.c.
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, jpiStrBtrim, jpiString, jpiStringFunc, jpiStrInitcap, jpiStrLower, jpiStrLtrim, jpiStrReplace, jpiStrRtrim, jpiStrSplitPart, jpiStrUpper, jpiSub, jpiTime, jpiTimestamp, jpiTimestampTz, jpiTimeTz, jpiType, jpiVariable, jspHasNext, jspInitByBuffer(), JsonPathItem::nextPos, and JsonPathItem::type.
Referenced by appendBoolResult(), executeBinaryArithmExpr(), executeDateTimeMethod(), executeItemOptUnwrapTarget(), executeKeyValueMethod(), executeNextItem(), executeNumericItemMethod(), executeStringInternalMethod(), executeUnaryArithmExpr(), extract_jsp_path_expr_nodes(), jspIsMutableWalker(), and printJsonPathItem().
| Numeric jspGetNumeric | ( | JsonPathItem * | v | ) |
Definition at line 1319 of file jsonpath.c.
References Assert, JsonPathItem::content, JsonPathItem::data, jpiNumeric, JsonPathItem::type, and JsonPathItem::value.
Referenced by executeDateTimeMethod(), executeItemOptUnwrapTarget(), executeStringInternalMethod(), getJsonPathItem(), and printJsonPathItem().
| void jspGetRightArg | ( | JsonPathItem * | v, |
| JsonPathItem * | a | ||
| ) |
Definition at line 1287 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, jpiStrReplace, jpiStrSplitPart, jpiSub, jspInitByBuffer(), JsonPathItem::right, and JsonPathItem::type.
Referenced by executeBinaryArithmExpr(), executeBoolItem(), executeItemOptUnwrapTarget(), executeStringInternalMethod(), extract_jsp_bool_expr(), jspIsMutableWalker(), and printJsonPathItem().
| char * jspGetString | ( | JsonPathItem * | v, |
| int32 * | len | ||
| ) |
Definition at line 1327 of file jsonpath.c.
References Assert, JsonPathItem::content, JsonPathItem::data, JsonPathItem::datalen, jpiKey, jpiString, jpiVariable, len, JsonPathItem::type, and JsonPathItem::value.
Referenced by executeDateTimeMethod(), executeItemOptUnwrapTarget(), executeStringInternalMethod(), getJsonPathItem(), getJsonPathVariable(), jsonb_ops__add_path_item(), jsonb_path_ops__add_path_item(), jspIsMutableWalker(), and printJsonPathItem().
| void jspInit | ( | JsonPathItem * | v, |
| JsonPath * | js | ||
| ) |
Definition at line 1058 of file jsonpath.c.
References Assert, JsonPath::data, JsonPath::header, JSONPATH_LAX, JSONPATH_VERSION, and jspInitByBuffer().
Referenced by executeJsonPath(), extract_jsp_query(), jsonPathToCstring(), and jspIsMutable().
| void jspInitByBuffer | ( | JsonPathItem * | v, |
| char * | base, | ||
| int32 | pos | ||
| ) |
Definition at line 1068 of file jsonpath.c.
References JsonPathItem::anybounds, JsonPathItem::arg, JsonPathItem::args, JsonPathItem::array, JsonPathItem::base, JsonPathItem::content, JsonPathItem::data, JsonPathItem::datalen, JsonPathItem::elems, elog, ERROR, JsonPathItem::expr, fb(), 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, jpiStrBtrim, jpiString, jpiStringFunc, jpiStrInitcap, jpiStrLower, jpiStrLtrim, jpiStrReplace, jpiStrRtrim, jpiStrSplitPart, jpiStrUpper, jpiSub, jpiTime, jpiTimestamp, jpiTimestampTz, jpiTimeTz, jpiType, jpiVariable, JsonPathItem::last, JsonPathItem::left, JsonPathItem::like_regex, JsonPathItem::nelems, JsonPathItem::nextPos, JsonPathItem::pattern, JsonPathItem::patternlen, pg_fallthrough, 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().
Definition at line 1381 of file jsonpath.c.
References JsonPathMutableContext::current, fb(), JsonPath::header, jpdsNonDateTime, JSONPATH_LAX, jspInit(), jspIsMutableWalker(), JsonPathMutableContext::lax, JsonPathMutableContext::mutable, JsonPathMutableContext::varexprs, and JsonPathMutableContext::varnames.
Referenced by contain_mutable_functions_walker().
|
static |
Definition at line 1402 of file jsonpath.c.
References arg, Assert, JsonPathMutableContext::current, datetime_format_has_tz(), exprType(), fb(), 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, jpiStrBtrim, jpiString, jpiStringFunc, jpiStrInitcap, jpiStrLower, jpiStrLtrim, jpiStrReplace, jpiStrRtrim, jpiStrSplitPart, jpiStrUpper, jpiSub, jpiSubscript, jpiTime, jpiTimestamp, jpiTimestampTz, jpiTimeTz, jpiType, jpiVariable, jspGetArg(), jspGetArraySubscript(), jspGetLeftArg(), jspGetNext(), jspGetRightArg(), jspGetString(), jspInitByBuffer(), jspIsMutableWalker(), JsonPathMutableContext::lax, len, lfirst, lfirst_node, JsonPathMutableContext::mutable, name, next, pg_fallthrough, String::sval, JsonPathMutableContext::varexprs, and JsonPathMutableContext::varnames.
Referenced by jspIsMutable(), and jspIsMutableWalker().
| const char * jspOperationName | ( | JsonPathItemType | type | ) |
Definition at line 905 of file jsonpath.c.
References elog, ERROR, fb(), 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, jpiStrBtrim, jpiStringFunc, jpiStrInitcap, jpiStrLower, jpiStrLtrim, jpiStrReplace, jpiStrRtrim, jpiStrSplitPart, jpiStrUpper, jpiSub, jpiTime, jpiTimestamp, jpiTimestampTz, jpiTimeTz, jpiType, and type.
Referenced by executeBinaryArithmExpr(), executeDateTimeMethod(), executeItemOptUnwrapTarget(), executeKeyValueMethod(), executeNumericItemMethod(), executeStringInternalMethod(), executeUnaryArithmExpr(), and printJsonPathItem().
|
static |
Definition at line 1002 of file jsonpath.c.
References jpiAdd, jpiAnd, jpiDiv, jpiEqual, jpiGreater, jpiGreaterOrEqual, jpiLess, jpiLessOrEqual, jpiMinus, jpiMod, jpiMul, jpiNotEqual, jpiOr, jpiPlus, jpiStartsWith, and jpiSub.
Referenced by printJsonPathItem().
|
static |
Definition at line 529 of file jsonpath.c.
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, fb(), 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, jpiStrBtrim, jpiString, jpiStringFunc, jpiStrInitcap, jpiStrLower, jpiStrLtrim, jpiStrReplace, jpiStrRtrim, jpiStrSplitPart, jpiStrUpper, 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().
|
static |
Definition at line 515 of file jsonpath.c.
References appendBinaryStringInfo(), and buf.
Referenced by flattenJsonPathParseItem().