Received: from candle.pha.pa.us (maillist@s5-03.ppp.op.net [209.152.195.67]) by hub.org (8.9.3/8.9.3) with ESMTP id WAA95222 for ; Tue, 6 Jul 1999 22:45:46 -0400 (EDT) (envelope-from maillist@candle.pha.pa.us) Received: (from maillist@localhost) by candle.pha.pa.us (8.9.0/8.9.0) id WAA00921; Tue, 6 Jul 1999 22:43:41 -0400 (EDT) From: Bruce Momjian Message-Id: <199907070243.WAA00921@candle.pha.pa.us> Subject: Re: [SQL] How match percent sign in SELECT using LIKE? In-Reply-To: <199903162255.OAA28174@netcom15.netcom.com> from Zalman Stern at "Mar 16, 1999 02:55:33 pm" To: Zalman Stern Date: Tue, 6 Jul 1999 22:43:41 -0400 (EDT) CC: herouth@oumail.openu.ac.il, pgsql-sql@postgreSQL.org X-Mailer: ELM [version 2.4ME+ PL56 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Here are the TODO items: * Allow ESCAPE '\' at the end of LIKE for ANSI compliance * Rewrite the LIKE handling by rewriting the user string with the supplied ESCAPE > 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@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026