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 964 of file jsonpath.c.
Enumerator | |
---|---|
jpdsNonDateTime | |
jpdsUnknownDateTime | |
jpdsDateTimeZoned | |
jpdsDateTimeNonZoned |
Definition at line 1247 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(), elog, ereturn, errcode(), errmsg(), ERROR, 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::like_regex, next, JsonPathParseItem::next, JsonPathParseItem::numeric, reserveSpaceForItemPointer(), JsonPathParseItem::string, JsonPathParseItem::type, JsonPathParseItem::value, and VARSIZE.
Referenced by 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(), initStringInfo(), JSONPATH_HDRSZ, JSONPATH_LAX, JSONPATH_VERSION, JsonPathParseResult::lax, len, parsejsonpath(), PG_RETURN_JSONPATH_P, res, 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 1074 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(), and printJsonPathItem().
bool jspGetArraySubscript | ( | JsonPathItem * | v, |
JsonPathItem * | from, | ||
JsonPathItem * | to, | ||
int | i | ||
) |
Definition at line 1231 of file jsonpath.c.
References JsonPathItem::array, Assert, JsonPathItem::base, JsonPathItem::content, i, jpiIndexArray, jspInitByBuffer(), and JsonPathItem::type.
Referenced by executeItemOptUnwrapTarget(), and printJsonPathItem().
bool jspGetBool | ( | JsonPathItem * | v | ) |
Definition at line 1203 of file jsonpath.c.
References Assert, JsonPathItem::content, jpiBool, JsonPathItem::type, and JsonPathItem::value.
Referenced by getJsonPathItem(), and printJsonPathItem().
void jspGetLeftArg | ( | JsonPathItem * | v, |
JsonPathItem * | a | ||
) |
Definition at line 1159 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(), and JsonPathItem::type.
Referenced by executeBinaryArithmExpr(), executeBoolItem(), executeItemOptUnwrapTarget(), extract_jsp_bool_expr(), and printJsonPathItem().
bool jspGetNext | ( | JsonPathItem * | v, |
JsonPathItem * | a | ||
) |
Definition at line 1092 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(), and printJsonPathItem().
Numeric jspGetNumeric | ( | JsonPathItem * | v | ) |
Definition at line 1211 of file jsonpath.c.
References Assert, JsonPathItem::content, jpiNumeric, JsonPathItem::type, and JsonPathItem::value.
Referenced by executeDateTimeMethod(), executeItemOptUnwrapTarget(), getJsonPathItem(), and printJsonPathItem().
void jspGetRightArg | ( | JsonPathItem * | v, |
JsonPathItem * | a | ||
) |
Definition at line 1181 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(), and JsonPathItem::type.
Referenced by executeBinaryArithmExpr(), executeBoolItem(), executeItemOptUnwrapTarget(), extract_jsp_bool_expr(), and printJsonPathItem().
char* jspGetString | ( | JsonPathItem * | v, |
int32 * | len | ||
) |
Definition at line 1219 of file jsonpath.c.
References Assert, JsonPathItem::content, 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(), and printJsonPathItem().
void jspInit | ( | JsonPathItem * | v, |
JsonPath * | js | ||
) |
Definition at line 973 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 983 of file jsonpath.c.
References JsonPathItem::anybounds, JsonPathItem::arg, JsonPathItem::args, JsonPathItem::array, JsonPathItem::base, JsonPathItem::content, elog, ERROR, 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::like_regex, JsonPathItem::nextPos, read_byte, read_int32, read_int32_n, JsonPathItem::type, and JsonPathItem::value.
Referenced by executeBoolItem(), jspGetArg(), jspGetArraySubscript(), jspGetLeftArg(), jspGetNext(), jspGetRightArg(), jspInit(), and printJsonPathItem().
Definition at line 1273 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 1273 of file jsonpath.c.
Referenced by jspIsMutable().
const char* jspOperationName | ( | JsonPathItemType | type | ) |
Definition at line 836 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 917 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(), 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::like_regex, numeric_out(), NumericGetDatum(), operationPriority(), PG_UINT32_MAX, range(), and JsonPathItem::type.
Referenced by jsonPathToCstring().
|
static |
Definition at line 507 of file jsonpath.c.
References appendBinaryStringInfo(), and buf.
Referenced by flattenJsonPathParseItem().