From: | Reg Me Please <regmeplease(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | NATURAL JOINs |
Date: | 2008-10-13 16:52:57 |
Message-ID: | 200810131852.57897.regmeplease@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Broersma | 2008-10-13 16:59:28 | Re: NATURAL JOINs |
Previous Message | Matthew Wilson | 2008-10-13 16:29:45 | More schema design advice requested |