pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: terry@ashtonwoodshomes.com
To: 'scott.marlowe' <scott.marlowe@ihs.com>
To: 'Tom Lane' <tgl@sss.pgh.pa.us>
Cc: 'elein' <elein@varlena.com>
Cc: 'news.postgresql.org' <jlim@natsoft.com.my>
Cc: pgsql-sql@postgresql.org
Subject: Re: CHAR(n) always trims trailing spaces in 7.4
Date: Tue, 17 Feb 2004 19:23:44 -0500
Message-ID: <006f01c3f5b5$78932220$2766f30a@development.greatgulfhomes.com> (raw)
In-Reply-To: <Pine.LNX.4.33.0402171706530.31955-100000@css120.ihs.com>

> 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
terry@greatgulfhomes.com
Fax: (416) 441-9085


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




view thread (17+ messages)  latest in thread

Message-ID: <006f01c3f5b5$78932220$2766f30a@development.greatgulfhomes.com>
Permalink:  ../006f01c3f5b5$78932220$2766f30a@development.greatgulfhomes.com/
Also on:    postgresql.org/message-id/006f01c3f5b5$78932220$2766f30a@development.greatgulfhomes.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: terry@ashtonwoodshomes.com, scott.marlowe@ihs.com, tgl@sss.pgh.pa.us, elein@varlena.com, jlim@natsoft.com.my
  Subject: Re: CHAR(n) always trims trailing spaces in 7.4
  In-Reply-To: <006f01c3f5b5$78932220$2766f30a@development.greatgulfhomes.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox