[Dbix-class] different query after upgrade

Steve Rippl rippls at woodlandschools.org
Fri Aug 21 19:22:54 GMT 2009


Hi,

I'm building an app that was on one machine with Debian's Catalyst 
version 5.7.../DBIx::Class 0.08010 and I've had to move it to another 
machine, so I bit the bullet and upgraded to latest versions of things 
including Catalyst 5.8.../DBIx-Class 0.08109.

Now the following in my app

$c->stash->{sections} = [$c->model('DB::Section')->search(
                                {},
                                {
                                  join => [{'course_sections' => 
'courses'} , {'staff_sections' => 'staffs'}],
                                  order_by => ['courses.grade', 
'staffs.name_last'],
                                  prefetch => [{'course_sections' => 
'courses'} , {'staff_sections' => 'staffs'}],
                                 })];


used to generate this query

SELECT
me.id, me.name, course_sections.section_id, course_sections.course_id, 
courses.id, courses.name, courses.grade, courses.duration, 
courses.reportcard, staff_sections.section_id, staff_sections.staff_id, 
staffs.id, staffs.name_first, staffs.name_last, staffs.name_middle, 
staffs.username, staffs.password, staffs.room, staffs.grade
FROM section me
LEFT JOIN course_section course_sections ON ( course_sections.section_id 
= me.id ) 
JOIN course courses ON ( courses.id = course_sections.course_id )
LEFT JOIN section_staff staff_sections ON ( staff_sections.section_id = 
me.id ) 
JOIN staff staffs ON ( staffs.id = staff_sections.staff_id )
ORDER BY courses.grade, staffs.name_last, course_sections.section_id, 
staff_sections.section_id

and now it generates this

SELECT
me.id, me.name, course_sections.section_id, course_sections.course_id, 
courses.id, courses.name, courses.grade, courses.duration, 
courses.reportcard, staff_sections.section_id, staff_sections.staff_id, 
staffs.id, staffs.name_first, staffs.name_last, staffs.name_middle, 
staffs.username, staffs.password, staffs.room, staffs.grade
FROM section me
LEFT JOIN course_section course_sections ON course_sections.section_id = 
me.id
LEFT JOIN course courses ON courses.id = course_sections.course_id
LEFT JOIN section_staff staff_sections ON staff_sections.section_id = me.id
LEFT JOIN staff staffs ON staffs.id = staff_sections.staff_id
ORDER BY courses.grade, staffs.name_last, course_sections.section_id, 
staff_sections.section_id

Everything is a LEFT JOIN now.  How do I get back to the first one?  
What's changed?

Any pointers would be much appreciated!

Many thanks,
Steve

-- 
Steve Rippl
Technology Director
Woodland School District
360 225 9451 x326




More information about the DBIx-Class mailing list