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

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: elein <elein@varlena.com>
Cc: "scott.marlowe" <scott.marlowe@ihs.com>, "news.postgresql.org" <jlim@natsoft.com.my>, pgsql-sql@postgresql.org
Date: 2004-02-19T20:06:21Z
Lists: pgsql-hackers, pgsql-sql
elein <elein@varlena.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