aboutsummaryrefslogtreecommitdiff
path: root/contrib/intarray/_int_tool.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-11-17 22:14:56 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-11-17 22:14:56 +0000
commitcecb6075594a407b7adcd9c9a0c243ca4b43c9a3 (patch)
treed3febb775476b082255aa6122b0ba80a8ba79b37 /contrib/intarray/_int_tool.c
parentc859308aba7edef428994e6de90ff35f35a328c5 (diff)
downloadpostgresql-cecb6075594a407b7adcd9c9a0c243ca4b43c9a3.tar.gz
postgresql-cecb6075594a407b7adcd9c9a0c243ca4b43c9a3.zip
Make SQL arrays support null elements. This commit fixes the core array
functionality, but I still need to make another pass looking at places that incidentally use arrays (such as ACL manipulation) to make sure they are null-safe. Contrib needs work too. I have not changed the behaviors that are still under discussion about array comparison and what to do with lower bounds.
Diffstat (limited to 'contrib/intarray/_int_tool.c')
-rw-r--r--contrib/intarray/_int_tool.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/contrib/intarray/_int_tool.c b/contrib/intarray/_int_tool.c
index a3399874ada..13c5d1e9e24 100644
--- a/contrib/intarray/_int_tool.c
+++ b/contrib/intarray/_int_tool.c
@@ -208,12 +208,13 @@ ArrayType *
new_intArrayType(int num)
{
ArrayType *r;
- int nbytes = ARR_OVERHEAD(NDIM) + sizeof(int) * num;
+ int nbytes = ARR_OVERHEAD_NONULLS(NDIM) + sizeof(int) * num;
r = (ArrayType *) palloc0(nbytes);
ARR_SIZE(r) = nbytes;
ARR_NDIM(r) = NDIM;
+ r->dataoffset = 0; /* marker for no null bitmap */
ARR_ELEMTYPE(r) = INT4OID;
*((int *) ARR_DIMS(r)) = num;
*((int *) ARR_LBOUND(r)) = 1;
@@ -224,7 +225,7 @@ new_intArrayType(int num)
ArrayType *
resize_intArrayType(ArrayType *a, int num)
{
- int nbytes = ARR_OVERHEAD(NDIM) + sizeof(int) * num;
+ int nbytes = ARR_OVERHEAD_NONULLS(NDIM) + sizeof(int) * num;
if (num == ARRNELEMS(a))
return a;