Re: TR: Like and = - Mailing list pgsql-sql

From Tom Lane
Subject Re: TR: Like and =
Date
Msg-id 2063.1056389739@sss.pgh.pa.us
Whole thread Raw
In response to Re: TR: Like and =  (Randall Lucas <rlucas@tercent.net>)
List pgsql-sql
Randall Lucas <rlucas@tercent.net> writes:
> The LIKE operator takes a pattern, and since your pattern did not 
> specify a wildcard at the end, it didn't exactly match the padded 
> string.

> This behavior does seem kind of confusing; 

Yeah.  As of CVS tip, the system is actually going out of its way to
cause this to happen: if we deleted the separate ~~ operator for bpchar,
then the automatic rtrim() that now happens when converting bpchar to
text would cause the extra spaces to go away, and the LIKE would work
as Nicolas is expecting.  On the other hand, this would probably create
some backwards-compatibility issues, since existing uses of LIKE with
bpchar operands are no doubt using patterns that expect the spaces to be
there.  Any opinions whether we should change it or not?
        regards, tom lane


pgsql-sql by date:

Previous
From: Michael A Nachbaur
Date:
Subject: Re: multi-table unique index
Next
From: Markus Bertheau
Date:
Subject: Re: multi-table unique index