Subject: | Calling 'delete' on a search resultset generates SQL which is incompatible with MySQL (5.0) |
I have a problem where DBIx::Class generates SQL which doesn't work in
mysql (5.0) when I call ->delete on a resultset which has had a search
applied. You get an error like:
DBIx::Class::ResultSet::delete(): DBI Exception: DBD::mysql::st execute
failed: You can't specify target table 'X1' for update in FROM clause
[for Statement "DELETE FROM X1 WHERE ( id IN ( SELECT me.id FROM X1 me
WHERE ( id > ? ) GROUP BY me.id ) )" with ParamValues: 0=5] at ./rep.pl
line 10
I can completely reproduce this with the attached test case which
contains a small mysql schema, a couple of classes and a script which
simply produce the problem for me.
In case it's significant mysql --version on my server produces:
mysql Ver 14.12 Distrib 5.0.51a, for debian-linux-gnu (x86_64) using
readline 5.2
Subject: | repbug.tgz |
Message body not shown because it is not plain text.