Received: from geocities.com (mail10.geocities.com [209.1.224.138]) by hub.org (8.9.3/8.9.3) with ESMTP id AAA64399; Tue, 27 Jul 1999 00:23:12 -0400 (EDT) (envelope-from dan_wilson@geocities.com) Received: from dwilson (bbudnick.employees.fiber.net [216.83.131.7]) by geocities.com (8.9.3/8.9.3) with ESMTP id VAA25714; Mon, 26 Jul 1999 21:23:09 -0700 (PDT) Message-ID: <007c01bed7e7$f61f0d80$9e05fea9@dwilson> From: "Dan Wilson" To: "pgsql general" , References: Subject: Re: [GENERAL] escaping wildcard chars Date: Mon, 26 Jul 1999 07:52:30 -0600 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 > Yes. Use '\\_%' instead. You see, a backslash is interpreted immediately as > "take the next char literally". This passes the underscore literally to > LIKE. Which is the same as '_%'. If you put a double backslash, the first > backslash takes the second one literally, thus passing '\_%' to LIKE. And > then LIKE knows that it should treat the underscore as non-special. I tried this and it didn't work either. I eventually got carried away and did '\\\_%' and it worked. What a pain! > I really hate those backslashes. They are blatantly incompatible with SQL92 > and will cause standard SQL to fail on Postgres, (and of course, Postgres > code to fail on other databases). There should be a setting, either in the > backend or in a SET command, such as "BACKSLASH_BEHAVIOR", which will be > either "literal" or "escape". It can default to the current behavior > (namely "escape") so that current code won't fail, but will enable people > to write sane standard code. I totally agree here. There should be some way to turn it off so that those who are starting out can write standard stuff. -Dan