[Catalyst] Loader and circular references

Sebastian Riedel sri at oook.de
Tue Jul 5 13:19:46 CEST 2005


Am 02.07.2005 um 09:00 schrieb Zbyszek Lukasiak:

> Dear all,
>
> I have circular foreign key references in my tables.  I attache the  
> DDL for
> those tables below.  When I start catalyst I get lots of warning of  
> the
> format:
> jobs method already exists in LinkDB::M::CDBI::Opinion
>  at /usr/local/share/perl/5.8.4/Class/DBI/Relationship/HasMany.pm  
> line 13
> links method already exists in LinkDB::M::CDBI::Usr
>  at /usr/local/share/perl/5.8.4/Class/DBI/Relationship/HasMany.pm  
> line 13
> opinions method already exists in LinkDB::M::CDBI::Link
>  at /usr/local/share/perl/5.8.4/Class/DBI/Relationship/HasMany.pm  
> line 13
> opinions method already exists in LinkDB::M::CDBI::Usr
> ...
>
> I am not sure if the circular foreign keys don't break some Relational
> Database best practices, but still this seems like a bug in the  
> Loader.
>
> -- Zbigniew Lukasiak
>
> =========================================
> create table job(
> id serial primary key,
> cdate timestamp default CURRENT_TIMESTAMP,
> addtags text,
> startopinion integer,
> maxdistance integer
> );
>
> create table opinion(
> id serial primary key,
> link integer,
> usr integer,
> name text,
> flag char (1),
> cdate timestamp,
> namevect tsvector,
> tags text,
> tagsvect tsvector,
> origin char(1),
> distance integer,
> job integer,
> foreign key (job) references job(id) ON DELETE CASCADE,
> foreign key (link) references link(id) ON DELETE CASCADE,
> foreign key (usr) references usr(id) ON DELETE CASCADE
> );
> alter table job add foreign key(startopinion) references opinion 
> (id) on delete cascade;

Yes, thats too complex for loader.

--
sebastian




More information about the Catalyst mailing list