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 74DEFD1DAB0 for ; Tue, 17 Feb 2004 23:59:26 +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 01679-05 for ; Tue, 17 Feb 2004 19:59:26 -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 B077AD1D8DA for ; Tue, 17 Feb 2004 19:59:23 -0400 (AST) Received: by cookie.varlena.com (Postfix on SuSE Linux 7.3 (i386), from userid 500) id 3C44738C85; Tue, 17 Feb 2004 15:56:11 -0800 (PST) Date: Tue, 17 Feb 2004 15:56:11 -0800 From: elein To: Tom Lane Cc: elein , "news.postgresql.org" , pgsql-sql@postgresql.org Subject: Re: CHAR(n) always trims trailing spaces in 7.4 Message-ID: <20040217155611.G25537@cookie.varlena.com> Mail-Followup-To: Tom Lane , "news.postgresql.org" , pgsql-sql@postgresql.org References: <20040212000610.13913.qmail@web60806.mail.yahoo.com> <18611.1077059456@sss.pgh.pa.us> <20040217151728.E25537@cookie.varlena.com> <18872.1077061249@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18872.1077061249@sss.pgh.pa.us> User-Agent: Mutt/1.3.22.1i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/234 X-Sequence-Number: 16924 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 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