7.0.3 select/join syntax?

Поиск
Список
Период
Сортировка
Искать

7.0.3 select/join syntax?

От:
will trillich <will@serensoft.com>
Дата:
i've been perusing the source code for Aparthia (it's a mod_perl
and HTML::Mason website framework that hooks into postgresql)
which contained some perl stuff like

my $st = $dbh->prepare("SELECT a.auction_id,a.title,f.grade,f.comment, login(f.person_id)
	FROM forum f join auction a on (auction_id)
	WHERE f.auction_id = ? and f.person_id = ?");

i can't find "JOIN" in the documentation i've got (for 7.0.3)
regarding the SELECT statement...

select
	a.auction_id,
	a.title,
	f.grade,
	f.comment,
	login(f.person_id)
from
	forum f
	JOIN auction a ON (auction_id) -- say what?
where
	f.auction_id = ?
	and
	f.person_id = ?

i presume that basically adds a WHERE clause like
	forum f join auction a on (auction_id)
	==
	where f.auction_id = a.auction_id
? (i could be wrong, i suppose.)

which i tried on some of my databases, and what i get instead is
"ambiguous"--

	> select e.name,t.name from _edu e join _topic t on (id);
	ERROR:  Column 'id' is ambiguous

are there some unreleased docs that detail this feature?

-- 
I figure: if a man's gonna gamble, may as well do it
without plowing.   -- Bama Dillert, "Some Came Running"

will@serensoft.com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

Re: 7.0.3 select/join syntax?

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
will trillich  writes:
> are there some unreleased docs that detail this feature?

It's undocumented in 7.0.* because it's not all there.
Try 7.1.

			regards, tom lane
FAQ