]> granicus.if.org Git - postgresql/commitdiff
Allow spgist's text_ops to handle pattern-matching operators.
authorRobert Haas <rhaas@postgresql.org>
Thu, 2 Feb 2012 18:10:56 +0000 (13:10 -0500)
committerRobert Haas <rhaas@postgresql.org>
Thu, 2 Feb 2012 18:10:56 +0000 (13:10 -0500)
This was presumably intended to work this way all along, but a few key
bits of indxpath.c didn't get the memo.

Robert Haas and Tom Lane

src/backend/optimizer/path/indxpath.c
src/include/catalog/pg_opfamily.h

index d51e84a80a2ef918a96967d7ec7c52323fa207ef..82af4942965329f87006d71b9ebef7e868898442 100644 (file)
@@ -2847,7 +2847,7 @@ match_special_index_operator(Expr *clause, Oid opfamily, Oid idxcollation,
        /*
         * Must also check that index's opfamily supports the operators we will
         * want to apply.  (A hash index, for example, will not support ">=".)
-        * Currently, only btree supports the operators we need.
+        * Currently, only btree and spgist support the operators we need.
         *
         * Note: actually, in the Pattern_Prefix_Exact case, we only need "=" so a
         * hash index would work.  Currently it doesn't seem worth checking for
@@ -2871,6 +2871,7 @@ match_special_index_operator(Expr *clause, Oid opfamily, Oid idxcollation,
                case OID_TEXT_ICREGEXEQ_OP:
                        isIndexable =
                                (opfamily == TEXT_PATTERN_BTREE_FAM_OID) ||
+                               (opfamily == TEXT_SPGIST_FAM_OID) ||
                                (opfamily == TEXT_BTREE_FAM_OID &&
                                 (pstatus == Pattern_Prefix_Exact ||
                                  lc_collate_is_c(idxcollation)));
@@ -3454,6 +3455,7 @@ prefix_quals(Node *leftop, Oid opfamily, Oid collation,
        {
                case TEXT_BTREE_FAM_OID:
                case TEXT_PATTERN_BTREE_FAM_OID:
+               case TEXT_SPGIST_FAM_OID:
                        datatype = TEXTOID;
                        break;
 
index 7b962dfe3f629e00de7902743416885bdf53e8b3..41ebccccbc1dc67271f8d56dce83317eeaedb17f 100644 (file)
@@ -145,5 +145,6 @@ DATA(insert OID = 3919 (    783             range_ops               PGNSP PGUID ));
 DATA(insert OID = 4015 (       4000    quad_point_ops  PGNSP PGUID ));
 DATA(insert OID = 4016 (       4000    kd_point_ops    PGNSP PGUID ));
 DATA(insert OID = 4017 (       4000    text_ops                PGNSP PGUID ));
+#define TEXT_SPGIST_FAM_OID 4017
 
 #endif   /* PG_OPFAMILY_H */