72 #include "utils/fmgrprotos.h"
82 struct Node *escontext,
84 int nestingLevel,
bool insideArraySubscript);
101 int len = strlen(in);
125 elog(
ERROR,
"unsupported jsonpath version number: %d", version);
184 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
185 errmsg(
"invalid input syntax for type %s: \"%s\"",
"jsonpath",
194 jsonpath->
expr, 0,
false))
241 bool insideArraySubscript)
247 int argNestingLevel = 0;
314 nestingLevel + argNestingLevel,
315 insideArraySubscript))
317 *(
int32 *) (
buf->data + left) = chld - pos;
323 nestingLevel + argNestingLevel,
324 insideArraySubscript))
326 *(
int32 *) (
buf->data + right) = chld - pos;
347 insideArraySubscript))
349 *(
int32 *) (
buf->data + offs) = chld - pos;
372 nestingLevel + argNestingLevel,
373 insideArraySubscript))
386 if (nestingLevel <= 0)
388 (
errcode(ERRCODE_SYNTAX_ERROR),
389 errmsg(
"@ is not allowed in root expressions")));
392 if (!insideArraySubscript)
394 (
errcode(ERRCODE_SYNTAX_ERROR),
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,
469 insideArraySubscript))
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;
995 pos =
INTALIGN((uintptr_t) (base + pos)) - (uintptr_t) base;
1076 elog(
ERROR,
"unrecognized jsonpath item type: %d", v->
type);
1361 case TIMESTAMPTZOID:
1396 leftStatus != rightStatus))
Datum numeric_out(PG_FUNCTION_ARGS)
#define Assert(condition)
static void PGresult * res
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)
const char * jspOperationName(JsonPathItemType type)
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)
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)
char * jspGetString(JsonPathItem *v, int32 *len)
static int32 reserveSpaceForItemPointer(StringInfo buf)
static char * jsonPathToCstring(StringInfo out, JsonPath *in, int estimated_len)
#define PG_RETURN_JSONPATH_P(p)
JsonPathParseResult * parsejsonpath(const char *str, int len, struct Node *escontext)
#define PG_GETARG_JSONPATH_P(x)
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)
void check_stack_depth(void)
static char * DatumGetCString(Datum X)
static struct cvec * range(struct vars *v, chr a, chr b, int cases)
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)
StringInfoData * StringInfo
#define appendStringInfoCharMacro(str, ch)
union JsonPathItem::@139 content
struct JsonPathItem::@139::@144 like_regex
struct JsonPathItem::@139::@141 array
struct JsonPathItem::@139::@140 args
struct JsonPathItem::@139::@143 value
struct JsonPathItem::@139::@142 anybounds
enum JsonPathDatatypeStatus current
struct JsonPathParseItem::@146::@150 like_regex
struct JsonPathParseItem::@146::@147 args
union JsonPathParseItem::@146 value
struct JsonPathParseItem::@146::@149 anybounds
struct JsonPathParseItem::@146::@148 array
struct JsonPathParseItem::@146::@151 string
char data[FLEXIBLE_ARRAY_MEMBER]
#define SET_VARSIZE(PTR, len)