"Grant Morgan" <[EMAIL PROTECTED]> writes: > select count(*) > from h left join p using (r,pos) > where h.tn > 20 > and h.tn < 30 > and p.r_order=1
> since it is a left join I though I should get a number no smaller in > the left join than the original unjoined query. It seems to be acting > like an inner join. Well, yeah. The condition p.r_order=1 will return NULL (effectively FALSE) for any row in which p.r_order is NULL, so none of the null-extended rows can survive the WHERE filter, so it's effectively an inner join. Recent versions of PG actively recognize this case and reduce the LEFT JOIN to plain JOIN, but even if we did not do that you'd get the same result. I've heard it claimed that Oracle produces different results; if true, it must have something to do with their rather standards-challenged interpretation of NULL ... regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]