I am trying to get a rails postgres table ordered by the exact values of
the ascii characters such that:
Unfortunately, even when I try to escape the < characters and enter them
directly in the Postgresql table, I get:
I tried @@@@ in place of <none> and it is positioned as I expect, but
@none@ is handled the same as <none>.
I've searched the web, but there are too many different solutions. It
will take me all day and night to try them out,
Can anyone point me in the right direction?
What you want is the C collation. You can either:
- have it during query (`MyModel.order('name COLLATE "C"')`),
- create the column with C collation (`t.string :my_column, :collation
=> "C"` iirc),
- or set default database collation (check either `CREATE DATABASE`
documentation or `initdb`).