Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aTAeU-00026X-OJ for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Feb 2016 15:56:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aTAeT-0005k6-Br for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Feb 2016 15:56:29 +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_SHA384:256) (Exim 4.84) (envelope-from ) id 1aTAdq-00053K-NB for pgsql-bugs@postgresql.org; Tue, 09 Feb 2016 15:55:50 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aTAdn-0007g7-TG for pgsql-bugs@postgresql.org; Tue, 09 Feb 2016 15:55:50 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u19FtevR009242; Tue, 9 Feb 2016 10:55:40 -0500 From: Tom Lane To: Joe Conway cc: "David G. Johnston" , "dominik.kosiorek@infobright.com" , "pgsql-bugs@postgresql.org" Subject: Re: BUG #13934: wrong result of split_part with char value In-reply-to: <56BA05C4.7010004@joeconway.com> References: <20160208151107.2662.82302@wrigleys.postgresql.org> <56BA05C4.7010004@joeconway.com> Comments: In-reply-to Joe Conway message dated "Tue, 09 Feb 2016 07:29:08 -0800" Date: Tue, 09 Feb 2016 10:55:40 -0500 Message-ID: <9241.1455033340@sss.pgh.pa.us> X-Pg-Spam-Score: -2.2 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Joe Conway writes: > In other words, when you insert ' ' into string1postgres.a3pattern, > which is defined as char(15), the single space is trimmed leaving an > empty string: > test=# select '***' || a3pattern || '!!!' from string1postgres; > ?column? > ---------- > ***!!! > (1 row) Actually, I believe the space-trimming happens when the char(n) value is coerced to type text in preparation for passing it to the || operator (which takes text). Since trailing spaces are considered insignificant in char(n), whereas they definitely are significant in text, this is a reasonable thing to do, at least in some contexts. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs