59 foreach(
idx, indirection)
69 (
errcode(ERRCODE_DATATYPE_MISMATCH),
70 errmsg(
"jsonb subscript does not support slices"),
77 targetType = UNKNOWNOID;
82 if (subExprType != UNKNOWNOID)
84 Oid targets[2] = {INT4OID, TEXTOID};
92 for (
int i = 0;
i < 2;
i++)
100 if (targetType != UNKNOWNOID)
102 (
errcode(ERRCODE_DATATYPE_MISMATCH),
104 errhint(
"jsonb subscript must be coercible to only one type, integer or text."),
107 targetType = targets[
i];
114 if (targetType == UNKNOWNOID)
116 (
errcode(ERRCODE_DATATYPE_MISMATCH),
118 errhint(
"jsonb subscript must be coercible to either integer or text."),
122 targetType = TEXTOID;
131 subExpr, subExprType,
138 (
errcode(ERRCODE_DATATYPE_MISMATCH),
139 errmsg(
"jsonb subscript must have text type"),
150 (
errcode(ERRCODE_DATATYPE_MISMATCH),
151 errmsg(
"jsonb subscript does not support slices"),
155 upperIndexpr =
lappend(upperIndexpr, subExpr);
163 sbsref->refrestype = JSONBOID;
164 sbsref->reftypmod = -1;
206 (
errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
207 errmsg(
"jsonb subscript in assignment must not be null")));
295 newSource.
val.array.nElems = 0;
296 newSource.
val.array.rawScalar =
false;
301 newSource.
val.object.nPairs = 0;
367 nupper * (
sizeof(
Datum) +
sizeof(
Oid)));
376 ptr += nupper *
sizeof(
Datum);
410 .fetch_strict =
true,
411 .fetch_leakproof =
true,
412 .store_leakproof =
false
Datum idx(PG_FUNCTION_ARGS)
#define CStringGetTextDatum(s)
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)
Assert(fmt[strlen(fmt) - 1] !='\n')
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(cell)
static char * DatumGetCString(Datum X)
union ExprEvalStep::@51 d
struct ExprEvalStep::@51::@78 sbsref_subscript
struct ExprEvalStep::@51::@79 sbsref
ParseExprKind p_expr_kind
ExecEvalSubroutine sbs_fetch_old
ExecEvalBoolSubroutine sbs_check_subscripts
ExecEvalSubroutine sbs_assign
ExecEvalSubroutine sbs_fetch
SubscriptTransform transform