join error?
От
Kemin Zhou
Тема
join error?
Дата
Msg-id
424B2C4D.7040109@san.rr.com
Список
Дерево обсуждения
join error? Kemin Zhou <kzhou@san.rr.com>
Re: join error? Michael Fuhr <mike@fuhr.org>
I just found out one strange behavior of the SQL engine. This may be fixed.
table 1
create table table1 ( id integer, something text);
create table table2 (id integer, otherthing text);
select *
from table1 t1, table2 t2
where t1.id=table2.id;
-- here I made a mistake in the where clause I should have used
-- where t1.id=t2.id
This query produces a lot of MORE rows than it should be, and it is doing cross join.
I am not sure this is considered a normal behavior or not. Whatever, the sql programmers
should be aware such mistakes.
If you have any comments please let me know.
Thanks.
Kemin
table 1
create table table1 ( id integer, something text);
create table table2 (id integer, otherthing text);
select *
from table1 t1, table2 t2
where t1.id=table2.id;
-- here I made a mistake in the where clause I should have used
-- where t1.id=t2.id
This query produces a lot of MORE rows than it should be, and it is doing cross join.
I am not sure this is considered a normal behavior or not. Whatever, the sql programmers
should be aware such mistakes.
If you have any comments please let me know.
Thanks.
Kemin
В списке pgsql-general по дате отправления