Thread

  1. Re: ILIKE

    Josh Berkus <josh@agliodbs.com> — 2003-02-23T21:02:27Z

    Peter,
    
    Several reasons (because I like lists):
    - Some other databases support ILIKE and it makes porting easier.
    - For tables and/or subqueries that are too small to need an index, ILIKE is 
    perfectly acceptable.
    - It's also useful for comparing expressions, and is faster to type than
    	'jehosaphat' ~* '^Jehosaphat$', and certainly much faster than
    	lower('jehosaphat') = lower('Jehosaphat')
    
    Why this sudden urge to prune away perfectly useful operators?
    
    -- 
    Josh Berkus
    Aglio Database Solutions
    San Francisco
    
    
  2. Re: ILIKE

    Tom Lane <tgl@sss.pgh.pa.us> — 2003-02-24T04:31:22Z

    Josh Berkus <josh@agliodbs.com> writes:
    > - Some other databases support ILIKE and it makes porting easier.
    
    Which other ones?  I checked our archives and found that when we were
    discussing adding ILIKE, it was claimed that Oracle had it.  But I can't
    find anything on the net to verify that claim.  I did find that mSQL
    (not MySQL) had it, as far back as 1996.  Nothing else seems to --- but
    Google did provide a lot of hits on pages saying that ILIKE is a mighty
    handy Postgres-ism ;-)
    
    > Why this sudden urge to prune away perfectly useful operators?
    
    My feeling too.  Whatever you may think of its usefulness, it's been a
    documented feature since 7.1.  It's a bit late to reconsider.
    
    			regards, tom lane
    
    
  3. Re: ILIKE

    Rod Taylor <rbt@rbt.ca> — 2003-02-24T12:04:46Z

    On Sun, 2003-02-23 at 23:31, Tom Lane wrote:
    > Josh Berkus <josh@agliodbs.com> writes:
    > > - Some other databases support ILIKE and it makes porting easier.
    > 
    > Which other ones?  I checked our archives and found that when we were
    > discussing adding ILIKE, it was claimed that Oracle had it.  But I can't
    > find anything on the net to verify that claim.  I did find that mSQL
    > (not MySQL) had it, as far back as 1996.  Nothing else seems to --- but
    > Google did provide a lot of hits on pages saying that ILIKE is a mighty
    > handy Postgres-ism ;-)
    
    Isn't MySQL case insensitive by default?  I know the ='s operator is
    (was?)
    
    'a' = 'A'
    
    -- 
    Rod Taylor <rbt@rbt.ca>
    
    PGP Key: http://www.rbt.ca/rbtpub.asc
    
  4. Re: ILIKE

    Peter Eisentraut <peter_e@gmx.net> — 2003-02-24T12:30:18Z

    Josh Berkus writes:
    
    > - Some other databases support ILIKE and it makes porting easier.
    
    Which database would that be?
    
    -- 
    Peter Eisentraut   peter_e@gmx.net
    
    
    
    
  5. Re: ILIKE

    Peter Eisentraut <peter_e@gmx.net> — 2003-02-24T12:32:44Z

    Tom Lane writes:
    
    > My feeling too.  Whatever you may think of its usefulness, it's been a
    > documented feature since 7.1.  It's a bit late to reconsider.
    
    It's never too late for new users to reconsider.  It's also never too late
    to change your application of performance is not satisfactory.
    
    -- 
    Peter Eisentraut   peter_e@gmx.net
    
    
    
  6. Re: ILIKE

    Vince Vielhaber <vev@michvhf.com> — 2003-02-24T12:38:34Z

    On Mon, 24 Feb 2003, Peter Eisentraut wrote:
    
    > Tom Lane writes:
    >
    > > My feeling too.  Whatever you may think of its usefulness, it's been a
    > > documented feature since 7.1.  It's a bit late to reconsider.
    >
    > It's never too late for new users to reconsider.  It's also never too late
    > to change your application of performance is not satisfactory.
    
    And if performance is satisfactory?
    
    Vince.
    -- 
     Fast, inexpensive internet service 56k and beyond!  http://www.pop4.net/
       http://www.meanstreamradio.com       http://www.unknown-artists.com
             Internet radio: It's not file sharing, it's just radio.
    
    
    
  7. Re: ILIKE

    Justin Clift <justin@postgresql.org> — 2003-02-24T14:39:20Z

    Peter Eisentraut wrote:
    > Tom Lane writes:
    > 
    >>My feeling too.  Whatever you may think of its usefulness, it's been a
    >>documented feature since 7.1.  It's a bit late to reconsider.
    > 
    > It's never too late for new users to reconsider.  It's also never too late
    > to change your application of performance is not satisfactory.
    > 
    
    Well, ILIKE has been a feature for quite some time and the amount of 
    negative feedback we've been receiving about upgrade problems makes me 
    feel that _removing_ it would be detrimental.  (i.e. broken applications)
    
    As an alternative to _removing_ it, would a feasible idea be to 
    transparently alias it to something else, say a specific type of regex 
    query or something?
    
    Regards and best wishes,
    
    Justin Clift
    
    -- 
    "My grandfather once told me that there are two kinds of people: those
    who work and those who take the credit. He told me to try to be in the
    first group; there was less competition there."
    - Indira Gandhi
    
    
    
  8. Re: ILIKE

    Vince Vielhaber <vev@michvhf.com> — 2003-02-24T15:13:06Z

    On Tue, 25 Feb 2003, Justin Clift wrote:
    
    > Peter Eisentraut wrote:
    > > Tom Lane writes:
    > >
    > >>My feeling too.  Whatever you may think of its usefulness, it's been a
    > >>documented feature since 7.1.  It's a bit late to reconsider.
    > >
    > > It's never too late for new users to reconsider.  It's also never too late
    > > to change your application of performance is not satisfactory.
    > >
    >
    > Well, ILIKE has been a feature for quite some time and the amount of
    > negative feedback we've been receiving about upgrade problems makes me
    > feel that _removing_ it would be detrimental.  (i.e. broken applications)
    >
    > As an alternative to _removing_ it, would a feasible idea be to
    > transparently alias it to something else, say a specific type of regex
    > query or something?
    
    Why screw with it for the sake of screwing with it?
    
    Vince.
    -- 
     Fast, inexpensive internet service 56k and beyond!  http://www.pop4.net/
       http://www.meanstreamradio.com       http://www.unknown-artists.com
             Internet radio: It's not file sharing, it's just radio.
    
    
    
  9. Re: ILIKE

    Tom Lane <tgl@sss.pgh.pa.us> — 2003-02-24T15:24:05Z

    Vince Vielhaber <vev@michvhf.com> writes:
    > On Tue, 25 Feb 2003, Justin Clift wrote:
    >> As an alternative to _removing_ it, would a feasible idea be to
    >> transparently alias it to something else, say a specific type of regex
    >> query or something?
    
    > Why screw with it for the sake of screwing with it?
    
    AFAICT, Peter isn't interested in changing the implementation, but in
    removing it outright (to reduce our nonstandardness, or something like
    that).  While we've removed marginal features in the past, I think this
    one is sufficiently popular that there's no chance of removing it just
    on the strength of the argument that it's not standard.
    
    The efficiency argument seemed irrelevant --- AFAICT, ILIKE is exactly
    as indexable as any equivalent regex substitute, which is to say
    "only if the pattern's leading characters are fixed (nonalphabetic)".
    
    			regards, tom lane
    
    
  10. Re: ILIKE

    Justin Clift <justin@postgresql.org> — 2003-02-24T15:29:01Z

    Vince Vielhaber wrote:
    <snip>
    > Why screw with it for the sake of screwing with it?
    
    Hmmm, good point.  "If it aint broke" ?
    
    Regards and best wishes,
    
    Justin Clift
    
    
    > Vince.
    
    -- 
    "My grandfather once told me that there are two kinds of people: those
    who work and those who take the credit. He told me to try to be in the
    first group; there was less competition there."
    - Indira Gandhi
    
    
    
  11. Re: ILIKE

    Peter Eisentraut <peter_e@gmx.net> — 2003-02-24T17:02:02Z

    Vince Vielhaber writes:
    
    > > It's never too late for new users to reconsider.  It's also never too late
    > > to change your application of performance is not satisfactory.
    >
    > And if performance is satisfactory?
    
    Hey, I don't want to take your ILIKE away.  But at the time it was added
    the claim was that it was for compatibility and now we learn that that was
    wrong.  That is something to make people aware of, for example in the
    documentation.
    
    -- 
    Peter Eisentraut   peter_e@gmx.net
    
    
    
  12. Re: ILIKE

    Tom Lane <tgl@sss.pgh.pa.us> — 2003-02-24T17:30:44Z

    Peter Eisentraut <peter_e@gmx.net> writes:
    > Hey, I don't want to take your ILIKE away.  But at the time it was added
    > the claim was that it was for compatibility and now we learn that that was
    > wrong.  That is something to make people aware of, for example in the
    > documentation.
    
    It already does say
    
    : The keyword ILIKE can be used instead of LIKE to make the match case
    : insensitive according to the active locale. This is not in the SQL
    : standard but is a PostgreSQL extension.
    
    What else would you want to say?
    
    			regards, tom lane
    
    
  13. Re: ILIKE

    Josh Berkus <josh@agliodbs.com> — 2003-02-24T18:39:15Z

    Four Reasons to use ILIKE, which have nothing to do with mSQL:
    
    1) It's faster to type than most analagous regexp comparisons, and much faster 
    than comparing two LOWERs or two UPPERS.
    
    2) It's a great operator for comparing two text variables or columns of small 
    tables where you don't want to worry about escaping the many items of regexp 
    punctuation.
    
    3) It's an easy search-and-replace operator for porting applications from SQL 
    databases which automatically do case-insensitive comparisons using LIKE, 
    such as MySQL and some installations of MSSQL.
    
    4) It's just as indexible (or not indexable) as regexp comparisons, and easier 
    to understand for users from the Microsoft world than regexp.
    
    And, on a quick search, one of my applications uses ILIKE 21 times in the 
    built in functions and views.
    
    -- 
    Josh Berkus
    Aglio Database Solutions
    San Francisco
    
    
  14. Re: ILIKE

    Peter Eisentraut <peter_e@gmx.net> — 2003-02-24T19:19:34Z

    Josh Berkus writes:
    
    > 4) It's just as indexible (or not indexable) as regexp comparisons, and easier
    > to understand for users from the Microsoft world than regexp.
    
    ILIKE is not indexible at all.  Other forms of pattern comparisons are at
    least indexible sometimes.
    
    -- 
    Peter Eisentraut   peter_e@gmx.net
    
    
    
  15. Re: ILIKE

    Josh Berkus <josh@agliodbs.com> — 2003-02-24T19:22:08Z

    Peter,
    
    > > 4) It's just as indexible (or not indexable) as regexp comparisons, and
    > > easier to understand for users from the Microsoft world than regexp.
    >
    > ILIKE is not indexible at all.  Other forms of pattern comparisons are at
    > least indexible sometimes.
    
    And how is  ~*  indexable?
    
    -- 
    Josh Berkus
    Aglio Database Solutions
    San Francisco
    
    
  16. Re: ILIKE

    Tom Lane <tgl@sss.pgh.pa.us> — 2003-02-24T21:25:51Z

    Peter Eisentraut <peter_e@gmx.net> writes:
    > Josh Berkus writes:
    >> 4) It's just as indexible (or not indexable) as regexp comparisons, and easier
    >> to understand for users from the Microsoft world than regexp.
    
    > ILIKE is not indexible at all.
    
    You are arguing from a false premise.
    
    regression=# create table foo (f1 text unique);
    NOTICE:  CREATE TABLE / UNIQUE will create implicit index 'foo_f1_key' for table 'foo'
    CREATE TABLE
    regression=# explain select * from foo where f1 ilike '123%';
                                   QUERY PLAN
    ------------------------------------------------------------------------
     Index Scan using foo_f1_key on foo  (cost=0.00..17.07 rows=5 width=32)
       Index Cond: ((f1 >= '123'::text) AND (f1 < '124'::text))
       Filter: (f1 ~~* '123%'::text)
    (3 rows)
    
    ILIKE is exactly as indexable as any other pattern that does the same
    thing.
    
    			regards, tom lane
    
    
  17. Re: ILIKE

    Hannu Krosing <hannu@tm.ee> — 2003-02-24T22:20:37Z

    Tom Lane kirjutas E, 24.02.2003 kell 19:30:
    > Peter Eisentraut <peter_e@gmx.net> writes:
    > > Hey, I don't want to take your ILIKE away.  But at the time it was added
    > > the claim was that it was for compatibility and now we learn that that was
    > > wrong. 
    
    This _is_ a compatibility feature, just not as straightforward as you
    may think, i.e. some databases have LIKE which behaves like our ILIKE.
    
    >  That is something to make people aware of, for example in the
    > > documentation.
    > 
    > It already does say
    > 
    > : The keyword ILIKE can be used instead of LIKE to make the match case
    > : insensitive according to the active locale. This is not in the SQL
    > : standard but is a PostgreSQL extension.
    > 
    > What else would you want to say?
    
    Perhaps add (From the mail of Josh Berkus):
    
    3) It's an easy search-and-replace operator for porting applications
    from SQL databases which automatically do case-insensitive comparisons
    using LIKE, such as MySQL and some installations of MSSQL.
    
    
    ---------------
    Hannu