[Melbourne-pm] DBIx::Class join errors ...

Malcolm Herbert melbourne-pm at mjch.net
Mon Mar 7 03:59:40 PST 2011


On Mon, Mar 07, 2011 at 09:23:56AM +1100, Simon Taylor wrote:
|This does sound like a bug in the automatic schema.
|
|Have you tried making the references clause in the "show" table more
|specific, ie:
|
|    channel uuid not null references channel (channel)

thanks for the tip, unfortunately it didn't pan out - changed all the primary
key fields to 'id' across the board and made sure each reference restriction
named the primary key field explicitly, as in:

  create table channel (
    id uuid not null primary key,
    :
    :
  );
  
  create table show (
    id uuid not null primary key,
    channel uuid not null references channel(id),
    :
    :
  );

... but I wound up with the same error:

DBIx::Class::ResultSet::all(): DBI Exception: DBD::Pg::st execute failed: ERROR: column reference "id" is ambiguous
LINE 1: ...e JOIN show shows ON shows.channel = me.id WHERE ( id = $1 )
                                                              ^ [for Statement "SELECT shows.id, shows.channel, shows.name, shows.sane, shows.description, shows.url, shows.logo, shows.hosts FROM channel me JOIN show shows ON shows.channel = me.id WHERE ( id = ? )" with ParamValues: 1='db9c299c-04e0-11e0-81e8-8fcb8e6c1511'] at exp/test.pl line 28

looks like I'll just have to use <table>_id for my primary keys ... :(

-- 
Malcolm Herbert                                This brain intentionally
mjch at mjch.net                                                left blank


More information about the Melbourne-pm mailing list