Received: from mx99.openu.ac.il (arbel.openu.ac.il [147.233.32.4]) by hub.org (8.9.2/8.9.1) with ESMTP id GAA02179 for ; Tue, 16 Mar 1999 06:51:51 -0500 (EST) (envelope-from herouth@oumail.openu.ac.il) Received: from talmon.openu.ac.il (talmon.openu.ac.il [147.233.32.11]) by mx99.openu.ac.il (Postfix) with ESMTP for id 33CAB4B4A0; Tue, 16 Mar 1999 13:51:49 +0200 (IST) Received: from [147.233.159.109] (mac-herouth.pc.openu.ac.il) by talmon.openu.ac.il (Netscape Messaging Server 3.54) with ESMTP id AAA99C; Tue, 16 Mar 1999 13:53:28 +0200 X-Sender: herouth@shaked.cc.openu.ac.il Message-Id: In-Reply-To: <199903151545.KAA14287@candle.pha.pa.us> References: <199903110845.JAA02036@pandora3.uni-bremen.de> from Ulf Mehlig at "Mar 11, 1999 9:45:45 am" Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Tue, 16 Mar 1999 13:52:52 +0200 To: Bruce Momjian From: Herouth Maoz Subject: Re: [SQL] How match percent sign in SELECT using LIKE? Cc: pgsql-sql@postgreSQL.org At 17:45 +0200 on 15/3/99, Bruce Momjian wrote: > I have overhauled the LIKE code. %% is not a literal %, but is the same > as wildcard %. Literal % is \%. This is not SQL 92 compliant, is it? The standard states that if you don't have an ESCAPE part to the like (i.e. abc LIKE 'bla\%%' ESCAPE '\'), then there is no escape. I think the correct thing to do is to support the ESCAPE clause: - - - begin quotation - - - Format ::= [ NOT ] LIKE [ ESCAPE ] ::= ::= ::= [snip] a) If an is specified, then: i) If the length in characters of E is not equal to 1, then an exception condition is raised: data exception-invalid escape character. ii) If there is not a partitioning of the string P into sub- strings such that each substring has length 1 or 2, no substring of length 1 is the escape character E, and each substring of length 2 is the escape character E followed by either the escape character E, an character, or the character, then an exception condition is raised: data exception-invalid escape sequence. If there is such a partitioning of P, then in that parti- tioning, each substring with length 2 represents a single occurrence of the second character of that substring. Each substring with length 1 that is the character represents an arbitrary character specifier. Each substring with length 1 that is the character represents an arbitrary string specifier. Each substring with length 1 that is neither the character nor the character represents the character that it contains. b) If an is not specified, then each character in P represents an arbitrary character spec- ifier, each character in P represents an arbitrary string specifier, and each character in P that is neither the character nor the character represents itself. - - - end quotation - - - Herouth -- Herouth Maoz, Internet developer. Open University of Israel - Telem project http://telem.openu.ac.il/~herutma