postgresql/src/test/regress
Tom Lane 628cbb50ba Re-implement extraction of fixed prefixes from regular expressions.
To generate btree-indexable conditions from regex WHERE conditions (such as
WHERE indexed_col ~ '^foo'), we need to be able to identify any fixed
prefix that a regex might have; that is, find any string that must be a
prefix of all strings satisfying the regex.  We used to do that with
entirely ad-hoc code that looked at the source text of the regex.  It
didn't know very much about regex syntax, which mostly meant that it would
fail to identify some optimizable cases; but Viktor Rosenfeld reported that
it would produce actively wrong answers for quantified parenthesized
subexpressions, such as '^(foo)?bar'.  Rather than trying to extend the
ad-hoc code to cover this, let's get rid of it altogether in favor of
identifying prefixes by examining the compiled form of a regex.

To do this, I've added a new entry point "pg_regprefix" to the regex library;
hopefully it is defined in a sufficiently general fashion that it can remain
in the library when/if that code gets split out as a standalone project.

Since this bug has been there for a very long time, this fix needs to get
back-patched.  However it depends on some other recent commits (particularly
the addition of wchar-to-database-encoding conversion), so I'll commit this
separately and then go to work on back-porting the necessary fixes.
2012-07-10 14:54:37 -04:00
..
data Fix GIN to support null keys, empty and null items, and full index scans. 2011-01-07 19:16:24 -05:00
expected Re-implement extraction of fixed prefixes from regular expressions. 2012-07-10 14:54:37 -04:00
input Fix error message for COMMENT/SECURITY LABEL ON COLUMN xxx IS 'yyy' 2012-05-22 11:23:36 -04:00
output Reduce messages about implicit indexes and sequences to DEBUG1. 2012-07-04 20:35:29 -04:00
sql Re-implement extraction of fixed prefixes from regular expressions. 2012-07-10 14:54:37 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
GNUmakefile pg_regress: Use target-specific variable instead of overriding make rule 2012-02-07 22:42:19 +02:00
Makefile
parallel_schedule Fix regex back-references that are directly quantified with *. 2012-02-20 00:52:33 -05:00
pg_regress_main.c pg_regress: Replace exit_nicely() with exit() plus atexit() hook 2012-01-02 22:09:25 +02:00
pg_regress.c Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
pg_regress.h pg_regress: Replace exit_nicely() with exit() plus atexit() hook 2012-01-02 22:09:25 +02:00
regress.c Redesign the plancache mechanism for more flexibility and efficiency. 2011-09-16 00:43:52 -04:00
regressplans.sh
resultmap Enable compiling with the mingw-w64 32 bit compiler. 2011-12-10 15:35:41 -05:00
serial_schedule Fix regex back-references that are directly quantified with *. 2012-02-20 00:52:33 -05:00
standby_schedule Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00