[Dbix-class] Join behavior in "prefetch" vs "join"

Nilson Santos Figueiredo Junior acid06 at gmail.com
Fri Jan 9 17:09:07 GMT 2009


Hello there,

I'm not sure if this is the expected behavior or not (ie. bug vs feature).

In a relationship structure like this:

  entity->has_many->has_many->belongs_to

If "prefetch" is used the results up to the last belongs_to
relationship, the resulting query will use LEFT JOINs for the has_many
relationships, but then use a regular join for the last belongs_to
(which will prevent "entity" from appearing in the resultset).

If "join" is used, all joins are made using LEFT JOINs and it works
(although I would consider nested joins to be the proper solution,
this also works fine).

So - is prefetch really expected to work like that?
I can explain better if this message isn't clear enough and a test
case if it seems to be a bug.

-Nilson Santos F. Jr.



More information about the DBIx-Class mailing list