Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

BUG #2549: problem with NATURAL JOIN



The following bug has been logged online:

Bug reference:      2549
Logged by:          Kayteck
Email address:      kayteck_master(at)o2(dot)pl
PostgreSQL version: 8.1.3
Operating system:   Fedora Core 4
Description:        problem with NATURAL JOIN
Details: 

I have two tables joined by foreign key id_przelewu, and for some rows
results of queries with NATURAL JOIN and JOIN ... USING (...) differs ! I've
readed that NATURAL JOIN is only shorthand for the second method, but this
results shows that's not true:
select id_zamowienia,id_przelewu from zamowienia where id_klienta=4999;
 id_zamowienia | id_przelewu 
---------------+-------------
          7504 |        3095
          7503 |        3095
          7408 |        3095
(3 rows)

select id_przelewu from przelew where id_przelewu=3095;
 id_przelewu 
-------------
        3095
(1 row)

select id_przelewu,id_zamowienia from zamowienia natural join przelew where
id_klienta=4999;
 id_przelewu | id_zamowienia 
-------------+---------------
(0 rows)

select id_przelewu,id_zamowienia from zamowienia join przelew using (id_p
rzelewu) where id_klienta=4999;
 id_przelewu | id_zamowienia 
-------------+---------------
        3095 |          7504
        3095 |          7503
        3095 |          7408
(3 rows)

It seems for an error of postgresql



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group