PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "funcapi.h"
#include "lib/stringinfo.h"
#include "libpq/pqformat.h"
#include "miscadmin.h"
#include "nodes/nodeFuncs.h"
#include "utils/builtins.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) |
Typedefs | |
typedef enum JsonPathDatatypeStatus | JsonPathDatatypeStatus |
typedef struct JsonPathMutableContext | JsonPathMutableContext |
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 830 of file jsonpath.c.
typedef enum JsonPathDatatypeStatus JsonPathDatatypeStatus |
typedef struct JsonPathMutableContext JsonPathMutableContext |
Enumerator | |
---|---|
jpdsNonDateTime | |
jpdsUnknownDateTime | |
jpdsDateTimeZoned | |
jpdsDateTimeNonZoned |
Definition at line 1084 of file jsonpath.c.
|
static |
Definition at line 441 of file jsonpath.c.
References appendStringInfoCharMacro, buf, and INTALIGN.
Referenced by flattenJsonPathParseItem().
|
static |
Definition at line 231 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, ereport, errcode(), errmsg(), ERROR, i, jpiAbs, jpiAdd, jpiAnd, jpiAny, jpiAnyArray, jpiAnyKey, jpiBool, jpiCeiling, jpiCurrent, jpiDatetime, jpiDiv, jpiDouble, jpiEqual, jpiExists, jpiFilter, jpiFloor, jpiGreater, jpiGreaterOrEqual, jpiIndexArray, jpiIsUnknown, jpiKey, jpiKeyValue, jpiLast, jpiLess, jpiLessOrEqual, jpiLikeRegex, jpiMinus, jpiMod, jpiMul, jpiNot, jpiNotEqual, jpiNull, jpiNumeric, jpiOr, jpiPlus, jpiRoot, jpiSize, jpiStartsWith, jpiString, jpiSub, 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 95 of file jsonpath.c.
References jsonPathFromCstring(), len, and PG_GETARG_CSTRING.
Referenced by makeParentJsonTableNode().
Datum jsonpath_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 131 of file jsonpath.c.
References jsonPathToCstring(), PG_GETARG_JSONPATH_P, PG_RETURN_CSTRING, and VARSIZE.
Datum jsonpath_recv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 112 of file jsonpath.c.
References buf, elog, ERROR, JSONPATH_VERSION, jsonPathFromCstring(), PG_GETARG_POINTER, pq_getmsgint(), pq_getmsgtext(), and generate_unaccent_rules::str.
Datum jsonpath_send | ( | PG_FUNCTION_ARGS | ) |
Definition at line 144 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.
|
static |
Definition at line 170 of file jsonpath.c.
References appendStringInfoSpaces(), buf, enlargeStringInfo(), ereport, errcode(), errmsg(), ERROR, JsonPathParseResult::expr, flattenJsonPathParseItem(), initStringInfo(), JSONPATH_HDRSZ, JSONPATH_LAX, JSONPATH_VERSION, JsonPathParseResult::lax, len, parsejsonpath(), PG_RETURN_JSONPATH_P, res, and SET_VARSIZE.
Referenced by jsonpath_in(), and jsonpath_recv().
|
static |
Definition at line 205 of file jsonpath.c.
References appendBinaryStringInfo(), 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 929 of file jsonpath.c.
References a, JsonPathItem::arg, Assert(), JsonPathItem::base, JsonPathItem::content, jpiDatetime, jpiExists, jpiFilter, jpiIsUnknown, jpiMinus, jpiNot, jpiPlus, 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 1068 of file jsonpath.c.
References JsonPathItem::array, Assert(), JsonPathItem::base, JsonPathItem::content, i, jpiIndexArray, jspInitByBuffer(), and JsonPathItem::type.
Referenced by executeItemOptUnwrapTarget(), jspIsMutableWalker(), and printJsonPathItem().
bool jspGetBool | ( | JsonPathItem * | v | ) |
Definition at line 1040 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 998 of file jsonpath.c.
References a, JsonPathItem::args, Assert(), JsonPathItem::base, JsonPathItem::content, jpiAdd, jpiAnd, jpiDiv, jpiEqual, jpiGreater, jpiGreaterOrEqual, jpiLess, jpiLessOrEqual, jpiMod, jpiMul, jpiNotEqual, jpiOr, jpiStartsWith, jpiSub, jspInitByBuffer(), and JsonPathItem::type.
Referenced by executeBinaryArithmExpr(), executeBoolItem(), extract_jsp_bool_expr(), jspIsMutableWalker(), and printJsonPathItem().
bool jspGetNext | ( | JsonPathItem * | v, |
JsonPathItem * | a | ||
) |
Definition at line 943 of file jsonpath.c.
References a, Assert(), JsonPathItem::base, jpiAbs, jpiAdd, jpiAnd, jpiAny, jpiAnyArray, jpiAnyKey, jpiBool, jpiCeiling, jpiCurrent, jpiDatetime, jpiDiv, jpiDouble, jpiEqual, jpiExists, jpiFilter, jpiFloor, jpiGreater, jpiGreaterOrEqual, jpiIndexArray, jpiIsUnknown, jpiKey, jpiKeyValue, jpiLast, jpiLess, jpiLessOrEqual, jpiMinus, jpiMod, jpiMul, jpiNot, jpiNotEqual, jpiNull, jpiNumeric, jpiOr, jpiPlus, jpiRoot, jpiSize, jpiStartsWith, jpiString, jpiSub, 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 1048 of file jsonpath.c.
References Assert(), JsonPathItem::content, jpiNumeric, JsonPathItem::type, and JsonPathItem::value.
Referenced by getJsonPathItem(), and printJsonPathItem().
void jspGetRightArg | ( | JsonPathItem * | v, |
JsonPathItem * | a | ||
) |
Definition at line 1019 of file jsonpath.c.
References a, JsonPathItem::args, Assert(), JsonPathItem::base, JsonPathItem::content, jpiAdd, jpiAnd, jpiDiv, jpiEqual, jpiGreater, jpiGreaterOrEqual, jpiLess, jpiLessOrEqual, jpiMod, jpiMul, jpiNotEqual, jpiOr, jpiStartsWith, jpiSub, jspInitByBuffer(), and JsonPathItem::type.
Referenced by executeBinaryArithmExpr(), executeBoolItem(), extract_jsp_bool_expr(), jspIsMutableWalker(), and printJsonPathItem().
char* jspGetString | ( | JsonPathItem * | v, |
int32 * | len | ||
) |
Definition at line 1056 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(), jspIsMutableWalker(), and printJsonPathItem().
void jspInit | ( | JsonPathItem * | v, |
JsonPath * | js | ||
) |
Definition at line 839 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 849 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, jpiBool, jpiCeiling, jpiCurrent, jpiDatetime, jpiDiv, jpiDouble, jpiEqual, jpiExists, jpiFilter, jpiFloor, jpiGreater, jpiGreaterOrEqual, jpiIndexArray, jpiIsUnknown, jpiKey, jpiKeyValue, jpiLast, jpiLess, jpiLessOrEqual, jpiLikeRegex, jpiMinus, jpiMod, jpiMul, jpiNot, jpiNotEqual, jpiNull, jpiNumeric, jpiOr, jpiPlus, jpiRoot, jpiSize, jpiStartsWith, jpiString, jpiSub, 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(), jspIsMutableWalker(), and printJsonPathItem().
Definition at line 1321 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 1106 of file jsonpath.c.
References JsonPathItem::anybounds, arg, JsonPathItem::arg, JsonPathItem::array, Assert(), JsonPathItem::base, JsonPathItem::content, JsonPathMutableContext::current, datetime_format_flags(), DCH_ZONED, exprType(), forboth, i, jpdsDateTimeNonZoned, jpdsDateTimeZoned, jpdsNonDateTime, jpdsUnknownDateTime, jpiAbs, jpiAdd, jpiAnd, jpiAny, jpiAnyArray, jpiAnyKey, jpiBool, jpiCeiling, jpiCurrent, jpiDatetime, jpiDiv, jpiDouble, jpiEqual, jpiExists, jpiFilter, jpiFloor, jpiGreater, jpiGreaterOrEqual, jpiIndexArray, jpiIsUnknown, jpiKey, jpiKeyValue, jpiLast, jpiLess, jpiLessOrEqual, jpiLikeRegex, jpiMinus, jpiMod, jpiMul, jpiNot, jpiNotEqual, jpiNull, jpiNumeric, jpiOr, jpiPlus, jpiRoot, jpiSize, jpiStartsWith, jpiString, jpiSub, jpiSubscript, jpiType, jpiVariable, jspGetArg(), jspGetArraySubscript(), jspGetLeftArg(), jspGetNext(), jspGetRightArg(), jspGetString(), jspInitByBuffer(), JsonPathMutableContext::lax, len, lfirst, lfirst_node, JsonPathItem::like_regex, JsonPathMutableContext::mutable, name, next, status(), String::sval, JsonPathItem::type, JsonPathMutableContext::varexprs, and JsonPathMutableContext::varnames.
Referenced by jspIsMutable().
const char* jspOperationName | ( | JsonPathItemType | type | ) |
Definition at line 724 of file jsonpath.c.
References elog, ERROR, jpiAbs, jpiAdd, jpiAnd, jpiCeiling, jpiDatetime, jpiDiv, jpiDouble, jpiEqual, jpiFloor, jpiGreater, jpiGreaterOrEqual, jpiKeyValue, jpiLess, jpiLessOrEqual, jpiLikeRegex, jpiMinus, jpiMod, jpiMul, jpiNotEqual, jpiOr, jpiPlus, jpiSize, jpiStartsWith, jpiSub, jpiType, and generate_unaccent_rules::type.
Referenced by executeBinaryArithmExpr(), executeDateTimeMethod(), executeItemOptUnwrapTarget(), executeKeyValueMethod(), executeNumericItemMethod(), executeUnaryArithmExpr(), and printJsonPathItem().
|
static |
Definition at line 783 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 478 of file jsonpath.c.
References JsonPathItem::anybounds, appendBinaryStringInfo(), appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), JsonPathItem::arg, 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, jpiBool, jpiCeiling, jpiCurrent, jpiDatetime, jpiDiv, jpiDouble, jpiEqual, jpiExists, jpiFilter, jpiFloor, jpiGreater, jpiGreaterOrEqual, jpiIndexArray, jpiIsUnknown, jpiKey, jpiKeyValue, jpiLast, jpiLess, jpiLessOrEqual, jpiLikeRegex, jpiMinus, jpiMod, jpiMul, jpiNot, jpiNotEqual, jpiNull, jpiNumeric, jpiOr, jpiPlus, jpiRoot, jpiSize, jpiStartsWith, jpiString, jpiSub, 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 464 of file jsonpath.c.
References appendBinaryStringInfo(), and buf.
Referenced by flattenJsonPathParseItem().