Re: underscore pattern in a query doens't work

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Sergio Calero(dot)" <angusyoung4(at)yahoo(dot)es>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: underscore pattern in a query doens't work
Date: 2012-09-13 14:19:41
Message-ID: 26099.1347545981@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Sergio Calero." <angusyoung4(at)yahoo(dot)es> 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 'Garafa' ]

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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Sergio C. 2012-09-13 15:04:34 Re: underscore pattern in a query doens't work
Previous Message Sergey Konoplev 2012-09-13 13:52:47 Re: generate_series() with TSTZRANGE