Re: The result of the pattern matching is incorrect when the pattern string is bpchar type

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: 甄明洋 <zhenmingyang(at)yeah(dot)net>
Cc: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: The result of the pattern matching is incorrect when the pattern string is bpchar type
Date: 2019-07-11 14:36:08
Message-ID: CAKFQuwY9W2ijr5SY0uPXkJKwBn9GuxW2jjJ3m_ywAEX7Gbm4tA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Jul 11, 2019 at 3:48 AM 甄明洋 <zhenmingyang(at)yeah(dot)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.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2019-07-11 15:05:29 BUG #15904: ERROR: argument of LIMIT must not contain variables
Previous Message Tom Lane 2019-07-11 13:44:07 Re: BUG #15888: Bogus "idle in transaction" state for logical decoding client after creating a slot