NATURAL JOINs

Поиск
Список
Период
Сортировка
От Reg Me Please
Тема NATURAL JOINs
Дата
Msg-id 200810131852.57897.regmeplease@gmail.com
обсуждение исходный текст
Ответы Re: NATURAL JOINs
Список pgsql-general
Hi all.

I'm running v8.3.3

First point.
Is there a way to know how a NATURAL JOIN is actually done?
That is, which fields are actually used for the join?
The EXPLAIN directive doesn't show anyting useful.

Second point.
I have this:

CREATE TABLE tab_dictionary ( item text primary key );

CREATE TABLE tab_atable(
  item1 TEXT NOT NULL REFERENCES tab_dictionary( item ),
  item2 TEXT NOT NULL REFERENCES tab_dictionary( item ),
  trans NUMERIC NOT NULL
);

INSERT INTO tab_dictionary VALUES ( 'meters' ),('feet' );

INSERT INTO tab_atable VALUES ( 'meters','feet',3.28084 );

SELECT * FROM tab_atable NATURAL JOIN tab_dictionary;
 item1  | item2 |  trans  |  item
--------+-------+---------+--------
 meters | feet  | 3.28084 | meters
 meters | feet  | 3.28084 | feet
(2 rows)

Very likely I'm wrong, but this output looks wrong to me (and shold be wrong
also accordingly to the documentation).
Is there ant good explaination to this behaviour?

Thanks.


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

Предыдущее
От: Matthew Wilson
Дата:
Сообщение: More schema design advice requested
Следующее
От: "Richard Broersma"
Дата:
Сообщение: Re: NATURAL JOINs