diff options
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/nodes/parsenodes.h | 17 | ||||
| -rw-r--r-- | src/include/nodes/primnodes.h | 5 | ||||
| -rw-r--r-- | src/include/utils/array.h | 2 |
3 files changed, 17 insertions, 7 deletions
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 9142e94b070..abd4dd166cc 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -157,9 +157,10 @@ typedef struct Query List *constraintDeps; /* a list of pg_constraint OIDs that the query * depends on to be semantically valid */ - List *withCheckOptions; /* a list of WithCheckOption's, which are - * only added during rewrite and therefore - * are not written out as part of Query. */ + List *withCheckOptions; /* a list of WithCheckOption's, which + * are only added during rewrite and + * therefore are not written out as + * part of Query. */ } Query; @@ -351,13 +352,17 @@ typedef struct A_Star } A_Star; /* - * A_Indices - array subscript or slice bounds ([lidx:uidx] or [uidx]) + * A_Indices - array subscript or slice bounds ([idx] or [lidx:uidx]) + * + * In slice case, either or both of lidx and uidx can be NULL (omitted). + * In non-slice case, uidx holds the single subscript and lidx is always NULL. */ typedef struct A_Indices { NodeTag type; - Node *lidx; /* NULL if it's a single subscript */ - Node *uidx; + bool is_slice; /* true if slice (i.e., colon present) */ + Node *lidx; /* slice lower bound, if any */ + Node *uidx; /* subscript, or slice upper bound if any */ } A_Indices; /* diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index 60c1ca2c8dc..4dbcc10e337 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -341,6 +341,9 @@ typedef struct WindowFunc * reflowerindexpr must be the same length as refupperindexpr when it * is not NIL. * + * In the slice case, individual expressions in the subscript lists can be + * NULL, meaning "substitute the array's current lower or upper bound". + * * Note: the result datatype is the element type when fetching a single * element; but it is the array type when doing subarray fetch or either * type of store. @@ -360,7 +363,7 @@ typedef struct ArrayRef List *refupperindexpr;/* expressions that evaluate to upper array * indexes */ List *reflowerindexpr;/* expressions that evaluate to lower array - * indexes */ + * indexes, or NIL for single array element */ Expr *refexpr; /* the expression that evaluates to an array * value */ Expr *refassgnexpr; /* expression for the source value, or NULL if diff --git a/src/include/utils/array.h b/src/include/utils/array.h index c25b80d272a..716e75637b0 100644 --- a/src/include/utils/array.h +++ b/src/include/utils/array.h @@ -377,9 +377,11 @@ extern Datum array_set_element(Datum arraydatum, int nSubscripts, int *indx, int arraytyplen, int elmlen, bool elmbyval, char elmalign); extern Datum array_get_slice(Datum arraydatum, int nSubscripts, int *upperIndx, int *lowerIndx, + bool *upperProvided, bool *lowerProvided, int arraytyplen, int elmlen, bool elmbyval, char elmalign); extern 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); |
