Re: Like vs '=' bug with indexing - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Like vs '=' bug with indexing
Date
Msg-id 6702.981313152@sss.pgh.pa.us
Whole thread Raw
In response to Re: Like vs '=' bug with indexing  (m w <mttf2000@yahoo.com>)
List pgsql-hackers
m w <mttf2000@yahoo.com> writes:
> Inconsistent behavior indicates that a different
> matching algorithm is used if one uses an index
> instead of a table scan. That scares me.

A seq scan and an index scan are inherently different algorithms,
so I don't see exactly how you think we can avoid this risk.

In particular, if you are dealing with a btree index and a "WHERE
column = constant" query, then a seq scan is only going to be concerned
with the behavior of the '=' operator --- does it return TRUE or not
for any particular row?  But an index search is inherently going to make
ordered comparisons (<, =, >).  So there is always a potential for
inconsistent behavior if the ordering operators produce results that are
inconsistent with simple '='.  We cannot design that away --- all we can
do is fix such bugs when one is discovered in a particular datatype.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Like vs '=' bug with indexing
Next
From: Tom Lane
Date:
Subject: Re: Implementing an operator in C?