[Dbix-class] infinite loop when calling accessors on a table with triggers

John Napiorkowski jjn1056 at yahoo.com
Wed May 3 22:14:06 CEST 2006


Okay, I figured this out and want to record it
somewhere on the hope someone doesn't make the same
braindead error.

This has nothing to do with triggers, the problem
started when I added the trigger so I assumed that was
the issue.

Basically in the situation I outlined where I had a
self referential table and a row which was referring
to itself DBIx gets trapped in an infinite loop when
you try to call the related relation.

So the warning I have is don't do this :)

--john



--- John Napiorkowski <jjn1056 at yahoo.com> wrote:

> I'm having a strange problem with a table that has
> some triggers on it.  The issue is that when I try
> to
> fetch from the table via an accessor created by a
> 'has_many' relationship the system goes into an
> infinite loop.
> 
> Here are the details.
> 
> Table Documents
>  document_id (primary_key)
>  (etc)
> 
> Table Folders
>  folder_id (primary_key)
>  document_id (primary_key)
>  parent_id (FK to folder_id, a self referential FK)
>  (etc)
> 
> I have a trigger on table Folders to check during
> update or inserts to see if parent_id IS NULL, and
> if
> so to set it to the value of folder_id.
> 
> I don't seem much in the documentation regarding
> triggers.  I also have a local archive of the
> mailing
> list and could find anyone with similar trouble.  So
> my question is: Is this a known problem?  Have other
> people run into it?  Or have other people gotten
> triggers with dbix working without trouble.
> 
> Please let me know if I can provide more info to
> help
> with this problem.
> 
> By the way way database is postgresql 8.1
> 
> --john
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 
> _______________________________________________
> List:
>
http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
> Wiki: http://dbix-class.shadowcatsystems.co.uk/
> IRC: irc.perl.org#dbix-class
> SVN:
>
http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Dbix-class mailing list