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 1hlcqY-0001ss-MH for pgsql-bugs@arkaria.postgresql.org; Thu, 11 Jul 2019 17:27:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hlcqX-0007eW-Ad for pgsql-bugs@arkaria.postgresql.org; Thu, 11 Jul 2019 17:27:05 +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 1hlcqX-0007eP-2r for pgsql-bugs@lists.postgresql.org; Thu, 11 Jul 2019 17:27:05 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hlcqQ-0003cU-4Z for pgsql-bugs@lists.postgresql.org; Thu, 11 Jul 2019 17:27:04 +0000 Received: from [192.168.127.1] (port=34556 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1hlcqL-0009nD-Kj; Thu, 11 Jul 2019 17:26:53 +0000 Received: from [127.0.0.1] (port=60432 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1hlcqK-0004nG-Rx; Thu, 11 Jul 2019 17:26:52 +0000 From: Andrew Gierth To: "David G. Johnston" Cc: =?utf-8?B?55SE5piO5rSL?= , PostgreSQL mailing lists Subject: Re: The result of the pattern matching is incorrect when the pattern string is bpchar type In-Reply-To: (David G. Johnston's message of "Thu, 11 Jul 2019 07:36:08 -0700") Message-ID: <87k1co4hfu.fsf@news-spur.riddles.org.uk> References: <68c3aa88.331d9.16be0a5d184.Coremail.zhenmingyang@yeah.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Thu, 11 Jul 2019 18:26:52 +0100 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "David" == David G Johnston writes: >> There are two tables with the type of column is char. when Using a >> 'like' predicate in a join condition will result in an incorrect >> result. Because there is no 'like' operator that left operand and >> right operand are all bpchar.(bpchar ~~ bpchar), final the operator >> 'bpchar ~~ text' will be found form candidate set. so database do >> the cast from bpchar to text, The space at the end of the string was >> removed during the cast. David> A similar complaint was made the other day; Tom's response David> succinctly sums up the prevailing opinion as to the character David> type. It's also listed as WONTFIX here: https://wiki.postgresql.org/wiki/PostgreSQL_vs_SQL_Standard#Trailing_spaces_in_character.28n.29 though I guess adding the LIKE case as an example there might be good. -- Andrew (irc:RhodiumToad)