I'm working on an app that accesses PostreSQL data (Cocoa/ObjC). I'm not using anybody's framework, I more or less used postgres' C lib and wrote my own class to access the data. The class returns an array of dictionaries, which is usually loaded up in tables and/or text fields. I've just started running into sort problems in the table views. Basically, dates and ints are not sorting as expected (it's not a locale problem). I'm quite certain that the tables aren't sorting right because they're doing a string sort, which would of course be different from doing an actual date or integer sort. I can work around it, but it requires me to hit the database to reload the data using a specialized "order by" statement. In the case of integers I have to specify "order by int8(odrnum)" rather than plain old "order by ordnum". Either way it's terribly inefficient to do things that way. Basically I should be able to sort the table using -(void)tableView

NSTableView *)tableView sortDescriptorsDidChange

NSArray *)oldDescriptors, but that doesn't handle the sort correctly.
So I've resorted to hitting the db every time the user sorts the table, using specialized sort statements for each table column, and having to set the little sort arrow in the column header manually. It feels very hackish...
I know this is not nearly enough information, this is a very specific problem. But I'm hoping a fresh set of eyes might uncover a way of dealing with this that I'm not thinking of, I'm sure I'm not seeing the forest for the trees.
Maybe I should be investigating re-casting the data in the arrays, or sorting the array manually and reloading the table, or going to the kitchen for another glass of Chardonnay, I don't know...
Thanks in advance for any feedback, flames, dumb looks, etc.