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

Noel Burton-Krahn noel at burton-krahn.com
Tue Nov 25 18:14:38 GMT 2008


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=?".  What does DBIx use to build its where clause?
Hopefully it would be straightforward to copy the prefixes from the
"select" to the "where".

~Noel



More information about the DBIx-Class mailing list