Re: using NOLOCK cause Cartesian joins - Mailing list pgsql-general

From Stephan Szabo
Subject Re: using NOLOCK cause Cartesian joins
Date
Msg-id 20031112120720.B15835@megazone.bigpanda.com
Whole thread Raw
In response to using NOLOCK cause Cartesian joins  ("Roger Gordon" <Roger@emojo.com>)
List pgsql-general
On Wed, 12 Nov 2003, Roger Gordon wrote:

> When we use WITH (NOLOCK) at the end of table list in a SELECT query, a
> Cartesian join is returned (i.e. approximately  6,500 records instead of
> 57, which is distressing.

I'm guessing you mean something like:
select *
from table1, table2 WITH (NOLOCK)
where table1.foo=table2.bar;
?

If so, it should be giving you a notice like:
adding missing FROM-clause entry for table "table2"
because you've aliased table2 as the name WITH and the first column
of said table as NOLOCK (if I'm remembering the details correctly)
so table2 isn't in scope in the where clause.

As far as we can tell a query like the above is technically illegal in
SQL but 7.3 and earlier will always add an extra entry as if you had
done from table1, table2 WITH (NOLOCK), table2.  7.4 has an option to
instead error.


pgsql-general by date:

Previous
From: Greg Stark
Date:
Subject: Re: using NOLOCK cause Cartesian joins
Next
From: Adam Ruth
Date:
Subject: Re: Column Sizes