> intarray and ltree both seem to be mapping their own declarations onto
authorBruce Momjian
Thu, 12 Sep 2002 00:24:46 +0000 (00:24 +0000)
committerBruce Momjian
Thu, 12 Sep 2002 00:24:46 +0000 (00:24 +0000)
> arrays using largely-similar code.  But while intarray fails its
> regression test, I find ltree still passes.  So I'm confused about what
> that code is really doing and don't want to touch it.

Please, apply attached patch, it solves the problem.

Teodor Sigaev

contrib/intarray/_int.c

index f4fc63d1c18b3957809bac17466dc22d9e5c6311..65693a89f32e3cb54c9de0f433d0e9c26ff65823 100644 (file)
@@ -14,6 +14,7 @@
 
 #include 
 
+#include "catalog/pg_type.h"
 #include "access/gist.h"
 #include "access/itup.h"
 #include "access/rtree.h"
@@ -919,8 +920,10 @@ new_intArrayType(int num)
    r = (ArrayType *) palloc(nbytes);
 
    MemSet(r, 0, nbytes);
-   r->size = nbytes;
-   r->ndim = NDIM;
+   
+   ARR_SIZE(r) = nbytes;
+   ARR_NDIM(r) = NDIM;
+   ARR_ELEMTYPE(r) = INT4OID;
    r->flags &= ~LEAFKEY;
    *((int *) ARR_DIMS(r)) = num;
    *((int *) ARR_LBOUND(r)) = 1;