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

From: elein <elein(at)varlena(dot)com>
To: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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-18 00:27:13
Message-ID: 20040217162713.H25537@cookie.varlena.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

Apparently the ::char is cast to varchar and then text?
That explains x || ' ' || x

On Tue, Feb 17, 2004 at 05:07:24PM -0700, scott.marlowe wrote:
> On Tue, 17 Feb 2004, 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.
>
> But then this:
>
> select 'x'||' '||'x'
>
> should produce xx, but it produces x x.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2004-02-18 00:31:37 Re: DROP TABLE and concurrent modifications
Previous Message Tom Lane 2004-02-18 00:25:47 Re: CHAR(n) always trims trailing spaces in 7.4

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2004-02-18 03:53:17 Re: CHAR(n) always trims trailing spaces in 7.4
Previous Message Tom Lane 2004-02-18 00:25:47 Re: CHAR(n) always trims trailing spaces in 7.4