bug in localized \df+ output

Started by Alvaro Herreraabout 18 years ago3 messageshackers
Jump to latest
#1Alvaro Herrera
alvherre@2ndquadrant.com

I'm seeing this:

Liste des fonctions
-[ RECORD 1 ]--------------------+----------------------------------------------------------------------------
Sch�ma | public
Nom | tg_backlink_a
Type de donn�es du r�sultat | trigger
Type de donn�es des param�tres |
Volatibilit� | volatile
Propri�taire | alvherre
Langage | plpgsql
Code source |
: declare
: dummy\x09integer;

This is \x \df+ tg_* on the regression database. server_encoding=utf8,
client_encoding=utf8.

Notice the alignment problem.

I'm guessing that we're counting bytes, not chars, to build the table on
psql.

Also the \x09 thing is pretty ugly (I think this was already reported?)
:-(

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

#2Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Alvaro Herrera (#1)
Re: bug in localized \df+ output

Alvaro Herrera wrote:

I'm seeing this:

Liste des fonctions
-[ RECORD 1 ]--------------------+----------------------------------------------------------------------------
Schéma | public
Nom | tg_backlink_a
Type de données du résultat | trigger
Type de données des paramètres |

After much poking around and talking to Bruce on IM I noticed that this
only shows up if the client is on a multibyte locale (I'm on an UTF8
locale) and the database has been created as SQL_ASCII.

So the environment is bogus: psql is calculating widths for locale C,
but psql is using the other locale. Witness what happens when I run
psql in a non-UTF8 environment instead:

regression=# select * from baz;
trouvé | détail | tròis
--------+---------+--------
f | ááá | 3
(1 fila)

(the alignment is correct, but the accented letter show up as UTF8
sequences interpreted as latin1)

And this is what I get on the UTF8 xterm:

regression=# select * from baz;
trouv�| détail | tròis
--------+---------+--------
f | ááá | 3
(1 ligne)

(the accents are OK but the alignment is messed up).

So, in conclusion, the problem is that the environment is bogus, but I'm
not sure if something needs to be told to psql about that.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

#3Bruce Momjian
bruce@momjian.us
In reply to: Alvaro Herrera (#2)
Re: bug in localized \df+ output

Alvaro Herrera wrote:

So, in conclusion, the problem is that the environment is bogus, but I'm
not sure if something needs to be told to psql about that.

FYI, psql is computing character lengths based on the client encoding
set by psql.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +