25#include "utils/fmgrprotos.h"
74 foreach(
idx, indirection)
93 (
errcode(ERRCODE_DATATYPE_MISMATCH),
94 errmsg(
"array subscript must have type integer"),
113 lowerIndexpr =
lappend(lowerIndexpr, subexpr);
130 (
errcode(ERRCODE_DATATYPE_MISMATCH),
131 errmsg(
"array subscript must have type integer"),
140 upperIndexpr =
lappend(upperIndexpr, subexpr);
150 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
151 errmsg(
"number of array dimensions (%d) exceeds the maximum allowed (%d)",
162 sbsref->refrestype = sbsref->refcontainertype;
164 sbsref->refrestype = sbsref->refelemtype;
198 (
errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
199 errmsg(
"array subscript in assignment must not be null")));
217 (
errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
218 errmsg(
"array subscript in assignment must not be null")));
478 bool is_slice = (sbsrefstate->
numlower != 0);
488 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
489 errmsg(
"number of array dimensions (%d) exceeds the maximum allowed (%d)",
495 elog(
ERROR,
"upper and lower index lists are not same length");
545 .fetch_strict =
true,
546 .fetch_leakproof =
true,
547 .store_leakproof =
false
572 .fetch_strict =
true,
573 .fetch_leakproof =
true,
574 .store_leakproof =
false
603 if (refexpr &&
IsA(refexpr,
Param) &&
607 ret = (
Node *) refexpr;
Datum idx(PG_FUNCTION_ARGS)
ArrayType * construct_empty_array(Oid elmtype)
Datum array_set_element(Datum arraydatum, int nSubscripts, int *indx, Datum dataValue, bool isNull, int arraytyplen, int elmlen, bool elmbyval, char elmalign)
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)
Datum array_subscript_handler_support(PG_FUNCTION_ARGS)
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
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define PG_GETARG_POINTER(n)
#define PG_RETURN_POINTER(x)
Assert(PointerIsAligned(start, uint64))
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)
#define IsA(nodeptr, _type_)
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)
struct SubscriptingRefState * state
struct ExprEvalStep::@55::@83 sbsref_subscript
struct ExprEvalStep::@55::@84 sbsref
union ExprEvalStep::@55 d
ParseExprKind p_expr_kind
ExecEvalSubroutine sbs_fetch_old
ExecEvalBoolSubroutine sbs_check_subscripts
ExecEvalSubroutine sbs_assign
ExecEvalSubroutine sbs_fetch
SubscriptTransform transform