Fixes for intagg regression tests to match new array internal handling.
authorBruce Momjian <bruce@momjian.us>
Mon, 2 Sep 2002 06:28:06 +0000 (06:28 +0000)
committerBruce Momjian <bruce@momjian.us>
Mon, 2 Sep 2002 06:28:06 +0000 (06:28 +0000)
mlw

contrib/intagg/int_aggregate.c
contrib/intagg/int_aggregate.sql.in

index 4a2e6afdc6bd853988e9c46a0034a06eae06653f..820ec8dd08dff6cec68e14ea208cbade99a0abdf 100644 (file)
@@ -11,7 +11,8 @@
  * This file is the property of the Digital Music Network (DMN).
  * It is being made available to users of the PostgreSQL system
  * under the BSD license.
- *
+ * 
+ * NOTE: This module requires sizeof(void *) to be the same as sizeof(int)
  */
 #include "postgres.h"
 
@@ -37,6 +38,9 @@
 #include "utils/lsyscache.h"
 
 
+/* Uncomment this define if you are compiling for postgres 7.2.x */
+/* #define PG_7_2 */
+
 /* This is actually a postgres version of a one dimensional array */
 
 typedef struct
@@ -96,7 +100,9 @@ static PGARRAY * GetPGArray(int4 state, int fAdd)
                p->a.size = cb;
                p->a.ndim = 0;
                p->a.flags = 0;
+#ifndef PG_7_2
                p->a.elemtype = INT4OID;
+#endif
                p->items = 0;
                p->lower= START_NUM;
        }
@@ -149,7 +155,9 @@ static PGARRAY *ShrinkPGArray(PGARRAY *p)
                        pnew->a.size = cb;
                        pnew->a.ndim=1;
                        pnew->a.flags = 0;
+#ifndef PG_7_2
                        pnew->a.elemtype = INT4OID;
+#endif
                        pnew->lower = 0;
                }
                else
index e08324aead1665e76b12a05af710d35b416a5719..fcba720f32d849ab6a6c7b31c7b87111b146e939 100644 (file)
@@ -1,7 +1,7 @@
 -- Drop functions
+drop aggregate int_array_aggregate(int4);
 drop function int_agg_state (int4, int4);
 drop function int_agg_final_array (int4);
-drop aggregate int_array_aggregate(int4);
 drop function int_array_enum (int4[]);
 
 
@@ -9,14 +9,14 @@ drop function int_array_enum (int4[]);
 -- Is called for each item in an aggregation
 create function int_agg_state (int4, int4)
        returns int4
-       as 'MODULE_FILENAME','int_agg_state'
+       as 'MODULE_PATHNAME','int_agg_state'
        language 'c';
 
 -- Internal function for the aggregate
 -- Is called at the end of the aggregation, and returns an array.
 create function int_agg_final_array (int4)
        returns int4[]
-       as 'MODULE_FILENAME','int_agg_final_array'
+       as 'MODULE_PATHNAME','int_agg_final_array'
        language 'c';
 
 -- The aggration funcion.
@@ -35,6 +35,6 @@ create aggregate int_array_aggregate
 -- as a row.
 create function int_array_enum(int4[])
        returns setof integer
-       as 'MODULE_FILENAME','int_enum'
+       as 'MODULE_PATHNAME','int_enum'
        language 'c';