[Dbix-class] convention for naming primary keys to avoid ambiguousselects

Peter Rabbitson rabbit+list at rabbit.us
Tue Nov 25 18:22:18 GMT 2008


Noel Burton-Krahn wrote:
> On Tue, Nov 25, 2008 at 9:45 AM, Peter Rabbitson <rabbit+list at rabbit.us> wrote:
>> As far as the don't repeat yourself - what do you propose? Your query
>> (the join-ed one) selects from two tables that have the same column.
>> Unless you specify which column you are interested in, it is not safe
>> for DBIC to assume something on its own. Either rename your columns to
>> be globally unique (ugly), or qualify your column names when necessary
>> (smart).
>>
> 
> The problem is that DBIx has the "smarts" to prefix column names in
> the select clause, like "select me.id, cds.id" but not in the where
> clause "where id=?". 

How does DBIC know if the user meant 'where me.id = ?' and not 'where
cds.id = ?'. Blindly prefixing stuff with 'me' is plain wrong.



More information about the DBIx-Class mailing list