Re: Collation order in Rails with Postgresql


#1

Hi,

On Sat, Mar 12, 2016, at 09:49, Donald Z. wrote:

What you want is the C collation[1]. 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[2] or initdb[3]).

[1] http://www.postgresql.org/docs/current/static/collation.html

[2]
http://www.postgresql.org/docs/current/static/sql-createdatabase.html

[3] http://www.postgresql.org/docs/current/static/app-initdb.html