Re: problem with query

From: Chris Curvey <chris(at)chriscurvey(dot)com>
To: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: problem with query
Date: 2013-09-12 21:22:51
Message-ID: CADfwSsCu89SYEGLohutCrp0_k4h8qNHWXYiRPCR05w=_wODuoQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Sep 12, 2013 at 4:34 PM, Roberto Scattini <
roberto(dot)scattini(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Roberto Scattini 2013-09-12 21:33:22 Re: problem with query
Previous Message Roberto Scattini 2013-09-12 20:34:57 problem with query