-
Notifications
You must be signed in to change notification settings - Fork 213
PostgreSQL problems in Debian
I encountered a couple of problems when trying to do development and testing in Debian Linux 7.3 (aka Debian wheezy) and PostgreSQL 9.1
The first symptom was a complaint that a database because of a locale error. This can occur with db:create
or db:init
or db:test:prepare
. Locale is what systems use to customize character set, sort order and date style to a particular culture. At LocalSupport, as of February 2014, our locale is specified by the encoding: unicode
line in database.yml. An example of the error is:
TODO
TODO
You need to set the locale of the postgres
unix user to be en_US.UTF-8, before you create a database cluster. A cluster is the place in your machine that stores a group of databases. A development machine probably one has one cluster, called, by default 9.1 main
. However, Debian probably created this cluster for you when it installed. If the default locale in your machine is wrong, you will need to
TODO list commands to do this
!!! WARNING - this next command deletes all the data, tables, passwords and settings in all your PostgreSQL databases !!! TODO
-
Create a new cluster TODO
-
Create and seed your LocalSupport databases as described in the normal installation instructions.
You can use Postgres commands to create databases that override the defaults in your system, but then you lose a lot of the automated help you get when you manage your Rails server with rake
tasks.
- Details on working with PostgreSQL on Debian are on the Debian Wiki.
- Postgres commands to create database with non-standard locales are in Chapter 22 of the manual (Localization).
- http://stackoverflow.com/questions/6579621/lc-collate-and-lc-ctype-suport-for-utf-8-in-postgresql
- https://code.google.com/p/winelocale/wiki/AddLocalesToDebian
- http://www.debian.org/doc/manuals/intro-i18n/ch-locale.en.html
- http://programming.aiham.net/2011/07/26/changing-locale-of-postgresql-db-cluster/