Thread

  1. Re: [HACKERS] I don't like LIKE

    Hannu Krosing <hannu@trust.ee> — 1999-06-08T20:58:01Z

    Bruce Momjian wrote:
    > 
    > [Charset iso-8859-1 unsupported, filtering to ASCII...]
    > > There seems to be a problem with MakeIndexable(), though I haven't
    > > confirmed that the problem lies there:
    > >
    > > postgres=> select * from t1 where i like '2';
    > > ERROR:  pg_atoi: error in "2_": can't parse "_"
    > >
    > > istm that this query should behave itself, or at least fail in some
    > > other way :(
    > >
    > > I'll guess that, even though there isn't a wildcard to pattern match,
    > > MakeIndexable() is adding a trailing \377 to the string?
    > 
    > Please post example.  Works here:
    > 
    >         select * from pg_class where rename like '2';
    
    Maybe he meant something like this (using 6.4.2)
    
    hannu=> \d t
     
    Table    = t
    +----------------------------------+----------------------------------+-------+
    |              Field               |              Type                |
    Length|
    +----------------------------------+----------------------------------+-------+
    | i                                | int4                            
    |     4 |
    +----------------------------------+----------------------------------+-------+
    hannu=> create index indx on t(i);
    CREATE
    hannu=> vacuum;
    VACUUM
    hannu=> select * from t where i like '1';
    ERROR:  pg_atoi: error in "1ÿ": can't parse "ÿ"
    hannu=>
    
    ---------------------
    Hannu