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

fREW Schmidt frioux at gmail.com
Wed Jul 11 13:11:29 GMT 2012


On Wed, Jul 11, 2012 at 12:38 AM, Toby Corkindale <toby at dryft.net> wrote:

> If it helps, the SQL I would have expected would be something like:
>
>       DELETE FROM step
>       USING stage
>       WHERE step.stage_id =3D stage.id
>       AND stage.name =3D 'Final'
>       AND step.file_id =3D ?
>
> Although now I think about it, it's probably hard to get to that from
> a subselect_rs.
>
> So maybe I'd expect something like
>
> DELETE FROM step
> WHERE id IN (
>   SELECT id FROM step
>   JOIN stage ON (step.stage_id =3D stage.id)
>   WHERE step.file_id =3D ?
>   AND stage.name =3D 'Final'
> );
>
> On 11 July 2012 15:28, Toby Corkindale <toby at dryft.net> wrote:
> > On 11 July 2012 15:23, Toby Corkindale <toby at dryft.net> wrote:
> >> This was on version 0.08196 but I can try on a later one in a moment.
> >
> > Just confirming it still happens on 0.08198.
>

I wrote a test that confirms
it<http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=3Ddbsrgits/DBIx-Class.git=
;a=3Dcommitdiff;h=3D6f5c410a377b6e66c7e80d4fe67da69b0617a24a>,
but it actually has no where clause at all when I test it, which is even
scarier.

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

fREW Schmidt
http://blog.afoolishmanifesto.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20120711/e6b=
4fa33/attachment.htm


More information about the DBIx-Class mailing list