X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F0262D850D for ; Mon, 24 Oct 2005 11:32:49 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41876-02 for ; Mon, 24 Oct 2005 14:32:44 +0000 (GMT) Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by svr1.postgresql.org (Postfix) with ESMTP id D2DA3DAC82 for ; Mon, 24 Oct 2005 11:32:46 -0300 (ADT) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 24 Oct 2005 09:32:49 -0500 Subject: Re: Blank-padding From: Scott Marlowe To: Chris Travers Cc: Tom Lane , "Dean Gibson (DB Administrator)" , pgsql-sql In-Reply-To: <4359D081.7080105@travelamericas.com> References: <878xwokk4d.fsf@charter.net> <20051020214518.Q1006@ganymede.hub.org> <33c6269f0510210716x474dae2ah3861d32d8db01602@mail.gmail.com> <23805.1129913241@sss.pgh.pa.us> <435979B0.60107@ultimeth.com> <27840.1129951428@sss.pgh.pa.us> <4359D081.7080105@travelamericas.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1130164369.15546.80.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Mon, 24 Oct 2005 09:32:49 -0500 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 required=5 tests=[AWL=0.007] X-Spam-Level: X-Archive-Number: 200510/257 X-Sequence-Number: 23110 On Sat, 2005-10-22 at 00:39, Chris Travers wrote: > Tom Lane wrote: > > >"Dean Gibson (DB Administrator)" writes: > > > > > >>I remember that discussion, and I was for the change. However, upon > >>doing some testing after reading the above, I wonder if the > >>blank-stripping isn't too aggressive. I have a CHAR(6) field (say, > >>named Z) that has "abc " in it. Suppose I want to append "x" to Z, > >>with any leading spaces in Z PRESERVED. > >> > >> > > > >(You meant trailing spaces, I assume.) Why exactly would you want to do > >that? You decided by your choice of datatype that the trailing spaces > >weren't significant. > > > I once built a telecom billing app where this might be important (fixed > length fields). Lets say you have fixed length fields defined as > char(n) datatypes. You may want to build a query to generate billing > records like: > select field1 || field2 || field3 || field4 || field5 ... AS bill_record > FROM lec_billing_entries; > > It seels to me that I would expect trailing spaces to be preserved in > these cases. Having an implicit rtrim function is asking for problems. > Personally I would rather have to call rtrim explicitly than have the > backend treat the concatenation differently than if I do it on the client. If I rememberate correctificantly, this problem is or was caused by the || operator using the same internal logic for varchar / text AND char. Tom, is it reasonable / doable to have || have a different set of internal functions for each of those types.