Re: [HACKERS] I don't like LIKE - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] I don't like LIKE
Date
Msg-id 27861.928880292@sss.pgh.pa.us
Whole thread Raw
In response to I don't like LIKE  (Thomas Lockhart <lockhart@alumni.caltech.edu>)
List pgsql-hackers
Thomas Lockhart <lockhart@alumni.caltech.edu> writes:
> postgres=> select * from t1 where i like '2';
> ERROR:  pg_atoi: error in "2�": can't parse "�"

> I'll guess that, even though there isn't a wildcard to pattern match,
> MakeIndexable() is adding a trailing \377 to the string?

Yup.  This is an example of my point the other day: we shouldn't be
adding those index restriction clauses in the parser, but much later
on after type conversions have settled down and we know what we're
dealing with.  I don't think there's a good quick-fix, we'll just have
to do it right.

If you use variables to prevent makeIndexable from triggering, you
will find that the system will indeed takeint4 like int4float4 like float4float8 like float8
which I find surprising, seeing as how there are no such operators.
Automatic anything->text conversion, apparently.  I wonder whether
this isn't being a little too free with auto conversion.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Re: Release schedule
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Re: Release schedule