Skip to content

Configure DB for correct text sorting by locale

Patrick Bolger edited this page Jun 15, 2017 · 2 revisions

The problem

The production DB was not sorting text fields correctly with respect to Swedish sorting order.

In particular, the text values that begin with one of the special Swedish characters - å, ä, and ö - are sorted in standard ASCII sort order, but should be sorted at the end of the standard ASCII sequence (ending in z), and in this order (in ascending sort): å, ä, and ö.

The solution

See related story: https://www.pivotaltracker.com/story/show/145392305 for:

  1. Analysis of the problem, and confirmation of the root cause on Digital Ocean
  2. Possible solutions (two, only one of which is actually viable)
  3. Confirmation of the solution approach (locally and on Heroku)
  4. Steps to convert the production DB to the correct setting (which involved recreating the DB and restoring all data).
Clone this wiki locally