"Wellmann, Harald" <harald(dot)wellmann(at)harman(dot)com> writes:
> The problem occurs with PostgreSQL 8.4.0. I cannot reproduce it with
> PostgreSQL 8.3.7.
There are known bugs in 8.4.0 having to do with improperly exchanging
the ordering of semijoins (IN joins) and other joins. You haven't
provided enough information to test whether your case is one of them.
If you can try CVS branch tip or a recent nightly snapshot, there
might still be enough time to do something about it for 8.4.1,
if it isn't fixed already.
regards, tom lane