spgist-pattern-match.patch
application/octet-stream
Filename: spgist-pattern-match.patch
Type: application/octet-stream
Part: 0
Message:
Re: spgist text_ops and LIKE
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/backend/optimizer/path/indxpath.c | 3 | 1 |
| src/include/catalog/pg_opfamily.h | 1 | 0 |
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index d51e84a..82af494 100644
--- a/src/backend/optimizer/path/indxpath.c
+++ b/src/backend/optimizer/path/indxpath.c
@@ -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;
diff --git a/src/include/catalog/pg_opfamily.h b/src/include/catalog/pg_opfamily.h
index 7b962df..3dcc746 100644
--- a/src/include/catalog/pg_opfamily.h
+++ b/src/include/catalog/pg_opfamily.h
@@ -144,6 +144,7 @@ DATA(insert OID = 3903 ( 405 range_ops PGNSP PGUID ));
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 ));
+#define TEXT_SPGIST_FAM_OID 4017
DATA(insert OID = 4017 ( 4000 text_ops PGNSP PGUID ));
#endif /* PG_OPFAMILY_H */