Re: problem with query - Mailing list pgsql-general

From Roberto Scattini
Subject Re: problem with query
Date
Msg-id CAApYZY-cQARqvjT=CFjKVabCgeUdKDQaAe1xA7bJ7e1dm7MS8Q@mail.gmail.com
Whole thread Raw
In response to Re: problem with query  (Chris Curvey <chris@chriscurvey.com>)
Responses Re: problem with query  (John R Pierce <pierce@hogranch.com>)
Re: problem with query  (David Johnston <polobo@yahoo.com>)
List pgsql-general



On Thu, Sep 12, 2013 at 6:49 PM, Chris Curvey <chris@chriscurvey.com> wrote:


Is this just a case-sentitvity issue?  if personas.apellido is a varchar field, then I think that's your trouble.  (it would have to be citext in order for "nunez" = "NUNEZ".)  



yes, is just a case-sensitivity issue. yes, is a varchar field. 
but what i dont understand is why the problem of "insensitivity" is only with ñ (lower). i mean, if i remove my ñ (and subsecuent chars), both querys return the same rows:

pgon=# set client_encoding = SQL_ASCII;
SET
pgon=# SELECT DISTINCT
 p.id, p.apellido, p.nombre
 FROM personal.personas AS p
  WHERE p.apellido ilike '%NU%';
  id   |    apellido    |      nombre
-------+----------------+------------------
 39489 | NUÑEZ          | JUAN
 39937 | PEREZ NUÑEZ    | FRANCISCO
 40229 | PANNUNZIO      | MARIA CRISTINA
 39453 | GUARNUCIO      | CARLA GISELLE
 39498 | NUÑEZ ESQUIBEL | RICARDO RODOLFO
 40326 | MANUZZA        | ANDREA ALEJANDRA
 40205 | NIETO FRAGNUL  | LAUTARO ALFREDO
 40220 | NUÑEZ VERA     | MANUEL SANTIAGO
(8 rows)

pgon=# SELECT DISTINCT
 p.id, p.apellido, p.nombre
 FROM personal.personas AS p
  WHERE p.apellido ilike '%nu%';
  id   |    apellido    |      nombre
-------+----------------+------------------
 39489 | NUÑEZ          | JUAN
 39937 | PEREZ NUÑEZ    | FRANCISCO
 40229 | PANNUNZIO      | MARIA CRISTINA
 39453 | GUARNUCIO      | CARLA GISELLE
 39498 | NUÑEZ ESQUIBEL | RICARDO RODOLFO
 40326 | MANUZZA        | ANDREA ALEJANDRA
 40205 | NIETO FRAGNUL  | LAUTARO ALFREDO
 40220 | NUÑEZ VERA     | MANUEL SANTIAGO
(8 rows)


what makes the 'ñ' char special that makes the queries the same when it is not there?

--
Roberto Scattini

pgsql-general by date:

Previous
From: Bosco Rama
Date:
Subject: Re: problem with query
Next
From: Roberto Scattini
Date:
Subject: Re: problem with query