Compiling postgresql 9.1 on Ubuntu 11.04, and encoding issue with postgresql 8.4


#1

Hi list,

I’ve got a small issue.

My cookbook works perfectly on Ubuntu 12.04, where postgresql 9.1 is
available.

However, when deploying to another node - a VM provider that only has
Ubuntu up to 11.04 - I’m having encoding issues as in:

#<ActiveRecord::StatementInvalid: PG::Error: ERROR: new encoding (UTF8) is
incompatible with the encoding of the template database (SQL_ASCII)
HINT: Use the same encoding as in the template database, or use template0
as template.
: CREATE DATABASE “app_production” ENCODING = ‘utf8’>

The simplest solution, I think, would be to just install 9.1. I’ve already
tried setting up the system locale to “en_US.utf8” before installing
postgresql, but it did not seem to work.

Any straightforward way to build from source or specify Ubuntu 11.04 to use
9.1 using opscode’s postgresql cookbook? From what I’ve seen, it’s not; it
will just get what’s available in apt. I may end up just writing a series
of execute statements to compile 9.1 from source.

Any hints appreciated,

Cheers,

  • Marcelo.

#2

This is not a fault with chef or your VM provider, but Ubuntu…

Some versions of Ubuntu have the postgres DBs initialized as SQL_ASCII and not UTF8.

I was aggravated by this enough to create a fix instructions:
https://planx.com/wiki/PostGIS_install_on_Ubuntu

Bill

On Nov 26, 2012, at 11:30 PM, Marcelo de Moraes Serpa celoserpa@gmail.com wrote:

Hi list,

I’ve got a small issue.

My cookbook works perfectly on Ubuntu 12.04, where postgresql 9.1 is available.

However, when deploying to another node - a VM provider that only has Ubuntu up to 11.04 - I’m having encoding issues as in:

#<ActiveRecord::StatementInvalid: PG::Error: ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
HINT: Use the same encoding as in the template database, or use template0 as template.
: CREATE DATABASE “app_production” ENCODING = ‘utf8’>

The simplest solution, I think, would be to just install 9.1. I’ve already tried setting up the system locale to “en_US.utf8” before installing postgresql, but it did not seem to work.

Any straightforward way to build from source or specify Ubuntu 11.04 to use 9.1 using opscode’s postgresql cookbook? From what I’ve seen, it’s not; it will just get what’s available in apt. I may end up just writing a series of execute statements to compile 9.1 from source.

Any hints appreciated,

Cheers,

  • Marcelo.