Re: Something strang on "left join"

From: jeanpierre(dot)carayol(at)free(dot)fr
To: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Cc: 陳世泓 <adam_chen(at)bankpro(dot)com(dot)tw>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Something strang on "left join"
Date: 2017-09-28 10:01:43
Message-ID: 783812923.668562497.1506592903818.JavaMail.root@zimbra48-e8.priv.proxad.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I also suspect the ID columns values for lines identified by CUST-NO.

Sorry to ask an additionnal question here. There is a useful Oracle function dump() to check the internal field value. Is there anything similar with PostgreSQL ?

Many thanks for your help.

Best Regards,
Jean-Pierre

----- Mail original -----

De: "Tomas Vondra" <tomas(dot)vondra(at)2ndquadrant(dot)com>
À: "陳世泓" <adam_chen(at)bankpro(dot)com(dot)tw>, pgsql-bugs(at)postgresql(dot)org
Envoyé: Jeudi 28 Septembre 2017 11:14:11
Objet: Re: [BUGS] Something strang on "left join"

On 09/28/2017 08:17 AM, 陳世泓 wrote:
> Hi,
>
>
>
> My pgsql version is 9.6, and I got something wrong result while
> using left join.
>
>
>
> We used “left join” to join t1 and t2, the result of the first
> row was wrong ,here is the LEFT JOIN result.
>
>
>
> 1. select * from cicifcif
>
> 2. select * from eccifidi
>
> 3. select * from cicifcif t1 left join eccifidi t2 on
> t1."CI-CUST-NO" = t2."EC-CUST-NO" ORDER BY T1."CI-CUST-NO"
>
>
>
> THE LEFT JOIN RESULT OF THE FIRST ROW , COLUMNS OF eccifidi SHOULD BE
> “222”,”N”,”Y”….
>

Chances are some of the ID columns contain spaces or some other
whitespace characters. Try length() on them:

SELECT length("CI-CUST-NO") FROM ...
SELECT length("EC-CUST-NO") FROM ...

regards

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-bugs mailing list (pgsql-bugs(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message 陳世泓 2017-09-28 10:53:13 Re: Something strang on "left join"
Previous Message ivo 2017-09-28 09:25:29 BUG #14833: Row security policies using session variable can be circumvented