Re: : Re: A strange problem - Mailing list pgsql-general

From Ragnar Hafstað
Subject Re: : Re: A strange problem
Date
Msg-id 1125239931.22356.5.camel@localhost.localdomain
Whole thread Raw
In response to Re: : Re: A strange problem  (Tang Tim Hei <timheit@netvigator.com>)
List pgsql-general
On Sun, 2005-08-28 at 16:22 +0800, Tang Tim Hei wrote:

> The following commands are little different from the previous one.
> (1) select A.* from test.currency A, test.price_list B where A.curr_cd=B.curr_cd and A.curr_cd='USD'
> (2) select A.* from test.currency A, test.price_list B, test.country C where A.curr_cd=B.curr_cd and A.curr_cd='USD'
>
> For command (1), it is ok. The result is what I expect.
> However, for command (2), it has problem. I added the "test.country C" to it,
> here I actually just write a table name to it and no more other purpose.

I do not understand what you mean by that.
the added table name means an additional cartesian join

> However, the result maybe totally different.

that is because of the added cartesian join

> If the table "country" is not empty, the result is just the same as in command (1)

it will only be the same if the table contains EXACTLY 1 row

>  but if "country" is empty, there are no result row.

a cartesian join to 0 rows results in 0 rows

if you are talking about something else, please
show us a concrete simple example.

gnari




pgsql-general by date:

Previous
From: Ben-Nes Yonatan
Date:
Subject: Re: postgresql performance degradation over time....
Next
From: Stephan Szabo
Date:
Subject: Re: : Re: A strange problem