Re: problem with query - Mailing list pgsql-general

From Chris Curvey
Subject Re: problem with query
Date
Msg-id CADfwSsCu89SYEGLohutCrp0_k4h8qNHWXYiRPCR05w=_wODuoQ@mail.gmail.com
Whole thread Raw
In response to problem with query  (Roberto Scattini <roberto.scattini@gmail.com>)
Responses Re: problem with query  (Roberto Scattini <roberto.scattini@gmail.com>)
List pgsql-general


On Thu, Sep 12, 2013 at 4:34 PM, Roberto Scattini <roberto.scattini@gmail.com> wrote:
hi, today we discovered that this query doesn't return the expected values:

SELECT DISTINCT
 p.id, p.apellido AS "Apellido", p.nombre AS "Nombre", pf.nombre AS "Funcion", to_char(da.f_ingreso_pg, 'dd/mm/yyyy') AS "Fecha Ingreso PG", e.estado AS "Estado", to_char(pe.fecha, 'dd/mm/yyyy') AS "Fecha Estado"
 FROM personal.personas AS p
  LEFT JOIN personal.personas_da_pg AS da ON p.id=da.id_persona
  LEFT JOIN personal.personas_estado AS pe ON da.estado_id=pe.id
  LEFT JOIN personal.estados AS e ON pe.id_estado=e.id
  LEFT JOIN procu_departamento AS d ON d.id=da.id_departamento
  LEFT JOIN procu_departamento AS dto ON left(d.c_organigrama, 4)||'000'=dto.c_organigrama
  LEFT JOIN procu_departamento AS dir ON left(d.c_organigrama, 3)||'0000'=dir.c_organigrama
  LEFT JOIN procu_departamento AS dg ON left(d.c_organigrama, 2)||'00000'=dg.c_organigrama
  LEFT JOIN personal.funciones AS pf ON pf.id=da.funcion_id
  LEFT JOIN personal.profesiones AS pp ON pp.id=p.id_profesion
 WHERE p.apellido ilike '%nuñez%'
 ORDER BY "Apellido"

the exact same query with  ilike '%NUÑEZ%' works OK...

we are using postgresql 9.1 from ubuntu packages and the database encoding is (sadly) SQL_ASCII

can anybody point me in the right direction to solve this issue?

--
Roberto Scattini

If you could tells what you are expecting, and what you are actually getting, that would be helpful.

--
The person who says it cannot be done should not interrupt the person who is doing it.  -- Chinese Proverb

pgsql-general by date:

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