1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-16 15:02:33 +03:00

Modify array operations to include array's element type OID in the

array header, and to compute sizing and alignment of array elements
the same way normal tuple access operations do --- viz, using the
tupmacs.h macros att_addlength and att_align.  This makes the world
safe for arrays of cstrings or intervals, and should make it much
easier to write array-type-polymorphic functions; as examples see
the cleanups of array_out and contrib/array_iterator.  By Joe Conway
and Tom Lane.
This commit is contained in:
Tom Lane
2002-08-26 17:54:02 +00:00
parent 8009c27592
commit 5cabcfccce
38 changed files with 559 additions and 435 deletions

View File

@@ -10,7 +10,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: primnodes.h,v 1.65 2002/07/04 15:24:11 thomas Exp $
* $Id: primnodes.h,v 1.66 2002/08/26 17:54:02 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -397,20 +397,20 @@ typedef struct SubLink
* varlena structures and have refattrlength = -1. In any case,
* an array type is never pass-by-value.
*
* 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 ArrayRef operator...
* Note: refrestype is NOT the element type, but the array type,
* when doing subarray fetch or either type of store. It might be a good
* idea to include a refelemtype field as well.
* ----------------
*/
typedef struct ArrayRef
{
NodeTag type;
Oid refrestype; /* type of the result of the ArrayRef
* operation */
int refattrlength; /* typlen of array type */
int refelemlength; /* typlen of the array element type */
Oid refelemtype; /* type of the result of the ArrayRef
* operation */
bool refelembyval; /* is the element type pass-by-value? */
char refelemalign; /* typalign of the element type */
List *refupperindexpr;/* expressions that evaluate to upper
* array indexes */
List *reflowerindexpr;/* expressions that evaluate to lower