postgresql/src/backend
Tom Lane 8fc7b07b64 Refactor pattern_fixed_prefix() to avoid dealing in incomplete patterns.
Previously, pattern_fixed_prefix() was defined to return whatever fixed
prefix it could extract from the pattern, plus the "rest" of the pattern.
That definition was sensible for LIKE patterns, but not so much for
regexes, where reconstituting a valid pattern minus the prefix could be
quite tricky (certainly the existing code wasn't doing that correctly).
Since the only thing that callers ever did with the "rest" of the pattern
was to pass it to like_selectivity() or regex_selectivity(), let's cut out
the middle-man and just have pattern_fixed_prefix's subroutines do this
directly.  Then pattern_fixed_prefix can return a simple selectivity
number, and the question of how to cope with partial patterns is removed
from its API specification.

While at it, adjust the API spec so that callers who don't actually care
about the pattern's selectivity (which is a lot of them) can pass NULL for
the selectivity pointer to skip doing the work of computing a selectivity
estimate.

This patch is only an API refactoring that doesn't actually change any
processing, other than allowing a little bit of useless work to be skipped.
However, it's necessary infrastructure for my upcoming fix to regex prefix
extraction, because after that change there won't be any simple way to
identify the "rest" of the regex, not even to the low level of fidelity
needed by regex_selectivity.  We can cope with that if regex_fixed_prefix
and regex_selectivity communicate directly, but not if we have to work
within the old API.  Hence, back-patch to all active branches.
2012-07-09 23:23:02 -04:00
..
access Assorted message style improvements 2012-07-02 21:13:28 +03:00
bootstrap Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
catalog Run updated copyright.pl on HEAD and 9.2 trees, updating the psql 2012-07-06 12:28:18 -04:00
commands Have REASSIGN OWNED work on extensions, too 2012-07-03 15:18:40 -04:00
executor Fix memory leak in ARRAY(SELECT ...) subqueries. 2012-06-21 17:26:13 -04:00
foreign Add GetForeignColumnOptions() to foreign.c, and add some documentation. 2012-03-07 18:20:58 -05:00
lib Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
libpq Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
main Make documentation of --help and --version options more consistent 2012-06-18 02:47:53 +03:00
nodes Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
optimizer Refactor pattern_fixed_prefix() to avoid dealing in incomplete patterns. 2012-07-09 23:23:02 -04:00
parser Prevent CREATE TABLE LIKE/INHERITS from (mis) copying whole-row Vars. 2012-06-30 16:45:27 -04:00
po Translation updates 2011-08-17 14:07:46 +03:00
port Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
postmaster Support Linux's oom_score_adj API as well as the older oom_adj API. 2012-06-13 15:35:52 -04:00
regex Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
replication Always treat a standby returning an an invalid flush location as async 2012-07-04 15:14:57 +02:00
rewrite Prevent CREATE TABLE LIKE/INHERITS from (mis) copying whole-row Vars. 2012-06-30 16:45:27 -04:00
snowball Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
storage Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
tcop Make UtilityContainsQuery recurse until it finds a non-utility Query. 2012-06-27 23:18:37 -04:00
tsearch Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
utils Refactor pattern_fixed_prefix() to avoid dealing in incomplete patterns. 2012-07-09 23:23:02 -04:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
common.mk Call check_keywords.pl in maintainer-check 2012-02-27 13:53:12 +02:00
Makefile Fix incorrect make maintainer-clean rule. 2012-04-07 18:16:50 -04:00
nls.mk Sort file list when creating gettext-files 2011-12-27 20:20:56 +02:00