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 1iLTys-0000j3-VR for pgsql-general@arkaria.postgresql.org; Fri, 18 Oct 2019 15:15:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iLTyq-00060U-Nq for pgsql-general@arkaria.postgresql.org; Fri, 18 Oct 2019 15:15:52 +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 1iLTyq-00060H-BI for pgsql-general@lists.postgresql.org; Fri, 18 Oct 2019 15:15:52 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iLTyn-0005K3-9A for pgsql-general@lists.postgresql.org; Fri, 18 Oct 2019 15:15:51 +0000 Received: by mail-pl1-x642.google.com with SMTP id u20so3001390plq.4 for ; Fri, 18 Oct 2019 08:15:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=kWoirEiCHuRd6OZdONdDPoSb8p7eEQBiKsP4jBaM9g4=; b=uujibcaHHlz8B8YyucZv0IfuzwONy5gt25MGiUscnIrBGrCZ6soA1xUTzuQjzAkRxR xp+miiIRnR2G2aojLOTg5iIsPgNRKbmz8MajGjW1wJSB5OTyKhQ5BJD9/pk/5PapCKaS cvZ3u4l3QupIoEKRmknSF/9kxgCm6Tfpm/wka4ZTHPTXRKh3E90czKNz+O49ZyXPGCLd ue1F+7fcDKWuid77KbRoiOHshbucK9LI8YmIfdzuzvaqrN3St5Gb8sqhgXRen5LzAded oN6FoPl7Zvt2BGk6VwrMLTYhdm2X8tkmRCDtC7+ATYFQ655AAs51kTOkB/9EjT0FXvYK zi0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=kWoirEiCHuRd6OZdONdDPoSb8p7eEQBiKsP4jBaM9g4=; b=O8XMTogcp9Nv9Dmu4n2K0ma4hi9Y/nf91bSr/ot2gsol1m/0LKw7S6wlAgDyxx1X4E Otz3vGwAu7GaHm4lS019o/PY+/l4ZZkMee5vCLU18YqNvG9DhhVj+n5rhvY/hKeaKYms Bk60rLO5rxnyhFpYnjSuCiopzj+sEy5I0QpMD/1ey6zbGQJlH+60p4QOygXxbD/kRLpd nt2F2MkjlW7R6JfSTHTIzOWMCvaFuAxIzO+UMYjhL70pPcc6rYC+zDZJsv/UIdTAYIDa ugIpzvew9raqWa206SJSzEVsKK8eHx/BzGea65kDEeChYXiQZSzYHKSWoyE+eGYOlb/L UyeA== X-Gm-Message-State: APjAAAX1wfvtiOzbpYDnZu2C0+YFlmD/WaKqqnHHkFiTUV1MYnAKEdJ3 l0RoaTjFQkmoygTI1ur3Z5++YrNC X-Google-Smtp-Source: APXvYqwHHhfqv2LjTA1GMp88AhFaq4jFO+IGY1h6IlMTpe6UJ4fY5cl6uWfdG7Sw7Spvp/e9oMngew== X-Received: by 2002:a17:902:7b96:: with SMTP id w22mr10507598pll.40.1571411745460; Fri, 18 Oct 2019 08:15:45 -0700 (PDT) Received: from [10.104.134.41] ([155.100.47.1]) by smtp.gmail.com with ESMTPSA id f15sm6247091pfd.141.2019.10.18.08.15.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Oct 2019 08:15:44 -0700 (PDT) Subject: Re: DBD::Pg exorts char columns with trailing blanks To: 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: Rob Sargent Message-ID: Date: Fri, 18 Oct 2019 09:15:43 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <05e8c105-fa51-80bc-aa13-016aeb9455a6@aklaver.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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.)