OSDN Git Service

Make reduce_outer_joins() smarter about semijoins.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 30 Jan 2011 22:04:31 +0000 (17:04 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 30 Jan 2011 22:04:31 +0000 (17:04 -0500)
commit9688c4e6f1516d2fc0db5d200112c4d91538878d
tree9d41e022c5f4439525e9228a942a8e264071cb33
parent507069de6dbe18c2163f27fbc780673eef8c5622
Make reduce_outer_joins() smarter about semijoins.

reduce_outer_joins() mistakenly treated a semijoin like a left join for
purposes of deciding whether not-null constraints created by the join's
quals could be passed down into the join's left-hand side (possibly
resulting in outer-join simplification there).  Actually, semijoin works
like inner join for this purpose, ie, we do not need to see any rows that
can't possibly satisfy the quals.  Hence, two-line fix to treat semi and
inner joins alike.  Per observation by Andres Freund about a performance
gripe from Yazan Suleiman.

Back-patch to 8.4, since this oversight has been there since the current
handling of semijoins was implemented.
src/backend/optimizer/prep/prepjointree.c