Re: Bug on CHARACTER(n) ? - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Bug on CHARACTER(n) ?
Date
Msg-id 12568.1133198398@sss.pgh.pa.us
Whole thread Raw
In response to Bug on CHARACTER(n) ?  (Stefano Reksten <sreksten@sdb.it>)
List pgsql-bugs
Stefano Reksten <sreksten@sdb.it> writes:
> SELECT length(name), name from test;
>   length |    name
> --------+------------
>        4 | test

> Should not a char(10) insert 6 padding spaces?

It does, as you can see in the above output; but the padding spaces are
considered semantically insignificant and are therefore ignored by
length() and by concatenation.  If you think that trailing spaces are
meaningful data, then use varchar(n) or text.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Pawel Bernat
Date:
Subject: Re: Bug on CHARACTER(n) ?
Next
From: Alvaro Herrera
Date:
Subject: Re: segfault of autovacuum process during restore - coredumps included