Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iLU22-0000qD-KB for pgsql-general@arkaria.postgresql.org; Fri, 18 Oct 2019 15:19:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iLU21-0000tO-Cd for pgsql-general@arkaria.postgresql.org; Fri, 18 Oct 2019 15:19:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iLU21-0000tH-2p for pgsql-general@lists.postgresql.org; Fri, 18 Oct 2019 15:19:09 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iLU1w-0005MD-P1 for pgsql-general@lists.postgresql.org; Fri, 18 Oct 2019 15:19:08 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id AE9D220782; Fri, 18 Oct 2019 11:19:02 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 18 Oct 2019 11:19:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=l wAHr80du9EmowGRi4eumL+tEBAY/fjODUXqgA9moNw=; b=n+I+/B4HbGnyxR6yn OhfkguMVW8wUhevQTI19tMHXY7BGixQNghv39zsNuEWdxgkf+86Sm1gwdeBhf71m nvXhM7ATkeEmSxz3AvzVDcpxVha21q7oHbrUMeuUY77oVyYDZJEIaay5Me5y1cW5 D9GL3gMgpmO3Ep+cmwJxjXTilU1qEbcrn31ng6Hs5cIag0ui8zFUYyGexr4MtNqe C+ar1z2ZW+Jv3+VAR7Y+uyB5G3iW7Aqg9NRYNH9V4PxSF149GNZRa/9qTG4YYOkf PkXQYjXsXZ6xqPzsgEOEAt38iR96Uyx5SwnPdae+hZXa3BYhiIOsHDaeNOcaD2i5 wYDDg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=lwAHr80du9EmowGRi4eumL+tEBAY/fjODUXqgA9mo Nw=; b=l7lQb1zMHmqbvetzmoFJVw7pj0BuFQKNXinZWBQoysv9KOjezPhelzUC9 aqEO/wGLtqJyE7kNP5vvILbpCdbZYt10zAa6s62kN5p7+3rRZMOsE9NcPQX1E0X0 8fiX2Z13neaCSdoy0ssN98FmTm215sm8wp0YJItp5LLqt0WJlIflbmm6h16QSaHn o5BwmVi6zET3YLx9HnIEMgUStR/ilrFBWt/5vhr7YBzdQ9gdG77tg+LTBGQShaa1 ZEYVm2TX0Udih9RXlCxOlZ4mo1u+a8vRtG6H51CRZZGVSzEsLT/t2j/GJdmJ/+a8 MD49ql3BOPju13NFI/n8vBho6ES7A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrjeelgdekhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuffhomhgrihhnpehmvghtrggtphgrnhdrohhrghdpphhoshhtghhrvghsqhhlrdho rhhgnecukfhppedujeegrddvuddruddvkedrgeelnecurfgrrhgrmhepmhgrihhlfhhroh hmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmnecuvehluhhsthgv rhfuihiivgeptd X-ME-Proxy: Received: from [192.168.1.2] (174-21-128-49.tukw.qwest.net [174.21.128.49]) by mail.messagingengine.com (Postfix) with ESMTPA id 205FFD6005B; Fri, 18 Oct 2019 11:19:02 -0400 (EDT) Subject: Re: DBD::Pg exorts char columns with trailing blanks To: Rob Sargent , pgsql-general@lists.postgresql.org References: <80o3yg.pzkkx1.2uoaif-qmf@ms-10.1blu.de> <29389.1571403718@sss.pgh.pa.us> <20191018144226.GA2930@c720-r342378> <05e8c105-fa51-80bc-aa13-016aeb9455a6@aklaver.com> From: Adrian Klaver Message-ID: Date: Fri, 18 Oct 2019 08:19:01 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 10/18/19 8:15 AM, Rob Sargent wrote: > > On 10/18/19 8:51 AM, Adrian Klaver wrote: >> On 10/18/19 7:42 AM, Matthias Apitz wrote: >>> El día viernes, octubre 18, 2019 a las 03:01:58p. m. +0200, Tom Lane >>> escribió: >>> >>>> Matthias Apitz writes: >>>>> When we export char columns with our Perl tools, they come out with >>>>> trailing blanks (in Sybase they don't). Can this be suppressed? >>>> >>>> Switch to varchar, perhaps? >>>> >>>>             regards, tom lane >>> >>> Sometimes people does not know, what they propose. We have a historical >>> 25 years grown ILS which runs on top of Sybase, Oracle, Informix ... and >>> should now be ported to PostgreSQL. We can't simple switch internal >>> table structures and adopt some 10.000.000 lines of code (or debug while >>> it is now crashing). >> >> That was not mentioned in the original post. Anyway: >> >> https://metacpan.org/pod/DBD::Pg#ChopBlanks-(boolean,-inherited) >> >> https://metacpan.org/pod/DBI >> >> "ChopBlanks >> >> Type: boolean, inherited >> >> The ChopBlanks attribute can be used to control the trimming of >> trailing space characters from fixed width character (CHAR) fields. No >> other field types are affected, even where field values have trailing >> spaces. >> >> The default is false (although it is possible that the default may >> change). Applications that need specific behaviour should set the >> attribute as needed. >> >> Drivers are not required to support this attribute, but any driver >> which does not support it must arrange to return undef as the >> attribute value." >> >>> >>> Thanks anyway. >>> >>>     matthias >>> >>> >> >> > It seems to me you've simply exposed a bug in you ILS.  If blanks > intentionally went in, would they not get truncated on the way out in > the other systems?  If all trailing blanks are expendable perhaps your > saves should remove them.  (And a trimming of the existing records is in > order.) The OP is dealing with char(acter) fields: https://www.postgresql.org/docs/11/datatype-character.html "If the string to be stored is shorter than the declared length, values of type character will be space-padded; ..." > > > -- Adrian Klaver adrian.klaver@aklaver.com