]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 292119: [PostgreSQL] POSITION(...) clause "must be type boolean, not type integer"
authormkanat%kerio.com <>
Fri, 8 Jul 2005 09:34:03 +0000 (09:34 +0000)
committermkanat%kerio.com <>
Fri, 8 Jul 2005 09:34:03 +0000 (09:34 +0000)
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=dkl, a=justdave

Bugzilla/Search.pm
Bugzilla/User.pm
checksetup.pl

index f0bc0b6feeac0481b62496b3b91b780658e64377..e69c3232f2edb79cb8dc3a8081103cc19bd8bb3b 100644 (file)
@@ -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");
         }
     }
 
index 0c2de0f4c1b8883cba1b8e16c67754f11c157f36..c9817a4d91b42cd5ddaba7c4f5e3ac0abe76c80d 100644 (file)
@@ -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, " .\r
+        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" .
index 42582fa65530d5eb55d3869cd87a7d6495cae303..176ad463c23e3c81007046ea70a2c9e9e1716b04 100755 (executable)
@@ -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) {