Comment 6 for bug 951937

Revision history for this message
Sergey Petrunia (sergefp) wrote :

WHERE condition after equality substitution:

  (t1b.a = t1a.a) and
  (t1b.b = t1a.a) and
  (v.a = t1a.a) and
  (t1a.b >= t1a.a or (t1a.a = 'z' and v.a = 'z'))"

so, t1b.b = 'z' got converted into (t1a.a = 'z' and v.a = 'z') (**)

We got it, because we've had a multi-equality of:

   t1a.a=t1b.a=t1b.b=v.a

and a join order of {v, t1a, t1b }. The first element is `v`, the first one inside the sjm nest is `t1a`. Substitution (**) is generally useful, but not when we get it inside an OR clause. When we do it inside an OR clause, that has other OR-part that can be evaluated only inside the subquery, we end up with un-evaluable clause.