Re: CHAR(n) always trims trailing spaces in 7.4

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: elein <elein(at)varlena(dot)com>
Cc: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>, "news(dot)postgresql(dot)org" <jlim(at)natsoft(dot)com(dot)my>, pgsql-sql(at)postgresql(dot)org
Subject: Re: CHAR(n) always trims trailing spaces in 7.4
Date: 2004-02-19 20:06:21
Message-ID: 8636.1077221181@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

elein <elein(at)varlena(dot)com> writes:
> Somewhere the space trimming occurs.

The cast from char(n) to text (or varchar) is what's doing the trimming
in 7.4. I think you can mostly revert the change by changing that
pg_cast entry to specify no conversion function instead of rtrim().
However that would probably result in squirrely, non-spec behavior for
comparisons.

> If char(n) is properly defined to not trim spaces then
> there should be a separate cat for char(n).

Possibly, but I think that is considering the issue much too narrowly.
Concatenation is not the only textual operator.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2004-02-19 20:07:50 Re: Design Documentation Help !!
Previous Message Bruce Momjian 2004-02-19 20:00:03 Re: Advice regarding configuration parameters

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 2004-02-19 20:09:34 Re: Compiling pl/pgsql functions
Previous Message Jeremy Smith 2004-02-19 19:34:39 Re: DISTINCT ON troubles