[Dbix-class] DBIC prefetch bug (test case)

Nilson Santos Figueiredo Junior acid06 at gmail.com
Fri Nov 17 23:58:27 GMT 2006


Some time ago, I've reported a pretty nasty bug I encountered when
prefetching nested has_many relationships. At the time I tried fixing
it myself but the best I could do was finding where the bug seemed to
happen in the code but I couldn't really fix it.

The bug consists in DBIC ignoring rows that are present in the result
from the database (i.e. the query is correctly generated) and messing
everything up when you've got a situation like A has_many B has_many C
and some Bs don't have Cs while other Bs have multiple Cs.

So, mst requested some test cases that'd reproduce the bug.

I've finally wrote the test case which reproduces the said bug and
it's attached. The bug is present as of DBIC 0.07003. I couldn't
really integrate it into the already existing testing infrastructure
since I was kinda lost regarding where to put things. So I hope
someone who knows better can do it.

test.sql creates the database structures (don't know if it's portable,
written for MySQL) and test.pl demonstrates the bug. The Schema
classes were autogenerated.

Hopefully this test case will be enough.

-Nilson Santos F. Jr.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbicbug.tar.gz
Type: application/x-gzip
Size: 1311 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20061117/67=
437c69/dbicbug.tar.bin


More information about the Dbix-class mailing list