In the latest version sorting order is changed to "sortfield", but table (view) 
is left the same: "subjectfield".
Probably it should be changed to  "sortfield" too.

else if ( MATCH(key, "subject") ) {
    _append_join(value->table, "subjectfield"); // --> 
_append_join(value->table, "sortfield");
    _append_sort(value->order, "sortfield", reverse);
    (*idx)++;
}

Also according RFC 5256: "If the associated  RFC-822 header for a particular
      criterion is absent, it is treated as the empty string.  The empty
      string always collates before non-empty strings."
But with PostgreSQL as backend db dbmail puts NULL strings always at the end of 
the resulting set.
To fix this we may apply COALESCE function on sortfield:
    _append_sort(value->order, "COALESCE(sortfield, '')", reverse);

It helps to pass imaptest's sort-subject test a bit further.

The only issue left is that PostgreSQL puts header string "_" before all other 
non empty strings, whereas imaptest puts it at the end after all headers in 
test.
I haven't found out how to fix this yet (maybe it's imaptest's issue).
_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail-dev

Reply via email to