24 #include "utils/fmgrprotos.h"
73 foreach(
idx, indirection)
92 (
errcode(ERRCODE_DATATYPE_MISMATCH),
93 errmsg(
"array subscript must have type integer"),
112 lowerIndexpr =
lappend(lowerIndexpr, subexpr);
129 (
errcode(ERRCODE_DATATYPE_MISMATCH),
130 errmsg(
"array subscript must have type integer"),
139 upperIndexpr =
lappend(upperIndexpr, subexpr);
149 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
150 errmsg(
"number of array dimensions (%d) exceeds the maximum allowed (%d)",
161 sbsref->refrestype = sbsref->refcontainertype;
163 sbsref->refrestype = sbsref->refelemtype;
197 (
errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
198 errmsg(
"array subscript in assignment must not be null")));
216 (
errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
217 errmsg(
"array subscript in assignment must not be null")));
477 bool is_slice = (sbsrefstate->
numlower != 0);
487 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
488 errmsg(
"number of array dimensions (%d) exceeds the maximum allowed (%d)",
494 elog(
ERROR,
"upper and lower index lists are not same length");
544 .fetch_strict =
true,
545 .fetch_leakproof =
true,
546 .store_leakproof =
false
571 .fetch_strict =
true,
572 .fetch_leakproof =
true,
573 .store_leakproof =
false
Datum idx(PG_FUNCTION_ARGS)
Datum array_set_element(Datum arraydatum, int nSubscripts, int *indx, Datum dataValue, bool isNull, int arraytyplen, int elmlen, bool elmbyval, char elmalign)
ArrayType * construct_empty_array(Oid elmtype)
Datum array_get_element(Datum arraydatum, int nSubscripts, int *indx, int arraytyplen, int elmlen, bool elmbyval, char elmalign, bool *isNull)
Datum array_get_slice(Datum arraydatum, int nSubscripts, int *upperIndx, int *lowerIndx, bool *upperProvided, bool *lowerProvided, int arraytyplen, int elmlen, bool elmbyval, char elmalign)
Datum array_set_slice(Datum arraydatum, int nSubscripts, int *upperIndx, int *lowerIndx, bool *upperProvided, bool *lowerProvided, Datum srcArrayDatum, bool isNull, int arraytyplen, int elmlen, bool elmbyval, char elmalign)
static void array_subscript_assign_slice(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
static void array_subscript_fetch_old(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
static void array_subscript_assign(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
static void array_exec_setup(const SubscriptingRef *sbsref, SubscriptingRefState *sbsrefstate, SubscriptExecSteps *methods)
static void array_subscript_fetch(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
static void array_subscript_fetch_old_slice(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
static void array_subscript_fetch_slice(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
Datum array_subscript_handler(PG_FUNCTION_ARGS)
static void array_subscript_transform(SubscriptingRef *sbsref, List *indirection, ParseState *pstate, bool isSlice, bool isAssignment)
Datum raw_array_subscript_handler(PG_FUNCTION_ARGS)
static bool array_subscript_check_subscripts(ExprState *state, ExprEvalStep *op, ExprContext *econtext)
struct ArraySubWorkspace ArraySubWorkspace
#define Assert(condition)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define PG_RETURN_POINTER(x)
if(TABLE==NULL||TABLE_index==NULL)
List * lappend(List *list, void *datum)
void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval, char *typalign)
int16 get_typlen(Oid typid)
Const * makeConst(Oid consttype, int32 consttypmod, Oid constcollid, int constlen, Datum constvalue, bool constisnull, bool constbyval)
Oid exprType(const Node *expr)
int exprLocation(const Node *expr)
Node * coerce_to_target_type(ParseState *pstate, Node *expr, Oid exprtype, Oid targettype, int32 targettypmod, CoercionContext ccontext, CoercionForm cformat, int location)
Node * transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKind)
int parser_errposition(ParseState *pstate, int location)
#define lfirst_node(type, lc)
static int list_length(const List *l)
static Datum PointerGetDatum(const void *X)
static Datum Int32GetDatum(int32 X)
static int32 DatumGetInt32(Datum X)
union ExprEvalStep::@54 d
struct ExprEvalStep::@54::@82 sbsref
struct ExprEvalStep::@54::@81 sbsref_subscript
ParseExprKind p_expr_kind
ExecEvalSubroutine sbs_fetch_old
ExecEvalBoolSubroutine sbs_check_subscripts
ExecEvalSubroutine sbs_assign
ExecEvalSubroutine sbs_fetch
SubscriptTransform transform