diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-11-17 22:14:56 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-11-17 22:14:56 +0000 |
| commit | cecb6075594a407b7adcd9c9a0c243ca4b43c9a3 (patch) | |
| tree | d3febb775476b082255aa6122b0ba80a8ba79b37 /src/backend/catalog/pg_proc.c | |
| parent | c859308aba7edef428994e6de90ff35f35a328c5 (diff) | |
| download | postgresql-cecb6075594a407b7adcd9c9a0c243ca4b43c9a3.tar.gz | |
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 'src/backend/catalog/pg_proc.c')
| -rw-r--r-- | src/backend/catalog/pg_proc.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c index b2559a0e77..d443646724 100644 --- a/src/backend/catalog/pg_proc.c +++ b/src/backend/catalog/pg_proc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.135 2005/10/29 00:31:50 petere Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.136 2005/11/17 22:14:51 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -119,12 +119,15 @@ ProcedureCreate(const char *procedureName, * need to use deconstruct_array() since the array data is just going * to look like a C array of OID values. */ - allParamCount = ARR_DIMS(DatumGetPointer(allParameterTypes))[0]; - if (ARR_NDIM(DatumGetPointer(allParameterTypes)) != 1 || + ArrayType *allParamArray = (ArrayType *) DatumGetPointer(allParameterTypes); + + allParamCount = ARR_DIMS(allParamArray)[0]; + if (ARR_NDIM(allParamArray) != 1 || allParamCount <= 0 || - ARR_ELEMTYPE(DatumGetPointer(allParameterTypes)) != OIDOID) + ARR_HASNULL(allParamArray) || + ARR_ELEMTYPE(allParamArray) != OIDOID) elog(ERROR, "allParameterTypes is not a 1-D Oid array"); - allParams = (Oid *) ARR_DATA_PTR(DatumGetPointer(allParameterTypes)); + allParams = (Oid *) ARR_DATA_PTR(allParamArray); Assert(allParamCount >= parameterCount); /* we assume caller got the contents right */ } |
