Re: [BUGS] Something strang on "left join" - Mailing list pgsql-bugs

From Tomas Vondra
Subject Re: [BUGS] Something strang on "left join"
Date
Msg-id 8543f288-4988-4f1b-0c65-aa3c6acff61a@2ndquadrant.com
Whole thread Raw
In response to [BUGS] Something strang on "left join"  (陳世泓 <adam_chen@bankpro.com.tw>)
Responses Re: [BUGS] Something strang on "left join"
Re: [BUGS] Something strang on "left join"
List pgsql-bugs

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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

pgsql-bugs by date:

Previous
From: 陳世泓
Date:
Subject: [BUGS] Something strang on "left join"
Next
From: Ivo Limmen
Date:
Subject: [BUGS] Row security policies using session variable can be circumvented