AnswerBun.com

Why does pg_dumpall use the wrong encoding in Ubuntu 16.04 / Postgres 9.5?

Database Administrators Asked by Thomas R. on September 5, 2020

I cannot run a "pg_upgradecluster" because there are problems with pg_dumpall. I have set the encoding to UTF8 everywhere on the server but pg_dumpall always uses

"SET client_encoding = ‘LATIN1’;"

. Where does this "LATIN1" come from?

postgres=# show server_encoding; show client_encoding;


server_encoding
-----------------
 UTF8
(1 row)

 client_encoding
-----------------
 UTF8
(1 row)

[email protected]:~$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

[email protected]:~$ env
SHELL=/bin/bash
TERM=xterm
USER=postgres
MAIL=/var/mail/postgres
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PWD=/var/lib/postgresql
LANG=en_US.UTF-8
SHLVL=1
HOME=/var/lib/postgresql
LOGNAME=postgres
XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
_=/usr/bin/env

[email protected]:~$ cat /etc/default/locale
#  File generated by update-locale
LANG=en_US.UTF-8
#LANGUAGE="en_US:en"

Because of the wrong encoding I get errors:

pg_dump: Dumping the contents of table "TBLDATEN" failed:
PQgetResult() failed. pg_dump: Error message from server: ERROR:
character with byte sequence 0xe2 0x80 0xa6 in encoding "UTF8" has no
equivalent in encoding "LATIN1"

I have the same problem with pg_dump but then I can use

pg_dump -E UTF8

to set the correct encoding.


[email protected]:~$ psql -l | grep LATIN
[email protected]:~$ psql -l
                                         List of databases
         Name         |    Owner    | Encoding |   Collate   |    Ctype    |   Access privileges
----------------------+-------------+----------+-------------+-------------+------------------------
 Liste1               | cpl_user    | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 Liste2               | postgres    | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 Liste3               | postgres    | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 Liste4               | postgres    | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 Liste5               | postgres    | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 Liste6               | postgres    | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
...

Add your own answers!

Related Questions

HAPROXY for Postgres Failover Master/Replica

0  Asked on December 31, 2020 by jayson-gonzaga

       

Error 0xc000007b with Oracle 19c

2  Asked on December 28, 2020 by ben-a

       

Join to tables dynamically depending on data

2  Asked on December 28, 2020 by yellephen

   

PostgreSQL exits the shell when importing large data

2  Asked on December 26, 2020 by 3bdalla

   

Spike and time out errors every x th minute

1  Asked on December 25, 2020 by beginnerdba

     

Oracle RAC and DataGuard configuration

1  Asked on December 25, 2020 by yifan

         

Segragating First LSN and Last LSN from Output MySQL

0  Asked on December 24, 2020 by jabir-baig

     

Lossless Join Decomposition Criteria

1  Asked on December 23, 2020 by kevin-wu

   

Mongodb Upgrade from 1.8.2 to 4.4

0  Asked on December 23, 2020 by amanullah

   

SQLite database becomes corrupt

1  Asked on December 22, 2020 by jkozma

 

How do I export a multi table database with exceptions?

2  Asked on December 21, 2020 by soberuprising

     

MS SQL login periodically doesn’t work

2  Asked on December 20, 2020 by alonzo-hess

   

PostgreSQL: Find row with JSON object attribute in array

1  Asked on December 20, 2020 by karlsc

     

Hotel booking schema

1  Asked on December 20, 2020 by rakoun

 

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir