[Dbix-class] Re: as_subselect_rs->delete bug?

Rob Kinyon rob.kinyon at gmail.com
Wed Jul 11 13:35:17 GMT 2012


On Wed, Jul 11, 2012 at 6:11 AM, fREW Schmidt <frioux at gmail.com> wrote:
> I wrote a test that confirms it, but it actually has no where clause at all
> when I test it, which is even scarier.

Before we go ahead confirming failures and making fixes, let's step
back and discuss exactly what
$rs->search(...)->as_subselect_rs->delete should actually do and if it
should be something that's allowable. The point behind as_subselect_rs
was to allow a resultset to be used as the RHS for a column in a
search clause. If $rs->search() could detect that a $rs is the RHS,
then ->as_subselect_rs() would never be called by a user. More to the
point, the resultset returned by as_subselect_rs, when I designed the
subquery thing, was never meant to be used as a general-purpose $rs,
but only in specific contexts.

So, it makes perfect sense that calling ->delete() on this
special-purpose $rs wouldn't do the right thing. I am really curious
as to the chain of reasoning that led to the use of
->as_subselect_rs().

> Toby, as a workaround in the meantime if you remove the as_subselect_rs it
> seems to do the right thing.

Of course it does the right thing. The as_subselect_rs is an error in this case.

Rob



More information about the DBIx-Class mailing list