1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +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

@ -38,9 +38,9 @@
#include "utils/lsyscache.h"
/* This is actually a postgres version of a one dimentional array */
/* This is actually a postgres version of a one dimensional array */
typedef struct agg
typedef struct
{
ArrayType a;
int items;
@ -95,8 +95,9 @@ static PGARRAY * GetPGArray(int4 state, int fAdd)
}
p->a.size = cb;
p->a.ndim= 0;
p->a.ndim = 0;
p->a.flags = 0;
p->a.elmtype = INT4OID;
p->items = 0;
p->lower= START_NUM;
}
@ -149,6 +150,7 @@ static PGARRAY *ShrinkPGArray(PGARRAY *p)
pnew->a.size = cb;
pnew->a.ndim=1;
pnew->a.flags = 0;
pnew->a.elmtype = INT4OID;
pnew->lower = 0;
}
else