Width of the terminal window is 280 columns, and Debian prints text just fine.

However, psql output is totally messed up. When I type a command, it's not wrapped: if I exceed 80 symbols in a line, the rest is printed from the beginning of the line overlapping the first part (i. e. caret is returned).enter image description here Same goes for printing query results: it tries to fits everything into 80 symbols per line, but at least doesn't overlap the text.

I've tried this command: \pset columns 280, but it didn't help.

echo "$PS1" yields ${debian_chroot:+($debian_chroot)}\u@\h:\w\$

  • A strong suspect here is your prompt string contains non-printing characters that confuse the shell's understanding of the current cursor; can you provide the output of echo "$PS1"? – Jeff Schaller Sep 23 at 20:23
  • @JeffSchaller Added this info. Also, I've messed up a bit: it's not Ubuntu, it's Debian. – efpies Sep 23 at 20:27
up vote 2 down vote accepted

The solution is to completely reset a PSQL installation, so it is in the same state as when It was installed. Debian splits the database configuration from the database files, opposed to generic PSQL installation that puts everything under same directory. Debian allows multiple clusters and even different versions of PSQL to coexist in same host.

Configuration files: /etc/postgresql/[version]/[cluster]/
Binaries: /usr/lib/postgresql/[version]
Data files: /var/lib/postgresql/[version]/[cluster] 

Debian PSQL installation automatically calls the initdb i.e. it initializes the cluster with default encoding and locale. Encoding can be changed later but the locale cannot. To change the locale (possibly other options in initdb), delete the existing default cluster and create a new one:

-Take root privileges.

-Run the following command:

pg_dropcluster --stop <version> main

For example:
pg_dropcluster --stop 8.3 main

-Run the initdb with your options. For example:

pg_createcluster --locale de_DE.UTF-8 --start 8.3 main
  • 1
    Thanks. That helped. I've only had C.UTF-8 locale (it's a VM, not a machine for work), but it was enough. – efpies Sep 23 at 21:09

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.