Re: [SQL] How match percent sign in SELECT using LIKE?

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Zalman Stern <zalman(at)netcom(dot)com>
Cc: herouth(at)oumail(dot)openu(dot)ac(dot)il, pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] How match percent sign in SELECT using LIKE?
Date: 1999-07-07 02:42:29
Message-ID: 199907070242.WAA00906@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


I have added this to the TODO list. It is a good idea.

> Bruce Momjian wrote:
> > That is also an excellent idea. Just convert their escape to \ inside
> > the parser. Of course, they still have to use \\ to get a \, as in any
> > string. Great idea.
>
> You can even make it fully compliant if you want. (There are of course
> backward compatibility problems. I'm not sure what the Postgres policy is
> on this.)
>
> - If the escape character is backslash, do nothing.
> - Otherwise, turn all backslashes in the string to double backslashes.
> - If the escape character is not set, stop here.
> - Turn all occurences of the escape character into a backslash except
> where the escape character is doubled, where it should be made into a
> single occurence.
> (Optionally, if "\n" is just an 'n' character, you can handle double
> occurences of the escape character by turning the first one into a
> backslash.)
>
> Probably the best bet for PostgreSQL programmers is to always code Like
> clauses with an ESCAPE '\' (or however its written).
>
> I really wish they'd chosen a character other than underscore for the
> "match one" wildcard... Is there any standard practice for seperating words
> in table names?
>
> -Z-
>

--
Bruce Momjian | http://www.op.net/~candle
maillist(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 Bruce Momjian 1999-07-07 02:43:41 Re: [SQL] How match percent sign in SELECT using LIKE?
Previous Message Bob Dusek 1999-07-06 23:55:19 Re: [GENERAL] sorting by date & time in descending order ??