Wrong search results for ticket cf which isn't applied to queue

Hi RT developers,

following situation (vanilla RT 4.2.12):

  • create CF Test and apply to queue general
  • create Queue Test
  • create ticket in queue General
  • set CF Test to any value
  • move ticket to queue Test

If you now search for:

Queue = ‘Test’ AND CF.{Test} IS NOT NULL

you will find the previously created ticket.
I’m a bit surprised about that, as the ticket is in Queue Test and CF
Test isn’t applied to this queue.

Looking at the generated SQL:

SELECT main.*
FROM Tickets main
JOIN ObjectCustomFieldValues ObjectCustomFieldValues_1
ON ( ObjectCustomFieldValues_1.CustomField = ‘1’ )
AND ( ObjectCustomFieldValues_1.Disabled = ‘0’ )
AND ( ObjectCustomFieldValues_1.ObjectType = ‘RT::Ticket’ )
AND ( ObjectCustomFieldValues_1.ObjectId = main.id )
WHERE (main.IsMerged IS NULL)
AND (main.Status != ‘deleted’)
AND (main.Type = ‘ticket’)
AND (main.Queue = '3’
AND ( ObjectCustomFieldValues_1.id IS NOT NULL ) )
ORDER BY main.id ASC

shows, that there isn’t any check if the customfield is applied to the
ticket’s queue.

Is this a current limitation or is this a bug?