Trying a Postgresql Migration but can not create DB

Setup Stash and its working fine on Fedora 18 with integrated db.

I started trying to setup the postgresql db (already have postgresql working on this system). I'm getting a error and I can not figure out how to get it working.

When I run:

CREATE DATABASE stash WITH ENCODING='UTF8' OWNER=stashuser CONNECTION LIMIT=-1;

I get:

ERROR:  encoding "UTF8" does not match locale "en_US"
DETAIL:  The chosen LC_CTYPE setting requires encoding "LATIN1".

and it does not create the db. My local output is:

[ss ~]$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
...

Anyone know what steps I need to do to address this? Will it change my other dbs?

Oh and in psql a '\l' lists other dbs with encoding of LATIN1.

2 answers

1 accepted

Went into psql and did a \h create database and used that to add all the proper "WITH" statements and ultimately got it working with:

sec=# CREATE DATABASE stash WITH OWNER=stashuser TEMPLATE=template0 ENCODING='UTF8' LC_COLLATE='en_US.UTF-8' LC_CTYPE='en_US.UTF-8' CONNECTION LIMIT=-1;

Thanks to Marcus Silveira for giving me hope it was just a statement away from success.

1 vote

Hi Patrick,

Try setting the LC_CTYPE encoding explicitly in the create database statement

CREATE DATABASE stash WITH ENCODING='UTF8' LC_CTYPE='en_US.UTF-8' OWNER=stashuser CONNECTION LIMIT=-1;

Hope this helps,

Marcus

Well at least I get a new error:

ERROR:  encoding "UTF8" does not match locale "en_US"
DETAIL:  The chosen LC_COLLATE setting requires encoding "LATIN1".

This is a standard installation of F18 and ProstgreSQL 9.2.3 so someone must know how this is set?

Hi Patrick,

Try adding the LC_COLLATE to the create command also.

CREATE DATABASE stash WITH ENCODING='UTF8' LC_CTYPE='en_US.UTF-8' LC_COLLATE='en_US.UTF-8' OWNER=stashuser CONNECTION LIMIT=-1;

This produced:

ERROR:  new encoding (UTF8) is incompatible with the encoding of the template database (LATIN1)
HINT:  Use the same encoding as in the template database, or use template0 as template.

so I messed around and got it working with template0.

Thanks so much for helping me go down the correct path.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published 7 hours ago in Agile

What is ChatOps? A guide to its evolution, adoption, and significance

I am the product of AIM. I can hear that door swinging open and closed in my mind with absolute fidelity. I’d recognize that ding anywhere. At 15, as I typed away into AOL IM, I never imagined that ...

22 views 1 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you