From cecb6075594a407b7adcd9c9a0c243ca4b43c9a3 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 17 Nov 2005 22:14:56 +0000 Subject: 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. --- src/backend/utils/adt/int.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/backend/utils/adt/int.c') diff --git a/src/backend/utils/adt/int.c b/src/backend/utils/adt/int.c index e41e584ffe..d47dbfdab6 100644 --- a/src/backend/utils/adt/int.c +++ b/src/backend/utils/adt/int.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/int.c,v 1.68 2005/10/15 02:49:28 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/int.c,v 1.69 2005/11/17 22:14:53 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -133,7 +133,7 @@ buildint2vector(const int2 *int2s, int n) */ result->size = Int2VectorSize(n); result->ndim = 1; - result->flags = 0; + result->dataoffset = 0; /* never any nulls */ result->elemtype = INT2OID; result->dim1 = n; result->lbound1 = 0; @@ -171,7 +171,7 @@ int2vectorin(PG_FUNCTION_ARGS) result->size = Int2VectorSize(n); result->ndim = 1; - result->flags = 0; + result->dataoffset = 0; /* never any nulls */ result->elemtype = INT2OID; result->dim1 = n; result->lbound1 = 0; @@ -220,9 +220,9 @@ int2vectorrecv(PG_FUNCTION_ARGS) ObjectIdGetDatum(INT2OID), Int32GetDatum(-1))); /* sanity checks: int2vector must be 1-D, no nulls */ - if (result->ndim != 1 || - result->flags != 0 || - result->elemtype != INT2OID) + if (ARR_NDIM(result) != 1 || + ARR_HASNULL(result) || + ARR_ELEMTYPE(result) != INT2OID) ereport(ERROR, (errcode(ERRCODE_INVALID_BINARY_REPRESENTATION), errmsg("invalid int2vector data"))); -- cgit v1.2.1