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 } |
#define read_byte | ( | v, | |
b, | |||
p | |||
) |
#define read_int32 | ( | v, | |
b, | |||
p | |||
) |
#define read_int32_n | ( | v, | |
b, | |||
p, | |||
n | |||
) |
Definition at line 971 of file jsonpath.c.
Enumerator | |
---|---|
jpdsNonDateTime | |
jpdsUnknownDateTime | |
jpdsDateTimeZoned | |
jpdsDateTimeNonZoned |
Definition at line 1254 of file jsonpath.c.
|
static |
Definition at line 484 of file jsonpath.c.
References appendStringInfoCharMacro, buf, and INTALIGN.
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, 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().
Datum jsonpath_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 98 of file jsonpath.c.
References jsonPathFromCstring(), len, and PG_GETARG_CSTRING.
Referenced by makeJsonTablePathScan().
Datum jsonpath_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 134 of file jsonpath.c.
References 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, 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, 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.
Definition at line 173 of file jsonpath.c.
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().
|
static |
Definition at line 213 of file jsonpath.c.
References appendStringInfoString(), buf, StringInfoData::data, enlargeStringInfo(), JsonPath::header, initStringInfo(), JSONPATH_LAX, jspInit(), and printJsonPathItem().
Referenced by jsonpath_out(), and jsonpath_send().
void jspGetArg | ( | JsonPathItem * | v, |
JsonPathItem * | a | ||
) |
Definition at line 1081 of file jsonpath.c.
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().
bool jspGetArraySubscript | ( | JsonPathItem * | v, |
JsonPathItem * | from, | ||
JsonPathItem * | to, | ||
int | i | ||
) |
Definition at line 1238 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 1210 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 1166 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::left, and JsonPathItem::type.
Referenced by executeBinaryArithmExpr(), executeBoolItem(), executeItemOptUnwrapTarget(), extract_jsp_bool_expr(), jspIsMutableWalker(), and printJsonPathItem().
bool jspGetNext | ( | JsonPathItem * | v, |
JsonPathItem * | a | ||
) |
Definition at line 1099 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, 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().
Numeric jspGetNumeric | ( | JsonPathItem * | v | ) |
Definition at line 1218 of file jsonpath.c.
References Assert(), JsonPathItem::content, JsonPathItem::data, jpiNumeric, JsonPathItem::type, and JsonPathItem::value.
Referenced by executeDateTimeMethod(), executeItemOptUnwrapTarget(), getJsonPathItem(), and printJsonPathItem().
void jspGetRightArg | ( | JsonPathItem * | v, |
JsonPathItem * | a | ||
) |
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().
char * jspGetString | ( | JsonPathItem * | v, |
int32 * | len | ||
) |
Definition at line 1226 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(), 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 980 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 990 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, 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().
Definition at line 1280 of file jsonpath.c.
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().
|
static |
Definition at line 1301 of file jsonpath.c.
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().
const char * jspOperationName | ( | JsonPathItemType | type | ) |
Definition at line 843 of file jsonpath.c.
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().
|
static |
Definition at line 924 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 521 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, 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().
|
static |
Definition at line 507 of file jsonpath.c.
References appendBinaryStringInfo(), and buf.
Referenced by flattenJsonPathParseItem().