Subject: | PostgreSQL special RE characters can cause failure |
A search with PostgreSQL for terms like:
dog ++\;
May cause failure. The attached patch fixes it, probably in a
PostgreSQL-specific way.
If someone can help with a possible fix for MySQL, I'll make a release.
Mark
Subject: | keyword.patch |
-- old-alphasite/perllib/SQL/KeywordSearch.pm 2007-06-11 16:50:48.000000000 -0400
+++ new-alphasite/perllib/SQL/KeywordSearch.pm 2007-06-11 16:50:48.000000000 -0400
@@ -166,12 +166,14 @@
$word = "(^|[[:<:]])".$word.'([[:>:]]|$)';
}
push @sql, "lower($columns[$i]) $p{operator} ";
+ # This business with '***=' is a PostgreSQL-specific extension
+ # that makes sure $word gets treated as a string literal, not an RE.
if ($p{interp}) {
- push @sql, "lower(",\$word,")";
+ push @sql, "lower(",\('***='.$word),")";
}
else {
push @sql, "lower(?)\n";
- push @bind, $word;
+ push @bind, '***='.$word;
}
}
push @sql, " ".($p{every_column} ? 'AND' : 'OR' )." " if $i != $#columns;