[Dbix-class] Resultset->Search with join and column attributes

Adam Hasselbalch Hansen ahh at one.com
Fri Sep 26 09:42:20 BST 2008


Hey there.

When I DO a search with both a 'join' and a 'columns' attribute, like so:


blabla('Equipment')->search({type => 'BLADE'},{join => 
['equipment_type_id'],'columns' => ['equipment.id', 
'equipment.serial_no'],});

.. somehow the columns-attribute is completely ignored, and I get an 
error, because the SELECT generated defaults (?) to the 'id' column, 
which is in both tables (and thus is ambiguous).

The select generated, for reference is:

"SELECT id FROM equipment me  JOIN equipment_type equipment_type_id ON ( 
equipment_type_id.id = me.equipment_type_id ) WHERE ( type = ? )"

Substituting 'columns' with a 'select' attribute has no effect.

Using 'include_columns' instead appends the columns to the select, but 
still includes the 'id' at the beginning. The docs say that all are 
prepended with 'me.', but that does not happen here.

Using search with 'columns', but without 'join', works fine.

If I missed some vital clue, please, let me know. Otherwise: What gives?

-- 
Adam Hasselbalch Hansen
UNIX Systems Developer, CPH
e: ahh at one.com, w: www.one.com



More information about the DBIx-Class mailing list