72#include "utils/fmgrprotos.h"
82 struct Node *escontext,
125 elog(
ERROR,
"unsupported jsonpath version number: %d", version);
185 errmsg(
"invalid input syntax for type %s: \"%s\"",
"jsonpath",
386 if (nestingLevel <= 0)
389 errmsg(
"@ is not allowed in root expressions")));
395 errmsg(
"LAST is allowed only in array subscripts")));
409 for (
i = 0;
i < nelems;
i++)
462 elog(
ERROR,
"unrecognized jsonpath item type: %d", item->
type);
468 item->
next, nestingLevel,
892 return "starts with";
916 return "timestamp_tz";
961#define read_byte(v, b, p) do { \
962 (v) = *(uint8*)((b) + (p)); \
966#define read_int32(v, b, p) do { \
967 (v) = *(uint32*)((b) + (p)); \
968 (p) += sizeof(int32); \
971#define read_int32_n(v, b, p, n) do { \
972 (v) = (void *)((b) + (p)); \
973 (p) += sizeof(int32) * (n); \
992 v->
base = base + pos;
1076 elog(
ERROR,
"unrecognized jsonpath item type: %d", v->
type);
1426 for (
int i = 0;
i <
jpi->content.array.nelems;
i++)
1444 if (
jpi->content.anybounds.first > 0)
1449 if (
jpi->content.arg)
Datum numeric_out(PG_FUNCTION_ARGS)
#define Assert(condition)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereturn(context, dummy_value,...)
#define PG_RETURN_BYTEA_P(x)
#define PG_GETARG_POINTER(n)
#define PG_RETURN_CSTRING(x)
#define DirectFunctionCall1(func, arg1)
#define PG_GETARG_CSTRING(n)
void escape_json_with_len(StringInfo buf, const char *str, int len)
bool jspIsMutable(JsonPath *path, List *varnames, List *varexprs)
static enum JsonPathDatatypeStatus jspIsMutableWalker(JsonPathItem *jpi, struct JsonPathMutableContext *cxt)
void jspGetLeftArg(JsonPathItem *v, JsonPathItem *a)
void jspGetArg(JsonPathItem *v, JsonPathItem *a)
static Datum jsonPathFromCstring(char *in, int len, struct Node *escontext)
Datum jsonpath_send(PG_FUNCTION_ARGS)
#define read_byte(v, b, p)
#define read_int32_n(v, b, p, n)
Datum jsonpath_out(PG_FUNCTION_ARGS)
static void alignStringInfoInt(StringInfo buf)
void jspInitByBuffer(JsonPathItem *v, char *base, int32 pos)
bool jspGetBool(JsonPathItem *v)
void jspInit(JsonPathItem *v, JsonPath *js)
static bool flattenJsonPathParseItem(StringInfo buf, int *result, struct Node *escontext, JsonPathParseItem *item, int nestingLevel, bool insideArraySubscript)
char * jspGetString(JsonPathItem *v, int32 *len)
Numeric jspGetNumeric(JsonPathItem *v)
bool jspGetArraySubscript(JsonPathItem *v, JsonPathItem *from, JsonPathItem *to, int i)
static void printJsonPathItem(StringInfo buf, JsonPathItem *v, bool inKey, bool printBracketes)
#define read_int32(v, b, p)
const char * jspOperationName(JsonPathItemType type)
bool jspGetNext(JsonPathItem *v, JsonPathItem *a)
static int operationPriority(JsonPathItemType op)
Datum jsonpath_recv(PG_FUNCTION_ARGS)
Datum jsonpath_in(PG_FUNCTION_ARGS)
void jspGetRightArg(JsonPathItem *v, JsonPathItem *a)
static int32 reserveSpaceForItemPointer(StringInfo buf)
static char * jsonPathToCstring(StringInfo out, JsonPath *in, int estimated_len)
#define PG_RETURN_JSONPATH_P(p)
#define PG_GETARG_JSONPATH_P(x)
JsonPathParseResult * parsejsonpath(const char *str, int len, struct Node *escontext)
void pfree(void *pointer)
#define CHECK_FOR_INTERRUPTS()
#define SOFT_ERROR_OCCURRED(escontext)
Oid exprType(const Node *expr)
static Datum NumericGetDatum(Numeric X)
#define lfirst_node(type, lc)
#define forboth(cell1, list1, cell2, list2)
static char buf[DEFAULT_XLOG_SEG_SIZE]
static char * DatumGetCString(Datum X)
static struct cvec * range(struct vars *v, chr a, chr b, int cases)
void check_stack_depth(void)
struct StringInfoData * StringInfo
void appendStringInfo(StringInfo str, const char *fmt,...)
void enlargeStringInfo(StringInfo str, int needed)
void appendBinaryStringInfo(StringInfo str, const void *data, int datalen)
void appendStringInfoSpaces(StringInfo str, int count)
void appendStringInfoString(StringInfo str, const char *s)
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
#define appendStringInfoCharMacro(str, ch)
struct JsonPathItem::@153::@157 value
struct JsonPathItem::@153::@158 like_regex
struct JsonPathItem::@153::@156 anybounds
union JsonPathItem::@153 content
struct JsonPathItem::@153::@154 args
struct JsonPathItem::@153::@155::@159 * elems
struct JsonPathItem::@153::@155 array
enum JsonPathDatatypeStatus current
struct JsonPathParseItem::@160::@164 like_regex
struct JsonPathParseItem::@160::@162 array
struct JsonPathParseItem::@160::@163 anybounds
JsonPathParseItem * right
struct JsonPathParseItem::@160::@162::@166 * elems
struct JsonPathParseItem::@160::@165 string
struct JsonPathParseItem::@160::@161 args
union JsonPathParseItem::@160 value
char data[FLEXIBLE_ARRAY_MEMBER]
static Size VARSIZE(const void *PTR)
static void SET_VARSIZE(void *PTR, Size len)