[Dbix-class] Finding by primary key and might_have

Peter Rabbitson rabbit+dbic at rabbit.us
Mon Feb 2 20:47:19 GMT 2009


Zbigniew Lukasiak wrote:
> One more thing - this test fails:
> 
> ok( $schema->resultset('CD')->find( {
>             cdid => 1,
>             liner_notes => {
>                 'notes' => 'test note changed'
>             },
>         },
>         { key => 'primary' }
>     ),
>     'CD found'
> );
> 
> The liner_notes are linked to the CD by the CD's primary key (as a
> might_have relationship) - so this specifies the key in two
> conflicting ways - one by explicite parameter and one inferred from
> the relationship.  The effect is this SQL:
> 
> SELECT me.cdid, me.artist, me.title, me.year, me.genreid,
> me.single_track FROM cd me WHERE ( me.cdid IS NULL )
> 
> You can characterise that as a garbage in garbage out case - but I
> think it is rather surprising and it can surface as another strange
> case when composing find with other methods.
> 
> A diff with the test against the trunk version is attached.
> 
> 
> I hope you understand I am not doing that out of malice - I am just
> testing my own library.
> 

No problem. I am not applying most of the patches you sent yet, as I don't
want to pollute the trunk with yet more stuff there is no workforce for.
I'll bring them all in either when I have time to look at them properly, or
once we enter RC (which will be used to smooth out all corner cases for
which we have tests). All your messages are flagged and awaiting their
time though :)

Cheers



More information about the DBIx-Class mailing list