66 *
77 * Copyright (c) 1994, Regents of the University of California
88 *
9- * $Id: primnodes.h,v 1.31 1999/07/16 17:07:33 momjian Exp $
9+ * $Id: primnodes.h,v 1.32 1999/07/18 03:45:01 tgl Exp $
1010 *
1111 *-------------------------------------------------------------------------
1212 */
@@ -302,13 +302,13 @@ typedef struct SubLink
302302
303303/* ----------------
304304 * Array
305- *arrayelemtype-base type of the array's elements (homogenous!)
305+ *arrayelemtype- type of the array's elements (homogenous!)
306306 *arrayelemlength - length of that type
307- *arrayelembyval-can you pass this elementby value?
307+ *arrayelembyval-is the elementtype pass-by- value?
308308 *arrayndim- number of dimensions of the array
309309 *arraylow- base for array indexing
310310 *arrayhigh- limit for array indexing
311- *arraylen-
311+ *arraylen- total length of array object
312312 * ----------------
313313 *
314314 *memo from mao:the array support we inherited from 3.1 is just
@@ -328,15 +328,39 @@ typedef struct Array
328328}Array ;
329329
330330/* ----------------
331- *ArrayRef:
332- *refelemtype- type of the element referenced here
333- *refelemlength- length of that type
334- *refelembyval- can you pass this element type by value?
335- *refupperindexpr - expressions that evaluate to upper array index
336- *reflowerexpr- the expressions that evaluate to a lower array index
337- *refexpr- the expression that evaluates to an array
338- *refassignexpr- the expression that evaluates to the new value
339- *to be assigned to the array in case of replace.
331+ *ArrayRef: describes an array subscripting operation
332+ *
333+ * An ArrayRef can describe fetching a single element from an array,
334+ * fetching a subarray (array slice), storing a single element into
335+ * an array, or storing a slice. The "store" cases work with an
336+ * initial array value and a source value that is inserted into the
337+ * appropriate part of the array.
338+ *
339+ *refattrlength- total length of array object
340+ *refelemtype- type of the result of the subscript operation
341+ *refelemlength- length of the array element type
342+ *refelembyval- is the element type pass-by-value?
343+ *refupperindexpr - expressions that evaluate to upper array indexes
344+ *reflowerindexpr- expressions that evaluate to lower array indexes
345+ *refexpr- the expression that evaluates to an array value
346+ *refassgnexpr- expression for the source value, or NULL if fetch
347+ *
348+ * If reflowerindexpr = NIL, then we are fetching or storing a single array
349+ * element at the subscripts given by refupperindexpr. Otherwise we are
350+ * fetching or storing an array slice, that is a rectangular subarray
351+ * with lower and upper bounds given by the index expressions.
352+ * reflowerindexpr must be the same length as refupperindexpr when it
353+ * is not NIL.
354+ *
355+ * Note: array types can be fixed-length (refattrlength > 0), but only
356+ * when the element type is itself fixed-length. Otherwise they are
357+ * varlena structures and have refattrlength = -1. In any case,
358+ * an array type is never pass-by-value.
359+ *
360+ * Note: currently, refelemtype is NOT the element type, but the array type,
361+ * when doing subarray fetch or either type of store. It would be cleaner
362+ * to add more fields so we can distinguish the array element type from the
363+ * result type of the subscript operator...
340364 * ----------------
341365 */
342366typedef struct ArrayRef