[Dbix-class] has_many but no left join?!

Peter Rabbitson rabbit+dbic at rabbit.us
Wed Jun 19 09:33:30 GMT 2013

On Tue, Jun 18, 2013 at 07:06:30PM +0100, Stephen Shorrock wrote:
> then (in Cat app)
> $c->model('MyApp::IndexStatus')->search_related('old_statuses');
> produces SQL something like:
> SELECT me.myindex, me.myoldindex, me.mystatus FROM index_statuses me  JOIN
> index_statuses old_statuses ON old_statuses.myindex = me.myoldindex:

Why would it produce anything *other* than inner join? You are 
essentially asking: "Give me all old_statuses, which have a related 
IndexStatus". If DBIC were to leave the LEFT JOIN in place, then the 
result from the database will contain the "right side holes" which will 
map to the old_statuses resultset... how? ;)

It will help you a lot if you start looking at resultset chaining as a 
"set operation" as opposed to a "sql generator"


More information about the DBIx-Class mailing list