[Rt-devel] can't search for nulls in custom fields

seph seph at directionless.org
Thu Mar 24 19:17:02 EST 2005


I'm pretty sure is a bug, and I'm pretty sure it's a regression. I
can't manage to search for things that don't have a set custom field.

For example, we have a release notes custom field. we can search on
things like 'CF.{Release Notes}' IS 'Needed', but I can't search for
'CF.{Release Notes}' IS 'NULL' despite if being a choice on the
pulldown. The search always results in no tickets.

Looking at a couple of tickets, #3730 has the custom field set, and
#208 does not.

The generate sql query is:

SELECT DISTINCT main.* FROM ((Tickets main  LEFT JOIN ObjectCustomFieldValues ObjectCustomFieldValues_1  ON ((ObjectCustomFieldValues_1.ObjectType = 'RT::Ticket')) AND( (ObjectCustomFieldValues_1.Disabled = '0')) AND(  main.id = ObjectCustomFieldValues_1.ObjectId))  JOIN CustomFields CustomFields_2  ON ( ObjectCustomFieldValues_1.CustomField = CustomFields_2.id) AND( (CustomFields_2.Name = 'Category')))   WHERE ((main.EffectiveId = main.id)) AND ((main.Status != 'deleted')) AND ((main.Type = 'ticket')) AND ((main.Queue = '5')AND(ObjectCustomFieldValues_1.Content LIKE '%NULL%'))


If I replace that WHERE clause with (main.id=3730) I get the info for
the single ticket. If I replace it with (main.id=208), I get an empty
set. I assume this is because it's trying to join
ObjectCustomFieldValues, and there's no entry for #208 in there. 

Anyone seen this? Any ideas? I do see it on the head (that's up on
rt3.fsck.com)

seph


More information about the Rt-devel mailing list