Skip to content

PostgreSQL problems in Debian

David Corking edited this page Mar 7, 2014 · 10 revisions

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

Database user management in Debian

TODO

Locale management in Debian

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

  1. Create a new cluster TODO

  2. 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.

Further reading