Re: : Re: A strange problem

From: Ragnar Hafstað <gnari(at)simnet(dot)is>
To: Tang Tim Hei <timheit(at)netvigator(dot)com>
Cc: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: : Re: A strange problem
Date: 2005-08-28 14:38:51
Message-ID: 1125239931.22356.5.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2005-08-28 15:11:39 Re: : Re: A strange problem
Previous Message Ben-Nes Yonatan 2005-08-28 10:03:27 Re: postgresql performance degradation over time....