diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/executor/execExpr.h | 56 | ||||
-rw-r--r-- | src/include/jit/llvmjit.h | 2 | ||||
-rw-r--r-- | src/include/nodes/nodes.h | 2 | ||||
-rw-r--r-- | src/include/nodes/parsenodes.h | 2 | ||||
-rw-r--r-- | src/include/nodes/primnodes.h | 54 | ||||
-rw-r--r-- | src/include/parser/parse_node.h | 17 |
6 files changed, 69 insertions, 64 deletions
diff --git a/src/include/executor/execExpr.h b/src/include/executor/execExpr.h index 2c1697dd766..7aacdc5d049 100644 --- a/src/include/executor/execExpr.h +++ b/src/include/executor/execExpr.h @@ -19,7 +19,7 @@ /* forward references to avoid circularity */ struct ExprEvalStep; -struct ArrayRefState; +struct SubscriptingRefState; /* Bits in ExprState->flags (see also execnodes.h for public flag bits): */ /* expression's interpreter has been initialized */ @@ -185,21 +185,21 @@ typedef enum ExprEvalOp */ EEOP_FIELDSTORE_FORM, - /* Process an array subscript; short-circuit expression to NULL if NULL */ - EEOP_ARRAYREF_SUBSCRIPT, + /* Process a container subscript; short-circuit expression to NULL if NULL */ + EEOP_SBSREF_SUBSCRIPT, /* - * Compute old array element/slice when an ArrayRef assignment expression - * contains ArrayRef/FieldStore subexpressions. Value is accessed using - * the CaseTest mechanism. + * Compute old container element/slice when a SubscriptingRef assignment + * expression contains SubscriptingRef/FieldStore subexpressions. Value is + * accessed using the CaseTest mechanism. */ - EEOP_ARRAYREF_OLD, + EEOP_SBSREF_OLD, - /* compute new value for ArrayRef assignment expression */ - EEOP_ARRAYREF_ASSIGN, + /* compute new value for SubscriptingRef assignment expression */ + EEOP_SBSREF_ASSIGN, - /* compute element/slice for ArrayRef fetch expression */ - EEOP_ARRAYREF_FETCH, + /* compute element/slice for SubscriptingRef fetch expression */ + EEOP_SBSREF_FETCH, /* evaluate value for CoerceToDomainValue */ EEOP_DOMAIN_TESTVAL, @@ -492,22 +492,22 @@ typedef struct ExprEvalStep int ncolumns; } fieldstore; - /* for EEOP_ARRAYREF_SUBSCRIPT */ + /* for EEOP_SBSREF_SUBSCRIPT */ struct { /* too big to have inline */ - struct ArrayRefState *state; + struct SubscriptingRefState *state; int off; /* 0-based index of this subscript */ bool isupper; /* is it upper or lower subscript? */ int jumpdone; /* jump here on null */ - } arrayref_subscript; + } sbsref_subscript; - /* for EEOP_ARRAYREF_OLD / ASSIGN / FETCH */ + /* for EEOP_SBSREF_OLD / ASSIGN / FETCH */ struct { /* too big to have inline */ - struct ArrayRefState *state; - } arrayref; + struct SubscriptingRefState *state; + } sbsref; /* for EEOP_DOMAIN_NOTNULL / DOMAIN_CHECK */ struct @@ -658,14 +658,14 @@ typedef struct ExprEvalStep } ExprEvalStep; -/* Non-inline data for array operations */ -typedef struct ArrayRefState +/* Non-inline data for container operations */ +typedef struct SubscriptingRefState { bool isassignment; /* is it assignment, or just fetch? */ - Oid refelemtype; /* OID of the array element type */ - int16 refattrlength; /* typlen of array type */ - int16 refelemlength; /* typlen of the array element type */ + Oid refelemtype; /* OID of the container element type */ + int16 refattrlength; /* typlen of container type */ + int16 refelemlength; /* typlen of the container element type */ bool refelembyval; /* is the element type pass-by-value? */ char refelemalign; /* typalign of the element type */ @@ -688,10 +688,10 @@ typedef struct ArrayRefState Datum replacevalue; bool replacenull; - /* if we have a nested assignment, ARRAYREF_OLD puts old value here */ + /* if we have a nested assignment, SBSREF_OLD puts old value here */ Datum prevvalue; bool prevnull; -} ArrayRefState; +} SubscriptingRefState; /* functions in execExpr.c */ @@ -735,10 +735,10 @@ extern void ExecEvalFieldStoreDeForm(ExprState *state, ExprEvalStep *op, ExprContext *econtext); extern void ExecEvalFieldStoreForm(ExprState *state, ExprEvalStep *op, ExprContext *econtext); -extern bool ExecEvalArrayRefSubscript(ExprState *state, ExprEvalStep *op); -extern void ExecEvalArrayRefFetch(ExprState *state, ExprEvalStep *op); -extern void ExecEvalArrayRefOld(ExprState *state, ExprEvalStep *op); -extern void ExecEvalArrayRefAssign(ExprState *state, ExprEvalStep *op); +extern bool ExecEvalSubscriptingRef(ExprState *state, ExprEvalStep *op); +extern void ExecEvalSubscriptingRefFetch(ExprState *state, ExprEvalStep *op); +extern void ExecEvalSubscriptingRefOld(ExprState *state, ExprEvalStep *op); +extern void ExecEvalSubscriptingRefAssign(ExprState *state, ExprEvalStep *op); extern void ExecEvalConvertRowtype(ExprState *state, ExprEvalStep *op, ExprContext *econtext); extern void ExecEvalScalarArrayOp(ExprState *state, ExprEvalStep *op); diff --git a/src/include/jit/llvmjit.h b/src/include/jit/llvmjit.h index 726ec99130b..6178864b2e6 100644 --- a/src/include/jit/llvmjit.h +++ b/src/include/jit/llvmjit.h @@ -85,7 +85,7 @@ extern LLVMValueRef FuncVarsizeAny; extern LLVMValueRef FuncSlotGetmissingattrs; extern LLVMValueRef FuncSlotGetsomeattrsInt; extern LLVMValueRef FuncMakeExpandedObjectReadOnlyInternal; -extern LLVMValueRef FuncExecEvalArrayRefSubscript; +extern LLVMValueRef FuncExecEvalSubscriptingRef; extern LLVMValueRef FuncExecEvalSysVar; extern LLVMValueRef FuncExecAggTransReparent; extern LLVMValueRef FuncExecAggInitGroup; diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index fbe2dc14a7d..e215ad4978a 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -154,7 +154,7 @@ typedef enum NodeTag T_Aggref, T_GroupingFunc, T_WindowFunc, - T_ArrayRef, + T_SubscriptingRef, T_FuncExpr, T_NamedArgExpr, T_OpExpr, diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 4ec8a835417..2fe14d7db20 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -224,7 +224,7 @@ typedef struct TypeName * Currently, A_Star must appear only as the last list element --- the grammar * is responsible for enforcing this! * - * Note: any array subscripting or selection of fields from composite columns + * Note: any container subscripting or selection of fields from composite columns * is represented by an A_Indirection node above the ColumnRef. However, * for simplicity in the normal case, initial field selection from a table * name is represented within ColumnRef and not by adding A_Indirection. diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index 78fb0e414e3..a7efae70381 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -368,18 +368,19 @@ typedef struct WindowFunc } WindowFunc; /* ---------------- - * ArrayRef: describes an array subscripting operation - * - * An ArrayRef can describe fetching a single element from an array, - * fetching a subarray (array slice), storing a single element into - * an array, or storing a slice. The "store" cases work with an - * initial array value and a source value that is inserted into the - * appropriate part of the array; the result of the operation is an - * entire new modified array value. - * - * If reflowerindexpr = NIL, then we are fetching or storing a single array - * element at the subscripts given by refupperindexpr. Otherwise we are - * fetching or storing an array slice, that is a rectangular subarray + * SubscriptingRef: describes a subscripting operation over a container + * (array, etc). + * + * A SubscriptingRef can describe fetching a single element from a container, + * fetching a part of container (e.g. array slice), storing a single element into + * a container, or storing a slice. The "store" cases work with an + * initial container value and a source value that is inserted into the + * appropriate part of the container; the result of the operation is an + * entire new modified container value. + * + * If reflowerindexpr = NIL, then we are fetching or storing a single container + * element at the subscripts given by refupperindexpr. Otherwise we are + * fetching or storing a container slice, that is a rectangular subcontainer * with lower and upper bounds given by the index expressions. * reflowerindexpr must be the same length as refupperindexpr when it * is not NIL. @@ -391,28 +392,31 @@ typedef struct WindowFunc * element; but it is the array type when doing subarray fetch or either * type of store. * - * Note: for the cases where an array is returned, if refexpr yields a R/W - * expanded array, then the implementation is allowed to modify that object + * Note: for the cases where a container is returned, if refexpr yields a R/W + * expanded container, then the implementation is allowed to modify that object * in-place and return the same object.) * ---------------- */ -typedef struct ArrayRef +typedef struct SubscriptingRef { Expr xpr; - Oid refarraytype; /* type of the array proper */ - Oid refelemtype; /* type of the array elements */ - int32 reftypmod; /* typmod of the array (and elements too) */ + Oid refcontainertype; /* type of the container proper */ + Oid refelemtype; /* type of the container elements */ + int32 reftypmod; /* typmod of the container (and elements too) */ Oid refcollid; /* OID of collation, or InvalidOid if none */ List *refupperindexpr; /* expressions that evaluate to upper - * array indexes */ + * container indexes */ List *reflowerindexpr; /* expressions that evaluate to lower - * array indexes, or NIL for single array - * element */ - Expr *refexpr; /* the expression that evaluates to an array - * value */ + * container indexes, or NIL for single + * container element */ + List *refindexprslice; /* whether or not related indexpr from + * reflowerindexpr is a slice */ + Expr *refexpr; /* the expression that evaluates to a + * container value */ + Expr *refassgnexpr; /* expression for the source value, or NULL if * fetch */ -} ArrayRef; +} SubscriptingRef; /* * CoercionContext - distinguishes the allowed set of type casts @@ -755,7 +759,7 @@ typedef struct FieldSelect * * FieldStore represents the operation of modifying one field in a tuple * value, yielding a new tuple value (the input is not touched!). Like - * the assign case of ArrayRef, this is used to implement UPDATE of a + * the assign case of SubscriptingRef, this is used to implement UPDATE of a * portion of a column. * * resulttype is always a named composite type (not a domain). To update diff --git a/src/include/parser/parse_node.h b/src/include/parser/parse_node.h index b95489379c5..ea99a0954ba 100644 --- a/src/include/parser/parse_node.h +++ b/src/include/parser/parse_node.h @@ -273,14 +273,15 @@ extern void cancel_parser_errposition_callback(ParseCallbackState *pcbstate); extern Var *make_var(ParseState *pstate, RangeTblEntry *rte, int attrno, int location); -extern Oid transformArrayType(Oid *arrayType, int32 *arrayTypmod); -extern ArrayRef *transformArraySubscripts(ParseState *pstate, - Node *arrayBase, - Oid arrayType, - Oid elementType, - int32 arrayTypMod, - List *indirection, - Node *assignFrom); +extern Oid transformContainerType(Oid *containerType, int32 *containerTypmod); + +extern SubscriptingRef *transformContainerSubscripts(ParseState *pstate, + Node *containerBase, + Oid containerType, + Oid elementType, + int32 containerTypMod, + List *indirection, + Node *assignFrom); extern Const *make_const(ParseState *pstate, Value *value, int location); #endif /* PARSE_NODE_H */ |