> select 'x'||' '||'x'
>
> should produce xx, but it produces x x.
>

INCORRECT

This
select 'x'||' '::char ||'x'

Should produce xx

This
select 'x'||' '||'x'
is restateable as select 'x'|| ' '::text ||'x'

And the || operand for text is not dropping the extra spaces hence correctly
x x

Terry Fielder
Manager Software Development and Deployment
Great Gulf Homes / Ashton Woods Homes
[EMAIL PROTECTED]
Fax: (416) 441-9085


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of scott.marlowe
> Sent: Tuesday, February 17, 2004 7:07 PM
> To: Tom Lane
> Cc: elein; news.postgresql.org; [EMAIL PROTECTED]
> Subject: Re: [SQL] CHAR(n) always trims trailing spaces in 7.4
>
>
> On Tue, 17 Feb 2004, Tom Lane wrote:
>
> > elein <[EMAIL PROTECTED]> 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.
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to