X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 80FDC329E70 for ; Thu, 23 Sep 2004 00:20:56 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72203-04 for ; Wed, 22 Sep 2004 23:20:47 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0D0DA329D18 for ; Thu, 23 Sep 2004 00:20:49 +0100 (BST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id i8MNKmvj019720; Wed, 22 Sep 2004 19:20:48 -0400 (EDT) To: Wei Weng Cc: pgsql-sql@postgresql.org Subject: Re: LIKE operator and string comparison In-reply-to: <41520882.6020702@kencast.com> References: <415202B6.7060903@kencast.com> <19606.1095894584@sss.pgh.pa.us> <41520882.6020702@kencast.com> Comments: In-reply-to Wei Weng message dated "Wed, 22 Sep 2004 19:19:30 -0400" Date: Wed, 22 Sep 2004 19:20:48 -0400 Message-ID: <19719.1095895248@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/204 X-Sequence-Number: 19050 Wei Weng writes: > What about in regular strings? I do need to use backslash to escape the > other backslash in order to get the '\'. Why isn't that the case in LIKE > operation? It is. You write four backslashes in order to describe a string constant value containing two backslashes. When the LIKE code sees that, it interprets it as one quoted backslash. See LIKE ... ESCAPE if you'd like to use a different escape character in the LIKE pattern. regards, tom lane