Please apply attached patch to contrib/intarray (7.2, 7.3).
authorBruce Momjian <[email protected]>
Fri, 7 Jun 2002 21:53:09 +0000 (21:53 +0000)
committerBruce Momjian <[email protected]>
Fri, 7 Jun 2002 21:53:09 +0000 (21:53 +0000)
     Fixed bug with '=' operator for gist__int_ops and
     define '=' operator for gist__intbig_ops opclass.
     Now '=' operator is consistent with standard 'array' type.

     Thanks Achilleus Mantzios for bug report and suggestion.

Oleg Bartunov

contrib/intarray/_int.c
contrib/intarray/_int.sql.in

index 35ee7a659e2328c6614590e784069a6df415e0b0..17e3fed4704c3f239f18c8a8bcddd15536e38c53 100644 (file)
@@ -312,6 +312,17 @@ g_int_consistent(PG_FUNCTION_ARGS) {
                                                                           query);
                        break;
                case RTSameStrategyNumber:
+                       if ( GIST_LEAF(entry) )
+                               DirectFunctionCall3(
+                                       g_int_same,
+                                       entry->key,
+                                       PointerGetDatum(query),
+                                       PointerGetDatum(&retval)
+                               );
+                       else
+                               retval = inner_int_contains((ArrayType *) DatumGetPointer(entry->key),
+                                                                               query);
+                       break;
                case RTContainsStrategyNumber:
                        retval = inner_int_contains((ArrayType *) DatumGetPointer(entry->key),
                                                                                query);
@@ -1263,6 +1274,16 @@ g_intbig_consistent(PG_FUNCTION_ARGS) {
                        retval = _intbig_overlap((ArrayType *) DatumGetPointer(entry->key), q);
                        break;
                case RTSameStrategyNumber:
+                       if ( GIST_LEAF(entry) )
+                               DirectFunctionCall3(
+                                       g_intbig_same,
+                                       entry->key,
+                                       PointerGetDatum(q),
+                                       PointerGetDatum(&retval)
+                               );
+                       else
+                               retval = _intbig_contains((ArrayType *) DatumGetPointer(entry->key), q);
+                       break;
                case RTContainsStrategyNumber:
                        retval = _intbig_contains((ArrayType *) DatumGetPointer(entry->key), q);
                        break;
index 61f2cbd3f6f32b0a05dd84367e9ae515cab0b546..40f5f58950da52a8297272ea217adef71a495b5b 100644 (file)
@@ -177,7 +177,7 @@ INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr)
 
 -- _int_same
 INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr)
-   SELECT opcl.oid, 6, false, c.opoid
+   SELECT opcl.oid, 6, true, c.opoid
    FROM pg_opclass opcl, _int_ops_tmp c
    WHERE
       opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
@@ -350,6 +350,15 @@ INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr)
       and opcname = 'gist__intbig_ops' 
       and c.oprname = '~';
 
+-- _int_same
+INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr)
+   SELECT opcl.oid, 6, true, c.opoid
+   FROM pg_opclass opcl, _int_ops_tmp c
+   WHERE
+      opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
+      and opcname = 'gist__intbig_ops' 
+      and c.oprname = '=';
+
 --boolean search
 INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr)
    SELECT opcl.oid, 20, true, c.opoid