56 foreach(
idx, indirection)
66 (
errcode(ERRCODE_DATATYPE_MISMATCH),
67 errmsg(
"jsonb subscript does not support slices"),
74 targetType = UNKNOWNOID;
79 if (subExprType != UNKNOWNOID)
81 Oid targets[2] = {INT4OID, TEXTOID};
89 for (
int i = 0;
i < 2;
i++)
97 if (targetType != UNKNOWNOID)
99 (
errcode(ERRCODE_DATATYPE_MISMATCH),
101 errhint(
"jsonb subscript must be coercible to only one type, integer or text."),
104 targetType = targets[
i];
111 if (targetType == UNKNOWNOID)
113 (
errcode(ERRCODE_DATATYPE_MISMATCH),
115 errhint(
"jsonb subscript must be coercible to either integer or text."),
119 targetType = TEXTOID;
128 subExpr, subExprType,
135 (
errcode(ERRCODE_DATATYPE_MISMATCH),
136 errmsg(
"jsonb subscript must have text type"),
147 (
errcode(ERRCODE_DATATYPE_MISMATCH),
148 errmsg(
"jsonb subscript does not support slices"),
152 upperIndexpr =
lappend(upperIndexpr, subExpr);
160 sbsref->refrestype = JSONBOID;
161 sbsref->reftypmod = -1;
203 (
errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
204 errmsg(
"jsonb subscript in assignment must not be null")));
292 newSource.
val.array.nElems = 0;
293 newSource.
val.array.rawScalar =
false;
298 newSource.
val.object.nPairs = 0;
364 nupper * (
sizeof(
Datum) +
sizeof(
Oid)));
373 ptr += nupper *
sizeof(
Datum);
407 .fetch_strict =
true,
408 .fetch_leakproof =
true,
409 .store_leakproof =
false
Datum idx(PG_FUNCTION_ARGS)
#define CStringGetTextDatum(s)
#define Assert(condition)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define DirectFunctionCall1(func, arg1)
#define PG_RETURN_POINTER(x)
Datum int4out(PG_FUNCTION_ARGS)
if(TABLE==NULL||TABLE_index==NULL)
static Jsonb * DatumGetJsonbP(Datum d)
Jsonb * JsonbValueToJsonb(JsonbValue *val)
void JsonbToJsonbValue(Jsonb *jsonb, JsonbValue *val)
static bool jsonb_subscript_check_subscripts(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
static void jsonb_subscript_transform(SubscriptingRef *sbsref, List *indirection, ParseState *pstate, bool isSlice, bool isAssignment)
Datum jsonb_subscript_handler(PG_FUNCTION_ARGS)
static void jsonb_subscript_assign(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
static void jsonb_subscript_fetch(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
static void jsonb_exec_setup(const SubscriptingRef *sbsref, SubscriptingRefState *sbsrefstate, SubscriptExecSteps *methods)
struct JsonbSubWorkspace JsonbSubWorkspace
static void jsonb_subscript_fetch_old(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
Datum jsonb_set_element(Jsonb *jb, Datum *path, int path_len, JsonbValue *newval)
Datum jsonb_get_element(Jsonb *jb, Datum *path, int npath, bool *isnull, bool as_text)
List * lappend(List *list, void *datum)
void * palloc0(Size size)
Oid exprType(const Node *expr)
int exprLocation(const Node *expr)
Node * coerce_type(ParseState *pstate, Node *node, Oid inputTypeId, Oid targetTypeId, int32 targetTypeMod, CoercionContext ccontext, CoercionForm cformat, int location)
bool can_coerce_type(int nargs, const Oid *input_typeids, const Oid *target_typeids, CoercionContext ccontext)
Node * transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKind)
int parser_errposition(ParseState *pstate, int location)
#define lfirst_node(type, lc)
#define foreach_current_index(var_or_cell)
static char * DatumGetCString(Datum X)
struct ExprEvalStep::@55::@82 sbsref_subscript
union ExprEvalStep::@55 d
struct ExprEvalStep::@55::@83 sbsref
ParseExprKind p_expr_kind
ExecEvalSubroutine sbs_fetch_old
ExecEvalBoolSubroutine sbs_check_subscripts
ExecEvalSubroutine sbs_assign
ExecEvalSubroutine sbs_fetch
SubscriptTransform transform