The chances are, once in a while, your
psql terminal session ends up looking like this:
Fixing the line wrapping is very straight-forward, just issue the following commands (or put them into
\setenv PAGER less \setenv LESS -IS \pset linestyle unicode
The last line is optional, but draws a lot nicer tables. Now, the same query results as above will appear almost bearable:
This still sucks if the only thing want is to copy one record to your editor or IM window. It would be easier to have one-line-per-column. MySQL shell has
\G for that.
\x\g\x, so instead of:
select * from brasil_ibge where uf = 'SP' limit 10;
select * from brasil_ibge where uf = 'SP' limit 10 \x\g\x
And there you are!