Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 78DB92E036B for ; Wed, 13 Feb 2008 12:52:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 93487-05 for ; Wed, 13 Feb 2008 12:52:44 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 4D8E82E0348 for ; Wed, 13 Feb 2008 12:52:44 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m1DGqgxx016829; Wed, 13 Feb 2008 11:52:42 -0500 (EST) To: Richard Huxton cc: "Campbell, Lance" , pgsql-sql@postgresql.org Subject: Re: Like problem In-reply-to: <47B31DEC.5050109@archonet.com> References: <47B31DEC.5050109@archonet.com> Comments: In-reply-to Richard Huxton message dated "Wed, 13 Feb 2008 16:42:20 +0000" Date: Wed, 13 Feb 2008 11:52:41 -0500 Message-ID: <16828.1202921561@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/99 X-Sequence-Number: 30190 Richard Huxton writes: > Campbell, Lance wrote: >> WARNING: nonstandard use of escape in a string literal >> LINE 1: ...ct c1 from t1 where c1 like '%abc\_%'; > Either indicate you are using an escaped string: LIKE E'%abc\_%' Actually that's wrong, what he'd need is LIKE E'%abc\\_%' (or omit the E and ignore the warning). Alternatively, set standard_conforming_strings to TRUE and write LIKE '%abc\_%' ... but beware that that might break other parts of your app that are expecting backslash to be special. > Or, change the escape character: LIKE '%abcQ_%' ESCAPE 'Q' Yeah, this might be the easiest localized solution. regards, tom lane