DBIx::Recordset updates dying with ambiguous column errors

From: Joshua Gerrish (j_gerrish_at_hotmail.com)
Date: 12/06/03


To: dbi-users@perl.org
Date: Sat, 06 Dec 2003 06:48:43 -0800

I'm not sure if this is the right place to ask about DBIx::Recordset, my
apologies if it isn't.

The error I'm getting is this: "DB: ERROR Column: 'id' in where clause is
ambiguous"

The problem, as far as I can see, is that I've got a recordset with two
tables in it, and both have an id field. When it goes to update a field, it
uses id as the primary key, but it doesn't qualify it with a table name, so
the query bombs out.

Is there any way to specify which table is the "primary" table? For
example, in my database I've got a table called referrers that has a 1-1
relationship with a table called accounts. referrers.account_ref points to
accounts.id. But referrers also has an id field. I want to specify for the
!PrimKey parameter that it is in table referrers.

Here's a copy of my setup parametrs:

    $self->{set} = DBIx::Recordset->Setup({'!DataSource' =>
'dbi:mysql:referrals',
                                           '!Table' => 'referrers, accounts',
                                           '!TabRelation' => 'referrers.account_ref = accounts.id',
                                           '!PrimKey' => 'id',

                                           '!Links' => ...

Any help would be cool.

Thanks,

Josh

_________________________________________________________________
Cell phone ‘switch’ rules are taking effect — find out more here.
http://special.msn.com/msnbc/consumeradvocate.armx