]> granicus.if.org Git - postgresql/commit
Support indexing of regular-expression searches in contrib/pg_trgm.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 9 Apr 2013 05:05:55 +0000 (01:05 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 9 Apr 2013 05:06:54 +0000 (01:06 -0400)
commit3ccae48f44d993351e1f881761bd6c556ebd6638
treeec365a856f56aae32745644164d0a8b5889ee5fd
parente60d20a35e436cef3c454bfeab34d8ea71b54910
Support indexing of regular-expression searches in contrib/pg_trgm.

This works by extracting trigrams from the given regular expression,
in generally the same spirit as the previously-existing support for
LIKE searches, though of course the details are far more complicated.

Currently, only GIN indexes are supported.  We might be able to make
it work with GiST indexes later.

The implementation includes adding API functions to backend/regex/
to provide a view of the search NFA created from a regular expression.
These functions are meant to be generic enough to be supportable in
a standalone version of the regex library, should that ever happen.

Alexander Korotkov, reviewed by Heikki Linnakangas and Tom Lane
17 files changed:
contrib/pg_trgm/Makefile
contrib/pg_trgm/expected/pg_trgm.out
contrib/pg_trgm/pg_trgm--1.0--1.1.sql [new file with mode: 0644]
contrib/pg_trgm/pg_trgm--1.1.sql [moved from contrib/pg_trgm/pg_trgm--1.0.sql with 95% similarity]
contrib/pg_trgm/pg_trgm.control
contrib/pg_trgm/sql/pg_trgm.sql
contrib/pg_trgm/trgm.h
contrib/pg_trgm/trgm_gin.c
contrib/pg_trgm/trgm_op.c
contrib/pg_trgm/trgm_regexp.c [new file with mode: 0644]
doc/src/sgml/pgtrgm.sgml
src/backend/regex/Makefile
src/backend/regex/README
src/backend/regex/regexport.c [new file with mode: 0644]
src/backend/utils/adt/selfuncs.c
src/include/mb/pg_wchar.h
src/include/regex/regexport.h [new file with mode: 0644]