Re: The result of the pattern matching is incorrect when the pattern string is bpchar type
David G. Johnston <david.g.johnston@gmail.com>
From: "David G. Johnston" <david.g.johnston@gmail.com>
To: 甄明洋 <zhenmingyang@yeah.net>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2019-07-11T14:36:08Z
Lists: pgsql-bugs
On Thu, Jul 11, 2019 at 3:48 AM 甄明洋 <zhenmingyang@yeah.net> wrote: > 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. > A similar complaint was made the other day; Tom's response succinctly sums up the prevailing opinion as to the character type. https://www.postgresql.org/message-id/20122.1562548227%40sss.pgh.pa.us In short, don't use character. David J.