strange behvaviour in join? BUG in 7.02? 
Author Message
 strange behvaviour in join? BUG in 7.02?

I have PSQL 7.02

classic join on Two tables:

select l.id from linia l,lk_strefa2linia lk
where l.id = lk.fk_linia and lk.fk_strefa=5;

gives correct linia.ids.

but
select linia.id from linia l,lk_strefa2linia lk
where l.id = lk.fk_linia and lk.fk_strefa=5;

(the only difference is second word: linia.id instead l.id)
will give totaly different results).

tables definitions:

mlotdev=> \d lk_strefa2linia
    Table "lk_strefa2linia"
 Attribute |  Type   | Modifier
-----------+---------+----------
 fk_strefa | integer | not null
 fk_linia  | integer | not null
Index: lk_strefa2linia_ukey

mlotdev=> \d linia
                             Table "linia"
 Attribute |    Type     |                  Modifier
-----------+-------------+---------------------------------------------
 id        | integer     | not null default nextval('seq_linia'::text)
 fk_typ    | integer     | not null
 numer     | char(10)    | not null
 status    | char(1)     | not null default '?'
 stamp     | timestamp   | not null default now()
 opis      | varchar(64) | not null
 skrot     | varchar(16) | not null
Index: linia_pkey

Please CC answer to me. Thanx!

--
radoslaw.stachowiak......................................... http://www.***.com/



Tue, 29 Apr 2003 18:46:09 GMT
 strange behvaviour in join? BUG in 7.02?

Quote:

> You are actually doing a 3-way join, with linia included twice.
> It is implicitly included a second time when a column is referenced
> from it without the alias.

7.1 will provide a NOTICE that's intended to alert people that such
constructs probably don't do what they're expecting:

regression=# select f.f1, int4_tbl.f1 from int4_tbl f;
NOTICE:  Adding missing FROM-clause entry for table "int4_tbl"

although I wonder whether this will leave the query author any
less confused :-(.

                        regards, tom lane



Tue, 29 Apr 2003 23:03:07 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Problems with DB/2 Personal Edition with Mandrake 7.02

2. MSDE 2000 Merge Modules in InstallShield 7.02 Project

3. GUI for PostgeSQL 7.02

4. ms access to sybase ASA 7.02

5. Configure problems on Solaris 2.7, pgsql 7.02 and 7.03

6. BUGS idapi BUGS idapi BUGS idapi BUGS

7. Trouble with strange OUTER JOIN syntax

8. strange problem (mayby bug?)

9. Strange SQL Results from Join?

10. Replication -- very strange ( bug???)

11. Strange outer Join prob... Pls Help

12. Strange LEFT | RIGHT | FULL JOIN behaviour


 
Powered by phpBB® Forum Software