Comment 1 for bug 962667

Sergey Petrunia (sergefp) wrote :

The failure scenario is as follows:

> best_access_path(idx=0, table=t2)

 > considers ref access
  - start considering ref access and LooseScan
  - ref access is not possible (cost=DBL_MAX)
  - LooseScan (as full index scan) is possible (cost=1.025)

 > then consider full scan/range accesses
  - find that quick access is possible
  - however it's not applicable for loose scan.
  - still, quick select is chosen.
< best_access_path
...

> advance_sj_state
  (choses the above loose scan over full index scan)
<

The problem is that subsequent code assumes that tab->type==JT_ALL &&
tab->quick!=NULL => use quick select for retrieval.

And eventually we crash with an assert because QUICK_SORT_INTERSECT_SELECT is
unable to produce records in order (that's true).