Re: BUG #2549: problem with NATURAL JOIN

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: BUG #2549: problem with NATURAL JOIN
Дата
Msg-id 20060725120239.GA35144@winnie.fuhr.org
обсуждение исходный текст
Ответ на BUG #2549: problem with NATURAL JOIN  ("Kayteck" <kayteck_master@o2.pl>)
Список pgsql-bugs
On Tue, Jul 25, 2006 at 12:58:55AM +0000, Kayteck wrote:
> 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_przelewu,id_zamowienia from zamowienia natural join przelew where
> id_klienta=4999;
>  id_przelewu | id_zamowienia
> -------------+---------------
> (0 rows)

Do zamowienia and przelew have column names in common in addition
to id_przelewu?  NATURAL JOIN uses all common column names, not
just those specified in a foreign key constraint.

http://www.postgresql.org/docs/8.1/interactive/queries-table-expressions.html#QUERIES-FROM

"Finally, NATURAL is a shorthand form of USING: it forms a USING
list consisting of exactly those column names that appear in both
input tables."

http://www.postgresql.org/docs/8.1/interactive/sql-select.html#SQL-FROM

"NATURAL is shorthand for a USING list that mentions all columns
in the two tables that have the same names."

--
Michael Fuhr

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #2549: problem with NATURAL JOIN
Следующее
От: "Zuleima Lara"
Дата:
Сообщение: BUG #2551: to_char a to_number