[Dbix-class] Unexpected behavior with possible NULL foreign key relationship

Matt S Trout dbix-class at trout.me.uk
Sun Apr 20 17:30:10 BST 2008


On Wed, Apr 16, 2008 at 02:32:44PM -0500, mike wrote:
> On Tue, Apr 15, 2008 at 7:59 PM, mike <pulsation at gmail.com> wrote:
> > [ sorry for the CC, but my last attempt to post to the list never made it ]
> >
> >  On Sun, Apr 6, 2008 at 2:08 PM, Matt S Trout <dbix-class at trout.me.uk> wrote:
> >  > On Fri, Mar 21, 2008 at 03:14:40PM -0700, Damon Snyder wrote:
> >  >  > Hi Everyone,
> >  >  > I'm new to the list so bear with me if I'm missing something. I have a
> >  >  > foreign key relationship where it's possible that the belongs_to
> >  >  > relationship is NULL. See the classes below. When I create a new
> >  >  > Smsmessage object e.g. like so:
> 
> [snip]
> 
> >  On Wed, Apr 2, 2008 at 3:52 PM, mike <pulsation at gmail.com> wrote:
> >  > attached is a patch which includes a test that shows the broken single
> >  >  accessor in DBIx::Class 0.08008 and 0.08010.  DBIx::Class 0.08009 was
> >  >  not tested, but DBIx::Class 0.08007 works fine.  i'm not sure exactly
> >  >  what's going on here, but this behavior has appeared in DBIx::Class
> >  >  before.  it breaks the holy hell out of all of our applications in a
> >  >  very nasty way.  with sharp, pointy teeth.  look at the bones!
> 
> [snip]
> 
> i wish to qualify this by saying that my previous encounter with
> similiar symptoms
> were caused not by DBIx::Class, but by mysql's SQL_AUTO_IS_NULL behavior
> as described here:
> 
>     http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html
> 
> however, this current problem is not mysql.  i have confirmed that it
> only occurs
> on newly created objects by adding a call to discard_changes after the creation.
> following is the modified patch including the test that illustrates
> this behavior.

(1) your mail client mangled the patch
(2) after unmangling it, it makes 60core and 91debug fail.

Can I have another patch that doesn't break anything else please? :)

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list