Fixes for the diamond-relationship prefetch/join problem
The core of the issue was that resolve_prefetch calculated duplicate join alias numbers separate from resolve_join
In order to solve this, now the only join alias calculation happens in resolve_join (with prefetch being always merged as extra joins), and each join arrayref in from is labeled with the full relationship chain from me to the particular join. Then resolve_prefetch has to walk this chain and pull the necessary alias in order to generate the correct select