Bug 1251838

Summary: ILIKE fails for numeric fields
Product: [Community] Bugzilla Reporter: Jeff Fearn 🐞 <jfearn>
Component: WebServiceAssignee: Matt Tyson 🤬 <mtyson>
Status: CLOSED CURRENTRELEASE QA Contact: Rony Gong 🔥 <qgong>
Severity: high Docs Contact:
Priority: high    
Version: 4.4CC: jmcdonal, mtahir, qgong
Target Milestone: 4.4   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-09-20 23:29:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jeff Fearn 🐞 2015-08-10 06:23:28 UTC
Description of problem:
Some searches are failing because Pg is using ILIKE for numeric fields.

Version-Release number of selected component (if applicable):
Pg

How reproducible:
not sure

Steps to Reproduce:
1. not sure, but Matt knows


Actual results:
[2015/08/10 04:45:39.2172389] [bugzilla-qe-06.host.stage.eng.rdu2.redhat.com;35918] [ERROR] [/var/www/html/bugzilla/buglist.cgi:10.8.64.15::381777:ATest ...@perftest.com] [Bugzilla::Error::ThrowCodeError /var/www/html/bugzilla/Bugzilla/Error.pm (176)] - ThrowCodeError: $VAR1 = 'db_error';
$VAR2 = {
          'traceback' => ' at /var/www/html/bugzilla/Bugzilla/DB.pm line 194
        Bugzilla::DB::_handle_error(...) called at /var/www/html/bugzilla/Bugzilla/Search.pm line 831
        Bugzilla::Search::data(...) called at /var/www/html/bugzilla/buglist.cgi line 773
        ModPerl::ROOT::Bugzilla::ModPerl::ResponseHandler::var_www_html_bugzilla_buglist_2ecgi::handler(...) called at /usr/lib64/perl5/vendor_perl/ModPerl/RegistryCooker.pm line 204
        eval {...} called at /usr/lib64/perl5/vendor_perl/ModPerl/RegistryCooker.pm line 204
        ModPerl::RegistryCooker::run(...) called at /usr/lib64/perl5/vendor_perl/ModPerl/RegistryCooker.pm line 170
        ModPerl::RegistryCooker::default_handler(...) called at /usr/lib64/perl5/vendor_perl/ModPerl/Registry.pm line 31
        ModPerl::Registry::handler(...) called at /var/www/html/bugzilla/mod_perl.pl line 134
        Bugzilla::ModPerl::ResponseHandler::handler(...) called at -e line 0
        eval {...} called at -e line 0
',
          'err_message' => 'DBD::Pg::db selectcol_arrayref failed: ERROR:  operator does not exist: integer ~~* text
LINE 13:    AND (bugs.bug_id  ILIKE \'%1062538%\' ESCAPE \'|\' AND bugs.b...
                              ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts. [for Statement "SELECT bugs.bug_id AS bug_id, bugs.priority AS priority, bugs.cf_type AS cf_type
  FROM bugs
LEFT JOIN bug_group_map AS security_map ON bugs.bug_id = security_map.bug_id
LEFT JOIN cc AS security_cc ON bugs.bug_id = security_cc.bug_id AND security_cc.who = 381777
INNER JOIN priority AS map_priority ON bugs.priority = map_priority.value
INNER JOIN cf_type AS map_cf_type ON bugs.cf_type = map_cf_type.value
 WHERE bugs.creation_ts IS NOT NULL
   AND ( (security_map.group_id IS NULL OR security_map.group_id IN (7,94,147,76,68,144,291,15,146,123,122,12,106,150,243,41,85,287,92,50,83,21,183,79,81,133,182,192,25,75,148,249,91,108,119,145,218,124,149,161,142,140,80,44,215,127,22,139,138,78,126,93,48,217,208,209,74,121))
        OR (bugs.reporter_accessible = 1 AND bugs.reporter = 381777)
        OR (bugs.cclist_accessible = 1 AND security_cc.who IS NOT NULL)
        OR bugs.assigned_to = 381777
        OR bugs.qa_contact = 381777        OR bugs.docs_contact = 381777)
   AND (bugs.bug_id  ILIKE \'%1062538%\' ESCAPE \'|\' AND bugs.bug_id::text ~* \'(^|[^[:alnum:]])1062538($|[^[:alnum:]])\') AND  bugs.bug_id NOT IN (226936,647838,1029561,448504,678395,1130896,1110755,953428,519630,585358,1199854,585114,922868,916046,833330,197636,508752,868140,984914,675781,591407,673145,1100588,953626,1208145,845055,996091,1133399,749760,632598,853297,444111,116457,703231,741167,1145371,445589,512994,580211,1035156,863310,1029840,989723,221456,534178,219167,1068993,1180052,1091136,883797,767061,782064,1124660,846531,1096943,1052814,812358,583120,555689,833620,253057,632206,995339,675975,870118,1035024,784223,563083,476606,1169184,797104,217547,252444,921775,748390,1105236,1106340,1028736, ... 0099,483266,1132821,166537,1066243,543618,683827,721194,971406,598064,1126678,668737,1107932,1155648,1195601,796067,802737,965229,429399,434789,582074,507864,139827,786970,198789,249076,790195,1191721,1028290,230030,698170,1152233,243189,248100,740294,1036087,1034120,234084,1101496,238143,801709,223884,963163,253671,249453,834354,481209,513712,217909,363661,139802,585910,544142,818478,456643,950535,1169598,526686,1182929,240609,246006,816739,415891,1069163,674741,491842,518689,1137523,109029,1036938,947662,709150,813682,571368,224322,1153001,1155015,124690,794925,589456,223828,918754,760001,753756,1127071,1180124,568750,1057474,597077,1111457,772164,1149580,316791,508919,1186094,469856,618560,1120327,1173784,467483,1061758,1194119,103144,747555,987230,1099841,736884,783043,982472,1102981,1088055,244873,122931,846125,540582,1079746,727767,488566,973005,760446,860874,836554,923914,485308,827050,1075851,1065832,223911,556586,475853,642382,906205,239286,1211291,1148699,1056242,769118,681867,426015,627886,1150344,611696,729148,853304,1138650,829784,240860,289421,827282,240131,428104,541505,180584,747875,816508,1188116,251609,1150907,1150341,484168,831877,493783,456132,221127,903429,1013668,708391,965109,696579,1014943,1216230,145092,1182378,663537,852910,195607,475457,839484,526830,846905,1204016,104636,1036233,955281,481708,221676,1078641,1173504,1085532,582317,1121590,1019031,629857,783401,438500,114635,544200,884951,591441,1186636,1131357,920804,989577,238034,237570,1058700,627117,824283,844882,1178982,632499,698530,738565,736667,811324,962372,243866,747169,837974,895824,1078056,582066,1148957,475456,697487,195537,1207531,195339,1171268,494463,1113586,1084249,1141773,1084303,478995,968231,529935,184120,1051272,829181,910192,892453) 
GROUP BY bugs.bug_id, bugs.priority,bugs.cf_type,map_priority.sortkey,map_priority.value,map_cf_type.sortkey,map_cf_type.value
ORDER BY map_priority.sortkey, map_priority.value, map_cf_type.sortkey, map_cf_type.value, bug_id
LIMIT 20000
"] at /var/www/html/bugzilla/Bugzilla/Search.pm line 831
        Bugzilla::Search::data(\'Bugzilla::Search=HASH(0x7effc6967ed0)\') called at /var/www/html/bugzilla/buglist.cgi line 773
        ModPerl::ROOT::Bugzilla::ModPerl::ResponseHandler::var_www_html_bugzilla_buglist_2ecgi::handler(\'Apache2::RequestRec=SCALAR(0x7effc039c630)\') called at /usr/lib64/perl5/vendor_perl/ModPerl/RegistryCooker.pm line 204
        eval {...} called at /usr/lib64/perl5/vendor_perl/ModPerl/RegistryCooker.pm line 204
        ModPerl::RegistryCooker::run(\'Bugzilla::ModPerl::ResponseHandler=HASH(0x7effc699ff90)\') called at /usr/lib64/perl5/vendor_perl/ModPerl/RegistryCooker.pm line 170
        ModPerl::RegistryCooker::default_handler(\'Bugzilla::ModPerl::ResponseHandler=HASH(0x7effc699ff90)\') called at /usr/lib64/perl5/vendor_perl/ModPerl/Registry.pm line 31
        ModPerl::Registry::handler(\'Bugzilla::ModPerl::ResponseHandler\', \'Apache2::RequestRec=SCALAR(0x7effc039c630)\') called at /var/www/html/bugzilla/mod_perl.pl line 134
        Bugzilla::ModPerl::ResponseHandler::handler(\'Bugzilla::ModPerl::ResponseHandler\', \'Apache2::RequestRec=SCALAR(0x7effc039c630)\') called at -e line 0
        eval {...} called at -e line 0
'
        };


Expected results:
Working searches

Additional info:

Comment 1 Rony Gong 🔥 2015-08-11 03:28:25 UTC
Reproduce steps:
1. Do quick search with:  bug_id:1

Comment 2 Rony Gong 🔥 2015-08-14 09:01:49 UTC
Tested on 
QA environment(bzweb01-qe) with version(4.4.9039-1, DB: mysql)
QA environment(bzperfweb01.app.qa) with version(4.4.9039-1, DB: psql )
Result: Pass
Steps:
1. Do quick search with:  bug_id:1
==>It could search out bugs without exception.

Comment 3 Matt Tyson 🤬 2015-09-20 23:29:25 UTC
This change is now live. If there are any issues, do not reopen this bug.
Instead, you should create a new bug and reference this bug.