Re: [HACKERS] Bug on complex join

Oleg Broytmann <phd@sun.med.ru>

From: Oleg Broytmann <phd@sun.med.ru>
To: "Thomas G. Lockhart" <lockhart@alumni.caltech.edu>
Cc: PostgreSQL-development <pgsql-hackers@postgreSQL.org>
Date: 1999-03-05T15:13:50Z
Lists: pgsql-hackers
Hi!

On Fri, 5 Mar 1999, Thomas G. Lockhart wrote:
> > SELECT  sh.distr_id , d.distr_id
> >    FROM central cn, shops sh, districts d
> >       WHERE cn.shop_id = sh.shop_id
> > and got 27963 rows.
> >    But the query
> > SELECT d.*
> >    FROM central cn, shops sh, districts d
> >       WHERE cn.shop_id = sh.shop_id AND sh.distr_id = d.distr_id
> 
> Why did you change both the target columns *and* the query qualification
> between these two examples? Is the "SELECT d.*" required to get the
> query to fail?? If not, then...

   Cause I need something in the target list. Wrong way to test it? What is
a better way?

> For some reason sh.distr_id is not equal to d.distr_id. Are they
> different data types? Do they have some embedded blanks?? Probably not a

   Both are int2. No blanks (at least I cannot imagine blanks in int2 :).

> Postgres bug, since the query itself looks pretty simple...

   That's why I am very confused. :(

> 
>                      - Tom
> 

Oleg.
---- 
    Oleg Broytmann  National Research Surgery Centre  http://sun.med.ru/~phd/
           Programmers don't die, they just GOSUB without RETURN.