a very long time.
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.117 2000/07/17 03:04:58 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.118 2000/07/22 04:22:46 tgl Exp $
*
*-------------------------------------------------------------------------
*/
return newnode;
}
-static Array *
-_copyArray(Array *from)
-{
- Array *newnode = makeNode(Array);
-
- /* ----------------
- * copy remainder of node
- * ----------------
- */
- newnode->arrayelemtype = from->arrayelemtype;
- newnode->arrayelemlength = from->arrayelemlength;
- newnode->arrayelembyval = from->arrayelembyval;
- newnode->arrayndim = from->arrayndim;
- newnode->arraylow = from->arraylow;
- newnode->arrayhigh = from->arrayhigh;
- newnode->arraylen = from->arraylen;
-
- return newnode;
-}
-
static ArrayRef *
_copyArrayRef(ArrayRef *from)
{
case T_Func:
retval = _copyFunc(from);
break;
- case T_Array:
- retval = _copyArray(from);
- break;
case T_ArrayRef:
retval = _copyArrayRef(from);
break;
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.69 2000/07/17 03:05:01 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.70 2000/07/22 04:22:46 tgl Exp $
*
*-------------------------------------------------------------------------
*/
return true;
}
-static bool
-_equalArray(Array *a, Array *b)
-{
- if (a->arrayelemtype != b->arrayelemtype)
- return false;
- /* We need not check arrayelemlength, arrayelembyval if types match */
- if (a->arrayndim != b->arrayndim)
- return false;
- /* XXX shouldn't we be checking all indices??? */
- if (a->arraylow.indx[0] != b->arraylow.indx[0])
- return false;
- if (a->arrayhigh.indx[0] != b->arrayhigh.indx[0])
- return false;
- if (a->arraylen != b->arraylen)
- return false;
-
- return true;
-}
-
static bool
_equalArrayRef(ArrayRef *a, ArrayRef *b)
{
case T_Func:
retval = _equalFunc(a, b);
break;
- case T_Array:
- retval = _equalArray(a, b);
- break;
case T_ArrayRef:
retval = _equalArrayRef(a, b);
break;
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.123 2000/07/17 03:05:01 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.124 2000/07/22 04:22:46 tgl Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
node->resulttype, node->resulttypmod);
}
-/*
- * Array is a subclass of Expr
- */
-static void
-_outArray(StringInfo str, Array *node)
-{
- int i;
-
- appendStringInfo(str,
- " ARRAY :arrayelemtype %u :arrayelemlength %d :arrayelembyval %c ",
- node->arrayelemtype,
- node->arrayelemlength,
- node->arrayelembyval ? 't' : 'f');
-
- appendStringInfo(str, " :arrayndim %d :arraylow ", node->arrayndim);
- for (i = 0; i < node->arrayndim; i++)
- appendStringInfo(str, " %d ", node->arraylow.indx[i]);
- appendStringInfo(str, " :arrayhigh ");
- for (i = 0; i < node->arrayndim; i++)
- appendStringInfo(str, " %d ", node->arrayhigh.indx[i]);
- appendStringInfo(str, " :arraylen %d ", node->arraylen);
-}
-
/*
* ArrayRef is a subclass of Expr
*/
case T_RelabelType:
_outRelabelType(str, obj);
break;
- case T_Array:
- _outArray(str, obj);
- break;
case T_ArrayRef:
_outArrayRef(str, obj);
break;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.93 2000/07/17 03:05:01 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.94 2000/07/22 04:22:46 tgl Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
return local_node;
}
-/* ----------------
- * _readArray
- *
- * Array is a subclass of Expr
- * ----------------
- */
-static Array *
-_readArray()
-{
- Array *local_node;
- char *token;
- int length;
-
- local_node = makeNode(Array);
-
- token = lsptok(NULL, &length); /* eat :arrayelemtype */
- token = lsptok(NULL, &length); /* get arrayelemtype */
- local_node->arrayelemtype = strtoul(token, NULL, 10);
-
- token = lsptok(NULL, &length); /* eat :arrayelemlength */
- token = lsptok(NULL, &length); /* get arrayelemlength */
- local_node->arrayelemlength = atoi(token);
-
- token = lsptok(NULL, &length); /* eat :arrayelembyval */
- token = lsptok(NULL, &length); /* get arrayelembyval */
- local_node->arrayelembyval = (token[0] == 't') ? true : false;
-
- token = lsptok(NULL, &length); /* eat :arraylow */
- token = lsptok(NULL, &length); /* get arraylow */
- local_node->arraylow.indx[0] = atoi(token);
-
- token = lsptok(NULL, &length); /* eat :arrayhigh */
- token = lsptok(NULL, &length); /* get arrayhigh */
- local_node->arrayhigh.indx[0] = atoi(token);
-
- token = lsptok(NULL, &length); /* eat :arraylen */
- token = lsptok(NULL, &length); /* get arraylen */
- local_node->arraylen = atoi(token);
-
- return local_node;
-}
-
/* ----------------
* _readArrayRef
*
return_value = _readExpr();
else if (length == 8 && strncmp(token, "ARRAYREF", length) == 0)
return_value = _readArrayRef();
- else if (length == 5 && strncmp(token, "ARRAY", length) == 0)
- return_value = _readArray();
else if (length == 3 && strncmp(token, "VAR", length) == 0)
return_value = _readVar();
else if (length == 4 && strncmp(token, "ATTR", length) == 0)
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: nodes.h,v 1.71 2000/07/14 15:43:51 thomas Exp $
+ * $Id: nodes.h,v 1.72 2000/07/22 04:22:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
T_Aggref,
T_SubLink,
T_Func,
- T_Array,
+ T_ArrayXXX, /* not used anymore; this tag# is available */
T_ArrayRef,
T_Iter,
T_RelabelType,
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: primnodes.h,v 1.44 2000/07/17 03:05:27 tgl Exp $
+ * $Id: primnodes.h,v 1.45 2000/07/22 04:22:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
Node *subselect;
} SubLink;
-/* ----------------
- * Array
- * arrayelemtype - type of the array's elements (homogenous!)
- * arrayelemlength - length of that type
- * arrayelembyval - is the element type pass-by-value?
- * arrayndim - number of dimensions of the array
- * arraylow - base for array indexing
- * arrayhigh - limit for array indexing
- * arraylen - total length of array object
- * ----------------
- *
- * memo from mao: the array support we inherited from 3.1 is just
- * wrong. when time exists, we should redesign this stuff to get
- * around a bunch of unfortunate implementation decisions made there.
- */
-typedef struct Array
-{
- NodeTag type;
- Oid arrayelemtype;
- int arrayelemlength;
- bool arrayelembyval;
- int arrayndim;
- IntArray arraylow;
- IntArray arrayhigh;
- int arraylen;
-} Array;
-
/* ----------------
* ArrayRef: describes an array subscripting operation
*
* 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.
+ * appropriate part of the array; the result of the operation is an
+ * entire new modified array value.
*
- * refattrlength - total length of array object
- * refelemtype - type of the result of the subscript operation
- * refelemlength - length of the array element type
+ * refattrlength - typlen of array type
+ * refelemtype - type of the result of the ArrayRef operation
+ * refelemlength - typlen of the array element type
* refelembyval - is the element type pass-by-value?
* refupperindexpr - expressions that evaluate to upper array indexes
* reflowerindexpr - expressions that evaluate to lower array indexes
* Note: currently, refelemtype is NOT the element type, but the array type,
* when doing subarray fetch or either type of store. It would be cleaner
* to add more fields so we can distinguish the array element type from the
- * result type of the subscript operator...
+ * result type of the ArrayRef operator...
* ----------------
*/
typedef struct ArrayRef