X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 62D76D1DD51 for ; Wed, 18 Feb 2004 00:30:29 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 07689-08 for ; Tue, 17 Feb 2004 20:30:30 -0400 (AST) Received: from cookie.varlena.com (adsl-64-142-36-103.sonic.net [64.142.36.103]) by svr1.postgresql.org (Postfix) with ESMTP id 3C5ECD1DD71 for ; Tue, 17 Feb 2004 20:30:26 -0400 (AST) Received: by cookie.varlena.com (Postfix on SuSE Linux 7.3 (i386), from userid 500) id E740038C85; Tue, 17 Feb 2004 16:27:13 -0800 (PST) Date: Tue, 17 Feb 2004 16:27:13 -0800 From: elein To: "scott.marlowe" Cc: Tom Lane , elein , "news.postgresql.org" , pgsql-sql@postgresql.org Subject: Re: CHAR(n) always trims trailing spaces in 7.4 Message-ID: <20040217162713.H25537@cookie.varlena.com> Mail-Followup-To: "scott.marlowe" , Tom Lane , "news.postgresql.org" , pgsql-sql@postgresql.org References: <18872.1077061249@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.22.1i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/238 X-Sequence-Number: 16928 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 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.