Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TCAGg-0004dL-BK for pgsql-sql@postgresql.org; Thu, 13 Sep 2012 14:19:46 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TCAGc-0006Ro-CI for pgsql-sql@postgresql.org; Thu, 13 Sep 2012 14:19:45 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q8DEJfPX026100; Thu, 13 Sep 2012 10:19:41 -0400 (EDT) From: Tom Lane To: "Sergio Calero." cc: "pgsql-sql@postgresql.org" Subject: Re: underscore pattern in a query doens't work In-reply-to: <1347535420.27469.YahooMailNeo@web29502.mail.ird.yahoo.com> References: <1347535420.27469.YahooMailNeo@web29502.mail.ird.yahoo.com> Comments: In-reply-to "Sergio Calero." message dated "Thu, 13 Sep 2012 12:23:40 +0100" Date: Thu, 13 Sep 2012 10:19:41 -0400 Message-ID: <26099.1347545981@sss.pgh.pa.us> X-Pg-Spam-Score: -2.4 (--) X-Archive-Number: 201209/34 X-Sequence-Number: 36836 "Sergio Calero." writes: > I'd like to execute a query using the underscore as a pattern. > select id,etiqueta from limites_municipales where etiqueta like 'Garaf_a'; > [ but this fails to match 'Garafía' ] I suspect what you have here is an encoding problem. That is, probably the "í" is represented as a multi-byte character (most likely UTF8) but the server thinks it's working with a single-byte encoding so that any one character should be only one byte. You didn't say what your encoding setup is, so it's hard to do more than speculate. > PostgreSQL 8.4.1 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-10), 64-bit You do realize this is about 3 years out of date? The 8.4 series is up to release 8.4.13, and a lot of those updates contained fixes for serious bugs. regards, tom lane