From 85690a0e1a71d751076066f6093ea5498440f72c Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 3 Jan 2007 22:39:49 +0000 Subject: Fix regex_fixed_prefix() to cope reasonably well with regex patterns of the form '^(foo)$'. Before, these could never be optimized into indexscans. The recent changes to make psql and pg_dump generate such patterns (for \d commands and -t and related switches, respectively) therefore represented a big performance hit for people with large pg_class catalogs, as seen in recent gripe from Erik Jones. While at it, be more paranoid about case-sensitivity checking in multibyte encodings, and fix some other corner cases in which a regex might be interpreted too liberally. --- src/backend/utils/adt/regexp.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/backend/utils/adt/regexp.c') diff --git a/src/backend/utils/adt/regexp.c b/src/backend/utils/adt/regexp.c index cff81b7475e..d999d24f9e6 100644 --- a/src/backend/utils/adt/regexp.c +++ b/src/backend/utils/adt/regexp.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/regexp.c,v 1.56.4.1 2006/04/13 18:01:45 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/regexp.c,v 1.56.4.2 2007/01/03 22:39:49 tgl Exp $ * * Alistair Crooks added the code for the regex caching * agc - cached the regular expressions used - there's a good chance @@ -557,3 +557,12 @@ similar_escape(PG_FUNCTION_ARGS) PG_RETURN_TEXT_P(result); } + +/* + * report whether regex_flavor is currently BASIC + */ +bool +regex_flavor_is_basic(void) +{ + return (regex_flavor == REG_BASIC); +} -- cgit v1.2.3