[Dbix-class] convention for naming primary keysto avoidambiguousselects

Octavian Rasnita orasnita at gmail.com
Tue Nov 25 23:27:00 GMT 2008


From: "Peter Rabbitson" <rabbit+list at rabbit.us>
>> I think that if the query needs to search in a table named "me" which is
>> not the primary table, it probably gives another name instead of "me"
>> for the main table, so that name shouldn't need to be hard coded in the
>> programs.
>>
>> By the way, does anyone know what happends if a secondary table is named
>> "me"?
>>
> The name of the table is irrelevant as they are all aliased anyway. If
> you have a relationship called 'me' (hence JOIN <tblname> me), then I
> believe DBIC will switch it to me2 (just like it does with stacked joins
> over the same relationship[1]). If not - it might very well be a bug,
> tests/patches welcome :)
>
> Cheers
>

Ok, I understand. So the main table will be named "me" and the "me" table 
will be named "me2".

But I still don't see yet why it wouldn't be possible to prepend the prefix 
"me." to all the columns from the where conditions if those columns don't 
have any kind of prefix.

Octavian




More information about the DBIx-Class mailing list