join error?

From: Kemin Zhou <kzhou(at)san(dot)rr(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: join error?
Date: 2005-03-30 22:46:37
Message-ID: 424B2C4D.7040109@san.rr.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Doug McNaught 2005-03-30 22:55:13 Re: Upgrade data
Previous Message Greg Stark 2005-03-30 22:41:04 Re: Debugging deadlocks