Red Hat Bugzilla – Bug 486142
New new custom field type FIELD_TYPE_INTEGER for proper checking of integer values
Last modified: 2013-06-23 22:18:29 EDT
+++ This bug was initially created as a clone of Bug #486036 +++
Description of problem:
The custom field called 'cf_pm_score' is created in the database as a freetext field type (varchar) and even though it only contains integer values it is not sorted correctly by numerical order. Therefore you get results such as:
Changing to the column type in the database for bugs.cf_pm_score to INTEGER does fix the sorting issue but is not optimal as anything other than an integer entered there will cause a database error to occur.
Another fix is to hack Bugzilla/Search to alter the ORDER BY clause to do a type conversion on the fly of the cf_pm_score data to integer allowing the order by to work numerically.
I have a patch that does the latter and works well.
--- Additional comment from email@example.com on 2009-02-17 18:13:26 EDT ---
Created an attachment (id=332312)
Patch to hack the order by for cf_pm_score to sort numerically (v1)
Patch to hack the order by for cf_pm_score to sort numerically.
--- Additional comment from firstname.lastname@example.org on 2009-02-18 00:00:17 EDT ---
(From update of attachment 332312 [details])
Hey Dave, I tested the patch on bz-web2 and works good.
--- Additional comment from email@example.com on 2009-02-18 11:09:41 EDT ---
definitely a hack.
Riek or Subhendu can confirm but AIUI this field will always be integer. Can we take a copy of the data, drop the custom field and re-add it as an int cf?
Bill Peck is hitting a simliar issue in beaker.
--- Additional comment from firstname.lastname@example.org on 2009-02-18 11:26:11 EDT ---
(In reply to comment #3)
> definitely a hack.
> Riek or Subhendu can confirm but AIUI this field will always be integer. Can we
> take a copy of the data, drop the custom field and re-add it as an int cf?
> Bill Peck is hitting a simliar issue in beaker.
I agree but if I change the column to INT and someone per chance enters something with alpha character in it, the code currently thinks the columns is a varchar type which will produce a nasty DB error.
I would rather take the time do this right in another bug that creates a new FIELD_TYPE_INTEGER that has the proper sanity checks before inserting/updating the data in the db. Currently the code will still think that the column is a FIELD_TYPE_FREETEXT.
This order by hack will get his reports working until we can add the new functionality and properly convert the cf_pm_score over to FIELD_TYPE_INTEGER.
NOTE: Bugzilla 3.4 (not yet released) will have support for two new field types.
FIELD_TYPE_BUG_ID (INT3) and FIELD_TYPE_BUG_URLS (multiple value). We will be able to exploit the FIELD_TYPE_BUG_ID as cf_pm_score. We will need to create a script to migrate the existing cf_pm_score values to the new field once we have it created.
Red Hat Bugzilla is now using version 3.4 of the Bugzilla codebase and
therefore this feature will need to be implemented against the new release.
Updating bug version to 3.2.
Red Hat has now upgraded to Bugzilla 3.6 and this bug will now be reassigned to that version. It would be helpful to the Bugzilla Development Team if this bug is verified to still be an issue with the latest version. If it is no longer an issue, then feel free to close, otherwise please comment that it is still a problem and we will try to address the issue as soon as we can.
Bugzilla Development Team
As part of the recent Bugzilla 2.4 upgrade the Bugzilla team are cleaning up bugs opened against old versions of Bugzilla. This bug has been flagged as an old bug and will be CLOSED WONTFIX in 7 days time.
If you believe this bug is an issue in the latest Bugzilla version please comment on this bug within 7 days. Doing so will ensure this bug is not closed automatically.
Thanks, the Bugzilla team.
As noted previously, the Bugzilla Team is cleaning up a large number of outstanding issues that have bit rotted. This bug is being closed as there has been no response to that notification.
If you believe this bug is still important please reopen this bug in the NEW status and PM will consider it.