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

From: elein <elein(at)varlena(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: elein <elein(at)varlena(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-17 23:56:11
Message-ID: 20040217155611.G25537@cookie.varlena.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

So the problem is there. But blaming it on char was wrong.
It should be blamed on the varchar change. Hey, I thought
the truncation was for varchar and not text? It was for both?

It would be semantically tricky to change the operator.
The precendence is to convert to text. Now with
the implicit update of the char(n) to text for the operator
"corrupts" the char() value.

elein

On Tue, Feb 17, 2004 at 06:40:49PM -0500, Tom Lane wrote:
> elein <elein(at)varlena(dot)com> writes:
> > This is an example of the problem. It used to expand
> > the middle thing to 15.
>
> > elein=# select 'x' || ' '::char(15) || 'x';
> > ?column?
> > ----------
> > xx
> > (1 row)
>
> Still does, but then the spaces go away again when the value goes into
> the concatenation, because concatenation is a text operator.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message scott.marlowe 2004-02-18 00:07:24 Re: CHAR(n) always trims trailing spaces in 7.4
Previous Message Tom Lane 2004-02-17 23:40:49 Re: CHAR(n) always trims trailing spaces in 7.4

Browse pgsql-sql by date

  From Date Subject
Next Message scott.marlowe 2004-02-18 00:07:24 Re: CHAR(n) always trims trailing spaces in 7.4
Previous Message Tom Lane 2004-02-17 23:40:49 Re: CHAR(n) always trims trailing spaces in 7.4