From 4bdb34862848d53945f2b412777e78da89337db1 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 22 Jul 2000 04:22:47 +0000 Subject: [PATCH] Remove 'Array' node type, which has evidently been dead code for a very long time. --- src/backend/nodes/copyfuncs.c | 25 +----------------- src/backend/nodes/equalfuncs.c | 24 +----------------- src/backend/nodes/outfuncs.c | 28 +-------------------- src/backend/nodes/readfuncs.c | 46 +--------------------------------- src/include/nodes/nodes.h | 4 +-- src/include/nodes/primnodes.h | 40 ++++++----------------------- 6 files changed, 13 insertions(+), 154 deletions(-) diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index 4013a0f77b..2def370e9f 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -19,7 +19,7 @@ * 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 $ * *------------------------------------------------------------------------- */ @@ -933,26 +933,6 @@ _copyCaseWhen(CaseWhen *from) 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) { @@ -1724,9 +1704,6 @@ copyObject(void *from) case T_Func: retval = _copyFunc(from); break; - case T_Array: - retval = _copyArray(from); - break; case T_ArrayRef: retval = _copyArrayRef(from); break; diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c index b1772e6436..b85c410c25 100644 --- a/src/backend/nodes/equalfuncs.c +++ b/src/backend/nodes/equalfuncs.c @@ -24,7 +24,7 @@ * 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 $ * *------------------------------------------------------------------------- */ @@ -293,25 +293,6 @@ _equalRelabelType(RelabelType *a, RelabelType *b) 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) { @@ -800,9 +781,6 @@ equal(void *a, void *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; diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index c561ad5126..155aae37ad 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -6,7 +6,7 @@ * 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 @@ -770,29 +770,6 @@ _outRelabelType(StringInfo str, RelabelType *node) 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 */ @@ -1508,9 +1485,6 @@ _outNode(StringInfo str, void *obj) case T_RelabelType: _outRelabelType(str, obj); break; - case T_Array: - _outArray(str, obj); - break; case T_ArrayRef: _outArrayRef(str, obj); break; diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c index b9916ce6b0..c663ba304f 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -8,7 +8,7 @@ * * * 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 @@ -814,48 +814,6 @@ _readVar() 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 * @@ -1835,8 +1793,6 @@ parsePlanString(void) 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) diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index f919221b63..08a44675fc 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -7,7 +7,7 @@ * 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 $ * *------------------------------------------------------------------------- */ @@ -64,7 +64,7 @@ typedef enum NodeTag T_Aggref, T_SubLink, T_Func, - T_Array, + T_ArrayXXX, /* not used anymore; this tag# is available */ T_ArrayRef, T_Iter, T_RelabelType, diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index 2cf59ca50c..47de5779ae 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -7,7 +7,7 @@ * 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 $ * *------------------------------------------------------------------------- */ @@ -389,33 +389,6 @@ typedef struct SubLink 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 * @@ -423,11 +396,12 @@ typedef struct 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. + * 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 @@ -449,7 +423,7 @@ typedef struct Array * 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