postgresql/src
Tom Lane 2ddedcafca Reduce match_pattern_prefix()'s dependencies on index opfamilies.
Historically, the planner's LIKE/regex index optimizations were only
carried out for specific index opfamilies.  That's never been a great
idea from the standpoint of extensibility, but it didn't matter so
much as long as we had no practical way to extend such behaviors anyway.
With the addition of planner support functions, and in view of ongoing
work to support additional table and index AMs, it seems like a good
time to relax this.

Hence, recast the decisions in match_pattern_prefix() so that rather
than decide which operators to generate by looking at what the index
opfamily contains, we decide which operators to generate a-priori
and then see if the opfamily supports them.  This is much more
defensible from a semantic standpoint anyway, since we know the
semantics of the chosen operators precisely, and we only need to
assume that the opfamily correctly implements operators it claims
to support.

The existing "pattern" opfamilies put a crimp in this approach, since
we need to select the pattern operators if we want those to work.
So we still have to special-case those opfamilies.  But that seems
all right, since in view of the addition of collations, the pattern
opfamilies seem like a legacy hack that nobody will be building on.

The only immediate effect of this change, so far as the core code is
concerned, is that anchored LIKE/regex patterns can be mapped onto
BRIN index searches, and exact-match patterns can be mapped onto hash
indexes, not only btree and spgist indexes as before.  That's not a
terribly exciting result, but it does fix an omission mentioned in
the ancient comments here.

Note: no catversion bump, even though this touches pg_operator.dat,
because it's only adding OID macros not changing the contents of
postgres.bki.

Per consideration of a report from Manuel Rigger.

Discussion: https://postgr.es/m/CA+u7OA7nnGYy8rY0vdTe811NuA+Frr9nbcBO9u2Z+JxqNaud+g@mail.gmail.com
2019-11-20 14:13:04 -05:00
..
backend Reduce match_pattern_prefix()'s dependencies on index opfamilies. 2019-11-20 14:13:04 -05:00
bin Add the support for '-f' option in dropdb utility. 2019-11-20 08:25:07 +05:30
common Make StringInfo available to frontend code. 2019-11-05 14:56:40 -08:00
fe_utils Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
include Reduce match_pattern_prefix()'s dependencies on index opfamilies. 2019-11-20 14:13:04 -05:00
interfaces Fix ecpglib.h to declare bool consistently with c.h. 2019-11-12 13:00:04 -05:00
makefiles Select CFLAGS_SL at configure time, not in platform-specific Makefiles. 2019-10-21 12:32:35 -04:00
pl Have LookupFuncName accept NULL argtypes for 0 args 2019-11-12 17:06:58 -03:00
port Handle ReadFile() EOF correctly on Windows. 2019-11-20 18:29:37 +13:00
template Select CFLAGS_SL at configure time, not in platform-specific Makefiles. 2019-10-21 12:32:35 -04:00
test Fix corner-case failure in match_pattern_prefix(). 2019-11-19 17:03:34 -05:00
timezone Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
tools Fix ecpglib.h to declare bool consistently with c.h. 2019-11-12 13:00:04 -05:00
tutorial Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
.gitignore
DEVELOPERS
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Select CFLAGS_SL at configure time, not in platform-specific Makefiles. 2019-10-21 12:32:35 -04:00
Makefile.shlib Clean up MinGW def file generation 2019-10-20 10:19:13 +02:00
nls-global.mk NLS: Fix backend gettext triggers 2019-09-23 09:04:20 +02:00