"Nick Fankhauser" <nickf(at)ontko(dot)com> writes:
> and
> (
> local_case_type.local_case_subtype_code =
> case_data.local_case_type_code
> )
Did you actually mean to match local_case_subtype_code against
local_case_type_code, or is that a typo?
I believe you have uncovered a planner bug, but the bug may be triggered
by the partial overlap of this join condition with the next one.
Assuming that it's a typo, you may find that you avoid the problem by
fixing the typo.
regards, tom lane