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 E7AB8DAA74 for ; Sat, 22 Oct 2005 02:39:16 -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 73833-01 for ; Sat, 22 Oct 2005 05:39:14 +0000 (GMT) Received: from mail.travelamericas.com (unknown [206.130.134.147]) by svr1.postgresql.org (Postfix) with SMTP id D970BDAA38 for ; Sat, 22 Oct 2005 02:39:13 -0300 (ADT) Received: (qmail 23658 invoked from network); 22 Oct 2005 05:39:13 -0000 Received: from unknown (HELO ?10.0.0.253?) (10.0.0.253) by verkiel.travelamericas.com with SMTP; 22 Oct 2005 05:39:13 -0000 Message-ID: <4359D081.7080105@travelamericas.com> Date: Fri, 21 Oct 2005 22:39:13 -0700 From: Chris Travers User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: "Dean Gibson (DB Administrator)" , pgsql-sql Subject: Re: Blank-padding 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> In-Reply-To: <27840.1129951428@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.045 required=5 tests=[AWL=-0.005, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/253 X-Sequence-Number: 23106 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. > This gripe seems to me exactly comparable to >complaining if a numeric datatype doesn't remember how many trailing >zeroes you typed after the decimal point. Those zeroes aren't >semantically significant, so you have no case.\ > > My only gripe here is that the implicit rtrimming is going to cause problems in cases where you are trying to do things with fixed-length fields, which is really where one is likely to use bpchar anyway. It is not a showstopper, but I can see why some people don't like it. But can't please everyone :-) Best Wishes, Chris Travers Metatron Technology Consulting