Re: Bug on CHARACTER(n) ?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stefano Reksten <sreksten(at)sdb(dot)it>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug on CHARACTER(n) ?
Date: 2005-11-28 17:19:58
Message-ID: 12568.1133198398@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Stefano Reksten <sreksten(at)sdb(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2005-11-28 17:24:05 Re: segfault of autovacuum process during restore - coredumps included
Previous Message Pawel Bernat 2005-11-28 17:02:55 Re: Bug on CHARACTER(n) ?