Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

psql console not accepting localization

I have encountered a strange problem on one of our machines.

It is a fresh install of Debian Squeeze, with Postgres 8.4.10.

I have a few localizations installed on the machine, locale -a gives this:

C
en_US
en_US.iso88591
en_US.utf8
POSIX
swedish
sv_SE
sv_SE.iso88591
sv_SE.utf8

In the regular linux console I can use swedish localization (åäö works), but when I enter the psql console I can't use localized characters. Doesn't matter how I configure my terminal (tried just about every encoding I can think of).

The database itself works fine, I can input localized chars by making a SQL file and keep the inserts there. It's just no the most efficient way of doing it ;-)

Haven't run into this problem before, and I've installed quite a few machines. Does anyone have any idea of what could possibly be the cause of this?

like image 343
Dytut Avatar asked Mar 09 '12 10:03

Dytut


1 Answers

I believe you're experiencing the problem explained in this bug report: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=608442

Summary: due to a licensing issue, psql is now linked to libedit instead of libreadline, and unfortunately libedit is broken/incomplete with regard to accented characters. According to the report, a work-around is to launch psql with:

LD_PRELOAD=/lib/libreadline.so.5 psql

or upgrade the postgresql-common package to version 114 or higher. Since it's not in the stable branch, the easiest way may be to switch to backports:

# aptitude -t squeeze-backports install postgresql-common
like image 170
Daniel Vérité Avatar answered Sep 29 '22 08:09

Daniel Vérité