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 B3B24329E67 for ; Wed, 22 Sep 2004 23:52:58 +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 65890-03 for ; Wed, 22 Sep 2004 22:52:50 +0000 (GMT) Received: from pimout7-ext.prodigy.net (pimout7-ext.prodigy.net [207.115.63.58]) by svr1.postgresql.org (Postfix) with ESMTP id 9C1EC329D18 for ; Wed, 22 Sep 2004 23:52:50 +0100 (BST) Received: from [192.168.1.207] (167.95.252.64.snet.net [64.252.95.167]) by pimout7-ext.prodigy.net (8.12.10 milter /8.12.10) with ESMTP id i8MMqmEQ040872 for ; Wed, 22 Sep 2004 18:52:49 -0400 Message-ID: <415202B6.7060903@kencast.com> Date: Wed, 22 Sep 2004 18:54:46 -0400 From: Wei Weng User-Agent: Mozilla Thunderbird 0.7 (Windows/20040616) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: LIKE operator and string comparison Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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/201 X-Sequence-Number: 19047 I used the following SQL code to match '\foo\bar' SELECT text FROM test WHERE text LIKE '\\\\foo\\\\%' But if I choose to use string comparison, instead of 4 escape characters, I only need 2. SELECT text FROM test WHERE text = '\\foo\\bar' Why is that? I am using PostgreSQL 7.4, and the SQL code was entered through psql. Thanks! Wei