Обсуждение: dump postgres cluster with different encodings

Поиск
Список
Период
Сортировка

dump postgres cluster with different encodings

От
basti
Дата:
Hello I have a postgres cluster with following databases

 davical            | pgadmin           | UTF8      | en_US.utf8      |
en_US.utf8      |
 test                | test              | LATIN9    | en_US.iso885915 |
en_US.iso885915 |
 foo                | postgres          | SQL_ASCII | en_US.iso885915 |
en_US.iso885915 |

when I try to dump this cluster with pg_dump or pg_dumpall I get errors
like:

pg_dump -E utf8 -i -p 5432 -F c -b -v -f "davical.backup" davical
pg_dump: [archiver (db)] connection to database "davical" failed:
FATAL:  database locale is incompatible with operating system
DETAIL:  The database was initialized with LC_COLLATE "en_US.utf8",
which is not recognized by setlocale().
HINT:  Recreate the database with another locale or install the missing
locale.


I can't connect to this database via pgadmin, there is the same error.

locale -a
C
C.UTF-8
de_DE.utf8
en_US.iso885915
en_US.utf8
POSIX

how can I dump this cluster? and connect to database?


Re: dump postgres cluster with different encodings

От
Adrian Klaver
Дата:
On 03/05/2015 02:48 AM, basti wrote:
> Hello I have a postgres cluster with following databases
>
>   davical            | pgadmin           | UTF8      | en_US.utf8      |
> en_US.utf8      |
>   test                | test              | LATIN9    | en_US.iso885915 |
> en_US.iso885915 |
>   foo                | postgres          | SQL_ASCII | en_US.iso885915 |
> en_US.iso885915 |
>
> when I try to dump this cluster with pg_dump or pg_dumpall I get errors
> like:
>
> pg_dump -E utf8 -i -p 5432 -F c -b -v -f "davical.backup" davical
> pg_dump: [archiver (db)] connection to database "davical" failed:
> FATAL:  database locale is incompatible with operating system
> DETAIL:  The database was initialized with LC_COLLATE "en_US.utf8",
> which is not recognized by setlocale().
> HINT:  Recreate the database with another locale or install the missing
> locale.
>
>
> I can't connect to this database via pgadmin, there is the same error.
>
> locale -a
> C
> C.UTF-8
> de_DE.utf8
> en_US.iso885915
> en_US.utf8
> POSIX
>
> how can I dump this cluster? and connect to database?

Some more information is needed.

What is your OS and version?

What is version of Postgres?

How did the database get created?

What happens if you do not use -E?

>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: dump postgres cluster with different encodings

От
basti
Дата:
Whithout -E there was the same error.
The DB was create with:

create database "davical" WITH ENCODING = 'UTF8' LC_CTYPE='en_US.utf8' LC_COLLATE='en_US.utf8' TEMPLATE template0;

I have fix the error with

localedef -f UTF-8 -i en_US en_US.UTF-8

After a restart of postgres all is fine.

Thanks a lot.

p.s. os: debian 7 with postgres 9.1

On 05.03.2015 14:36, Adrian Klaver wrote:
> On 03/05/2015 02:48 AM, basti wrote:
>> Hello I have a postgres cluster with following databases
>>
>>   davical            | pgadmin           | UTF8      | en_US.utf8      |
>> en_US.utf8      |
>>   test                | test              | LATIN9    |
>> en_US.iso885915 |
>> en_US.iso885915 |
>>   foo                | postgres          | SQL_ASCII | en_US.iso885915 |
>> en_US.iso885915 |
>>
>> when I try to dump this cluster with pg_dump or pg_dumpall I get errors
>> like:
>>
>> pg_dump -E utf8 -i -p 5432 -F c -b -v -f "davical.backup" davical
>> pg_dump: [archiver (db)] connection to database "davical" failed:
>> FATAL:  database locale is incompatible with operating system
>> DETAIL:  The database was initialized with LC_COLLATE "en_US.utf8",
>> which is not recognized by setlocale().
>> HINT:  Recreate the database with another locale or install the missing
>> locale.
>>
>>
>> I can't connect to this database via pgadmin, there is the same error.
>>
>> locale -a
>> C
>> C.UTF-8
>> de_DE.utf8
>> en_US.iso885915
>> en_US.utf8
>> POSIX
>>
>> how can I dump this cluster? and connect to database?
>
> Some more information is needed.
>
> What is your OS and version?
>
> What is version of Postgres?
>
> How did the database get created?
>
> What happens if you do not use -E?
>
>>
>>
>
>