Re: Search for underscore w/ LIKE

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: brianb-pgsql(at)edsamail(dot)com, pgsql-sql(at)postgresql(dot)org
Subject: Re: Search for underscore w/ LIKE
Date: 2000-07-07 18:24:19
Message-ID: 200007071824.OAA01965@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> I wrote:
> > Similarly, '\\%' would be the way to match a literal %. You can
> > actually backslash-quote any single character this way in LIKE,
> > but % and _ are the only ones where it makes a difference.
>
> Er, check that. Backslash itself also needs quoting in LIKE.
>
> Exercise for the student: if you need to match a literal backslash
> in a LIKE pattern, how many backslashes do you have to write in your
> query?

I will fix the book. Seems I didn't do the test properly.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Antoine Reid 2000-07-07 19:32:23 Re: confused by select.
Previous Message Web Manager 2000-07-07 18:23:22 Re: order by accents?