summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkanat%kerio.com <>2005-07-08 11:34:03 +0200
committermkanat%kerio.com <>2005-07-08 11:34:03 +0200
commit0811ac92bf752121208867728aa4629b9eb9c02a (patch)
tree730552d2c127f5992639e3852eeea105e1e7c71a
parent4f25eedf9065f28badf1e5e1df6c925062d8279e (diff)
downloadbugzilla-0811ac92bf752121208867728aa4629b9eb9c02a.tar.gz
bugzilla-0811ac92bf752121208867728aa4629b9eb9c02a.tar.xz
Bug 292119: [PostgreSQL] POSITION(...) clause "must be type boolean, not type integer"
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=dkl, a=justdave
-rw-r--r--Bugzilla/Search.pm8
-rw-r--r--Bugzilla/User.pm12
-rwxr-xr-xchecksetup.pl4
3 files changed, 12 insertions, 12 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index f0bc0b6fe..e69c3232f 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -988,10 +988,10 @@ sub init {
$term = "$ff != $q";
},
",casesubstring" => sub {
- $term = $dbh->sql_position($q, $ff);
+ $term = $dbh->sql_position($q, $ff) . " > 0";
},
",substring" => sub {
- $term = $dbh->sql_position(lc($q), "LOWER($ff)");
+ $term = $dbh->sql_position(lc($q), "LOWER($ff)") . " > 0";
},
",substr" => sub {
$funcsbykey{",substring"}->();
@@ -1466,7 +1466,7 @@ sub ListIDsForEmail {
} elsif ($type eq 'substring') {
&::SendSQL("SELECT userid FROM profiles WHERE " .
$dbh->sql_position(lc(::SqlQuote($email)), "LOWER(login_name)") .
- " " . $dbh->sql_limit(51));
+ " > 0 " . $dbh->sql_limit(51));
while (&::MoreSQLData()) {
my ($id) = &::FetchSQLData();
push(@list, $id);
@@ -1522,7 +1522,7 @@ sub GetByWordListSubstr {
foreach my $word (split(/[\s,]+/, $strs)) {
if ($word ne "") {
push(@list, $dbh->sql_position(lc(::SqlQuote($word)),
- "LOWER($field)"));
+ "LOWER($field)") . " > 0");
}
}
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index 0c2de0f4c..c9817a4d9 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -682,18 +682,18 @@ sub match {
&& (length($str) >= 3))
{
- my $sqlstr = &::SqlQuote(uc($str));
+ my $sqlstr = &::SqlQuote(lc($str));
- my $query = "SELECT DISTINCT userid, realname, login_name, " .
+ my $query = "SELECT DISTINCT userid, realname, login_name, " .
"LENGTH(login_name) AS namelength " .
"FROM profiles";
if (&::Param('usevisibilitygroups')) {
$query .= ", user_group_map";
}
- $query .= " WHERE " . $dbh->sql_position($sqlstr,
- "UPPER(login_name)") .
- " OR " . $dbh->sql_position($sqlstr,
- "UPPER(realname)");
+ $query .= " WHERE " .
+ $dbh->sql_position($sqlstr, 'LOWER(login_name)') . " > 0" .
+ " OR " .
+ $dbh->sql_position($sqlstr, 'LOWER(realname)') . " > 0";
if (&::Param('usevisibilitygroups')) {
$query .= " AND user_group_map.user_id = userid" .
" AND isbless = 0" .
diff --git a/checksetup.pl b/checksetup.pl
index 42582fa65..176ad463c 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -3687,8 +3687,8 @@ if ($dbh->isa('Bugzilla::DB::Mysql')
print "Removing paths from filenames in attachments table...\n";
$sth = $dbh->prepare("SELECT attach_id, filename FROM attachments " .
- "WHERE " . $dbh->sql_position(q{'/'}, 'filename') .
- " OR " . $dbh->sql_position(q{'\\\\'}, 'filename'));
+ "WHERE " . $dbh->sql_position(q{'/'}, 'filename') . " > 0 OR " .
+ $dbh->sql_position(q{'\\\\'}, 'filename') . " > 0");
$sth->execute;
while (my ($attach_id, $filename) = $sth->fetchrow_array) {