Skip Menu |
 

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 81378
Status: resolved
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: DRAXIL [...] cpan.org
ser.khomutov [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.08196
Fixed in: 0.08205



Subject: Calling 'delete' on a search resultset generates SQL which is incompatible with MySQL (5.0)
Download (untitled) / with headers
text/plain 799b
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
Download repbug.tgz
application/x-compressed-tar 713b

Message body not shown because it is not plain text.

Download (untitled) / with headers
text/plain 150b
This is something I happened to work on just couple days ago, but didn't have a chance to fully finish. A fix should be available within this weekend.
Excellent news. Thanks.
Subject: limit in subquery for MySQL
Download (untitled) / with headers
text/plain 870b
Hello, DBIx::Class - 0.08204 Perl v5.10.1 (*) built for x86_64-linux-gnu-thread-multi Linux 2.6.32-5-amd64 Mysql Server Version 5.5.14 my $history_rs = $self->schema->resultset('UserHistory'); my $res = $history_rs->search(undef, { order_by => { -asc =>'timestamp'} , rows => 500, page => 1 } ); $res->delete; "'DBIx::Class::ResultSet::delete(): DBI Exception: DBD::mysql::st execute failed: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' [for Statement "DELETE FROM userHistory WHERE ( id IN ( SELECT me.id FROM userHistory me ORDER BY timestamp ASC LIMIT ? ) )" with ParamValues?: 0=500]" DBIx:Class generate statement "DELETE FROM userHistory WHERE ( id IN ( SELECT me.id FROM userHistory me ORDER BY timestamp ASC LIMIT 500" - this statement doesn't yet work for mysql .
This is a duplicate of 81378 - fix is forthcoming. Merging tickets.
Download (untitled) / with headers
text/plain 150b
Finally patched up properly: http://lists.scsys.co.uk/pipermail/dbix-class-devel/2013-January/000232.html Should show up in the next release. Cheers
Subject: Re: [rt.cpan.org #81378] Calling 'delete' on a search resultset generates SQL which is incompatible with MySQL (5.0)
Date: Mon, 21 Jan 2013 09:43:07 +0000
To: bug-DBIx-Class [...] rt.cpan.org
From: joe higton <joe [...] draxil.uklinux.net>
Good stuff, thanks.
Subject: Re: [rt.cpan.org #81378] Calling 'delete' on a search resultset generates SQL which is incompatible with MySQL (5.0)
Date: Mon, 21 Jan 2013 13:48:57 +0400
To: bug-DBIx-Class [...] rt.cpan.org
From: Сергей Хомутов <ser.khomutov [...] gmail.com>
Download (untitled) / with headers
text/plain 154b
Thanx. 2013/1/21 joe higton via RT <bug-DBIx-Class@rt.cpan.org> Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=81378 > > > Good stuff, thanks. > >


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.