Fix another semijoin-ordering bug. We already knew that we couldn't

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 10e8b3fae373caa7ade131947b1e271cf9d0e25f
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2009-07-21T02:02:51Z
Releases: 8.4.1
Fix another semijoin-ordering bug.  We already knew that we couldn't
reorder a semijoin into or out of the righthand side of another semijoin,
but actually it doesn't work to reorder it into or out of the righthand
side of a left or antijoin, either.  Per bug #4906 from Mathieu Fenniak.

This was sloppy thinking on my part.  This identity does work:

	( A left join B on (Pab) ) semijoin C on (Pac)
==
	( A semijoin C on (Pac) ) left join B on (Pab)

but I failed to see that that doesn't mean this does:

	( A left join B on (Pab) ) semijoin C on (Pbc)
!=
	A left join ( B semijoin C on (Pbc) ) on (Pab)

Files

PathChange+/−
src/backend/optimizer/plan/initsplan.c modified +6 −5
src/backend/optimizer/README modified +5 −5