Wrong order of custom fields - using Postgres

Hi,

After migrating from MySQL to Postgres, I’ve just found that custom fields
are not sorted by their queue sort order in Ticket/Display.html.

Instead, they are sorted by the CustomField id.

CustomFields_Overlay.pm even has a comment at the bottom “This doesn’t work
on postgres”.

It seems that the SQL query being issued by RT doesn’t work in Postgres:

SELECT main.* FROM

( SELECT main.id FROM CustomFields main JOIN ObjectCustomFields
ObjectCustomFields_1

            ON ( ObjectCustomFields_1.CustomField = main.id )  

            WHERE                 (main.Disabled = '0') AND 

                            (ObjectCustomFields_1.ObjectId = '1' OR

ObjectCustomFields_1.ObjectId = ‘0’) AND

                            (main.LookupType = 'RT::Queue-RT::Ticket')


            GROUP BY main.id   

            ORDER BY min(ObjectCustomFields_1.ObjectId) ASC, 

                             min(ObjectCustomFields_1.SortOrder) ASC  

) distinctquery, CustomFields main WHERE (main.id = distinctquery.id);

(The inner SELECT query produces the correct order, but the outer SELECT
query changes the order).

Using RT 3.6.6 with Postgres 8.3.0 on OpenSuSE 10.3.

Does anyone know if this problem is fixed in some new version of
RT/Postgres/DBIx::SearchBuilder?

Has anyone implemented a workaround in RT to re-sort the output manually?

Thanks,

Eynat