[NOVICE] Custom order
От | Jan Danielsson |
---|---|
Тема | [NOVICE] Custom order |
Дата | |
Msg-id | 1ff2af82-f0f1-5787-9257-9bbf83890108@gmail.com обсуждение исходный текст |
Список | pgsql-novice |
Hello, How would one go about implementing custom rules for sorting? I have a table with a column that contains text strings. These are complex enough that they can't be sorted using plain ASCII/UTF-8, but they do have ordinality. The entries need to be parsed (split up in fields, but depending on the format there may be different sub-fields, each relevant to their order). Currently I have the sorting logic implemented in python. I implemented an object to represent a row and then implemented all the comparison operators for this object. Once this was done I could use the standard sorted() function. It would be nice if the database could output the "proper" (read: custom) order using a simple "ORDER BY <column_name>". Is there something analogous to python's declaring objects and their comparison operators in PostgreSQL? Something like defining custom column type which have custom comparison operators? I would prefer to implement the comparison logic in C if possible. -- Kind regards, Jan Danielsson
В списке pgsql-novice по дате отправления: