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 BE440DABF4 for ; Mon, 24 Oct 2005 12:03:54 -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 49127-08 for ; Mon, 24 Oct 2005 15:03:53 +0000 (GMT) Received: from smtp05.gnvlscdb.sys.nuvox.net (smtp.nuvox.net [64.89.70.9]) by svr1.postgresql.org (Postfix) with ESMTP id 9D3CADABD2 for ; Mon, 24 Oct 2005 12:03:52 -0300 (ADT) Received: from csiindy.local (209.248.179.178.nw.nuvox.net [209.248.179.178]) by smtp05.gnvlscdb.sys.nuvox.net (8.12.11/8.12.11) with ESMTP id j9OF3r98028471; Mon, 24 Oct 2005 11:03:54 -0400 Subject: Re: Blank-padding Date: Mon, 24 Oct 2005 10:04:39 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Message-ID: <457C5811B5F0244B9CB13119E027F764040C05@CSISERV1.CSIIndy.local> Content-class: urn:content-classes:message X-MS-Has-Attach: X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 X-MS-TNEF-Correlator: Thread-Topic: [SQL] Blank-padding thread-index: AcXYqZeM3oDlzFljQOOLEzzW3PzN6wAAYYdw From: "Shaun Watts" To: "Scott Marlowe" , "Chris Travers" Cc: "Tom Lane" , "Dean Gibson (DB Administrator)" , "pgsql-sql" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 required=5 tests=[FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/258 X-Sequence-Number: 23111 I also have an issue with the blank padding at the end of my fields. Is there any way to eliminate the blank padding at the end of character fields in a table. Such as you have field X as a char(6), but storing "abc" in it. Well postgres seems to add the padding on the end of string that is being stored. So it is stored as "abc " instead of "abc". I don't want that padding there. I am fairly new to Postgres and have only dealt with Informix database systems, which don't store data this way. Any help is very much appreciated. Thanks, Shaun Shaun Watts Programmer/Analyst =20 CSI - Computer Systems, Inc. Phone: 317.913.4160 12975 Parkside Drive Fax: 317.913.4175 Fishers, IN 46038 Toll Free: 800.860.1274 =20 "To give anything less than your best is to sacrifice the gift." -- Steve Prefontaine -----Original Message----- From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Scott Marlowe Sent: Monday, October 24, 2005 9:46 AM To: Chris Travers Cc: Tom Lane; Dean Gibson (DB Administrator); pgsql-sql Subject: Re: [SQL] Blank-padding On Sat, 2005-10-22 at 00:39, Chris Travers wrote: > Tom Lane wrote: >=20 > >"Dean Gibson (DB Administrator)" writes: > > =20 > > > >>I remember that discussion, and I was for the change. However, upon > >>doing some testing after reading the above, I wonder if the=20 > >>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,=20 > >>with any leading spaces in Z PRESERVED. > >> =20 > >> > > > >(You meant trailing spaces, I assume.) Why exactly would you want to > >do that? You decided by your choice of datatype that the trailing=20 > >spaces weren't significant. > > > I once built a telecom billing app where this might be important=20 > (fixed length fields). Lets say you have fixed length fields defined=20 > as > char(n) datatypes. You may want to build a query to generate billing=20 > records like: > select field1 || field2 || field3 || field4 || field5 ... AS=20 > bill_record FROM lec_billing_entries; >=20 > It seels to me that I would expect trailing spaces to be preserved in=20 > these cases. Having an implicit rtrim function is asking for problems. > Personally I would rather have to call rtrim explicitly than have the=20 > 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.=20 Tom, is it reasonable / doable to have || have a different set of internal functions for each of those types. ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match