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

2008-11-25 Thread Octavian Rasnita
From: David Schmidt [EMAIL PROTECTED] Hello List, I used to have an id INTEGER PRIMARY KEY column in every table. Now I am using DBIC and repeatedly run into this kind of error. SELECT me.id, me.title, me.artist FROM cds me WHERE ( me.artist = ? ): '2' SELECT me.id, me.title, me.artist,

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

2008-11-25 Thread David Schmidt
On Tue, Nov 25, 2008 at 5:31 PM, Octavian Rasnita [EMAIL PROTECTED] wrote: From: David Schmidt [EMAIL PROTECTED] Hello List, I used to have an id INTEGER PRIMARY KEY column in every table. Now I am using DBIC and repeatedly run into this kind of error. SELECT me.id, me.title, me.artist

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

2008-11-25 Thread Peter Rabbitson
David Schmidt wrote: On Tue, Nov 25, 2008 at 5:31 PM, Octavian Rasnita [EMAIL PROTECTED] wrote: From: David Schmidt [EMAIL PROTECTED] Hello List, I used to have an id INTEGER PRIMARY KEY column in every table. Now I am using DBIC and repeatedly run into this kind of error. SELECT me.id,

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

2008-11-25 Thread Noel Burton-Krahn
On Tue, Nov 25, 2008 at 9:45 AM, Peter Rabbitson [EMAIL PROTECTED] 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

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

2008-11-25 Thread Noel Burton-Krahn
On Tue, Nov 25, 2008 at 10:22 AM, Peter Rabbitson [EMAIL PROTECTED] wrote: Noel Burton-Krahn wrote: 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

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

2008-11-25 Thread Brian Phillips
prefixing the id column with the name of the relationship seems much more obvious than prefixing the base table's column with me. This doesn't seem like it would be too complicated to implement -- if the column given is not already prefixed by one or more table/relationship aliases, it could be