When I do a search for a ticket subject or content, RT queries PostgreSQL using the ILIKE operator and returns results on case-insensitive basis. However, when I search for a custom field, RT queries the database using the LIKE operator and returns results on a case-sensitive basis.<br>
<br>I've enabled the option log_statement = 'all' in postgresql.conf and see the following output in postgresql-8.3-main.log.<br><br>Here is sample output from a search on ticket subject:<br><br>LOG: statement: SELECT COUNT(DISTINCT <a href="http://main.id">main.id</a>) FROM Tickets main JOIN Transactions Transactions_1 ON ( Transactions_1.ObjectId = <a href="http://main.id">main.id</a> ) JOIN Attachments Attachments_2 ON ( Attachments_2.TransactionId = Transactions_1.id ) WHERE (Transactions_1.ObjectType = 'RT::Ticket') AND (main.Status != 'deleted') AND ( ( ( Attachments_2.Content ILIKE '%searchterm%' ) ) ) AND (main.Type = 'ticket') AND (main.EffectiveId = <a href="http://main.id">main.id</a>)<br>
<br>Here is sample output from a search on a custom field:<br><br>LOG: statement: SELECT COUNT(DISTINCT <a href="http://main.id">main.id</a>) FROM Tickets main JOIN ObjectCustomFieldValues ObjectCustomFieldValues_1 ON ( ObjectCustomFieldValues_1.CustomField = '1' ) AND ( ObjectCustomFieldValues_1.ObjectType = 'RT::Ticket' ) AND ( ObjectCustomFieldValues_1.Disabled = '0' ) AND ( ObjectCustomFieldValues_1.ObjectId = <a href="http://main.id">main.id</a> ) WHERE (main.Status != 'deleted') AND ( ( ( ( ( ObjectCustomFieldValues_1.Content LIKE '%searchterm%' OR ( ( ObjectCustomFieldValues_1.Content = '' OR ObjectCustomFieldValues_1.Content IS NULL ) AND ObjectCustomFieldValues_1.LargeContent LIKE '%searchterm%' ) ) ) ) ) ) AND (main.Type = 'ticket') AND (main.EffectiveId = <a href="http://main.id">main.id</a>)<br clear="all">
<br>Is this a bug or expected results? I'd really like to have case-insensitive search on CFs.<br><br>Thanks RT!<br><br>-- <br>...................<br>Adam Tingle<br><br>