Thread: bug in localized \df+ output

bug in localized \df+ output

From
Alvaro Herrera
Date:
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


Re: bug in localized \df+ output

From
Alvaro Herrera
Date:
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


Re: bug in localized \df+ output

From
Bruce Momjian
Date:
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. +