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)
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1353685270-881-2"
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 0
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Length: 799
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
MIME-Version: 1.0
Content-Type: application/x-compressed-tar; name="repbug.tgz"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline; filename="repbug.tgz"
Content-Transfer-Encoding: base64
Content-Length: 713
Download repbug.tgz
application/x-compressed-tar 713b

Message body not shown because it is not plain text.

MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-5408-1353689671-33.81378-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 150
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.
MIME-Version: 1.0
In-Reply-To: <rt-3.8.HEAD-5408-1353689671-33.81378-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
References: <rt-3.8.HEAD-5408-1353689671-33.81378-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-27477-1353939405-1538.81378-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 23
Excellent news. Thanks.
Subject: limit in subquery for MySQL
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 870
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 .
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-20622-1355223433-1000.81897-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 67
This is a duplicate of 81378 - fix is forthcoming. Merging tickets.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-15104-1358716481-462.81378-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 150
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
From draxil [...] gmail.com Mon Jan 21 04: 43:41 2013
MIME-Version: 1.0
X-Spam-Status: No, score=-6.119 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, SPF_NEUTRAL=0.779] autolearn=ham
In-Reply-To: <rt-3.8.HEAD-15104-1358716484-54.81378-6-0 [...] rt.cpan.org>
X-Spam-Flag: NO
References: <RT-Ticket-81378 [...] rt.cpan.org> <rt-3.8.HEAD-15104-1358716484-54.81378-6-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Received: by 10.60.7.167 with SMTP id k7mr13944933oea.20.1358761407943; Mon, 21 Jan 2013 01:43:27 -0800 (PST)
Message-ID: <CABfa3QvKDJDd7EH=UEJr1RyggLvA11iXXW=jOhKKgM8EJ-FUzg [...] mail.gmail.com>
Content-Type: multipart/alternative; boundary=e89a8ff1c6860e155204d3c94bfe
X-Spam-Score: -6.119
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] gmail.com
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 46362240BED for <cpan-bug+DBIx-Class [...] hipster.bestpractical.com>; Mon, 21 Jan 2013 04:43:41 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fGwGey+nQkjA for <cpan-bug+DBIx-Class [...] hipster.bestpractical.com>; Mon, 21 Jan 2013 04:43:39 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 6BD15240BE9 for <bug-DBIx-Class [...] rt.cpan.org>; Mon, 21 Jan 2013 04:43:39 -0500 (EST)
Received: (qmail 7977 invoked by uid 103); 21 Jan 2013 09:43:38 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 21 Jan 2013 09:43:38 -0000
Received: from mail-ob0-f177.google.com (HELO mail-ob0-f177.google.com) (209.85.214.177) by 16.mx.develooper.com (qpsmtpd/0.84/v0.84-167-g4ed6cab) with ESMTP; Mon, 21 Jan 2013 01:43:31 -0800
Received: by mail-ob0-f177.google.com with SMTP id wc20so4847096obb.8 for <bug-DBIx-Class [...] rt.cpan.org>; Mon, 21 Jan 2013 01:43:28 -0800 (PST)
Received: by 10.182.193.68 with HTTP; Mon, 21 Jan 2013 01:43:07 -0800 (PST)
Delivered-To: cpan-bug+DBIx-Class [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #81378] Calling 'delete' on a search resultset generates SQL which is incompatible with MySQL (5.0)
Return-Path: <draxil [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type; bh=Mt/PpTwqPFdCmGbjKPulNkxQdpJGqDwayFg1ZqT313A=; b=WtBHUNaJkWxfZ9xkhDgR8oSXkjlg91execEITBHXTRVb4DU4h8cCIrx42mwYz3HZB2 eyFsnltMp2b2JlPlJY4rVdc2yX83QzY+Xz/IeB7aU4qgIpQ37oYFoqhK2fOFdnzzAhM1 LcD1JmHyzQOO34oZR3PtjsrFzxIIBn7jQOq3IJXXSKbK7s8Wepjp7kuPe9FJX23Kf+vT Qi3sNYmeDueEcqWB5qJx3DTYXWYZ3yRTSXuVVJ94KRdc/XC+ClYkIn0WybrHsq3W3jWZ 6I3Kod/YhV6VP53GMjp3MWOImYuwVqbGyc8BaexXfHJ987RRn8hlbRS6n2B4I8i5W2KM wxWg==
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: cpan-bug+DBIx-Class [...] hipster.bestpractical.com
X-RT-Mail-Extension: dbix-class
X-Google-Sender-Auth: ywpILryOkRE9GSzLEkiFlUm9nFA
Sender: draxil [...] gmail.com
Date: Mon, 21 Jan 2013 09:43:07 +0000
X-Spam-Level:
To: bug-DBIx-Class [...] rt.cpan.org
From: joe higton <joe [...] draxil.uklinux.net>
RT-Message-ID: <rt-3.8.HEAD-12753-1358761422-1475.81378-0-0 [...] rt.cpan.org>
Content-Length: 0
Content-Type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Content-Length: 20
Good stuff, thanks.
Content-Type: text/html; charset="utf-8"
X-RT-Original-Encoding: utf-8
Content-Length: 45
From ser.khomutov [...] gmail.com Mon Jan 21 04: 49:06 2013
MIME-Version: 1.0
X-Spam-Status: No, score=-6.219 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, SPF_NEUTRAL=0.779] autolearn=ham
In-Reply-To: <rt-3.8.HEAD-12753-1358761424-1073.81378-6-0 [...] rt.cpan.org>
X-Spam-Flag: NO
References: <RT-Ticket-81378 [...] rt.cpan.org> <rt-3.8.HEAD-15104-1358716484-54.81378-6-0 [...] rt.cpan.org> <CABfa3QvKDJDd7EH=UEJr1RyggLvA11iXXW=jOhKKgM8EJ-FUzg [...] mail.gmail.com> <rt-3.8.HEAD-12753-1358761424-1073.81378-6-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Received: by 10.112.38.67 with SMTP id e3mr7105208lbk.105.1358761737094; Mon, 21 Jan 2013 01:48:57 -0800 (PST)
Message-ID: <CAC4go_2MxHJu03gqiOi5SZmbagt4_fsE4afe6VHEUzeNziGtrA [...] mail.gmail.com>
Content-Type: multipart/alternative; boundary=e0cb4efe2c24ac859104d3c95e5d
X-Spam-Score: -6.219
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] gmail.com
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 9F12461E003 for <cpan-bug+DBIx-Class [...] hipster.bestpractical.com>; Mon, 21 Jan 2013 04:49:06 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JdZ4rYag0LLA for <cpan-bug+DBIx-Class [...] hipster.bestpractical.com>; Mon, 21 Jan 2013 04:49:05 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id CCF7F240BE9 for <bug-DBIx-Class [...] rt.cpan.org>; Mon, 21 Jan 2013 04:49:04 -0500 (EST)
Received: (qmail 8353 invoked by uid 103); 21 Jan 2013 09:49:04 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 21 Jan 2013 09:49:04 -0000
Received: from mail-lb0-f182.google.com (HELO mail-lb0-f182.google.com) (209.85.217.182) by 16.mx.develooper.com (qpsmtpd/0.84/v0.84-167-g4ed6cab) with ESMTP; Mon, 21 Jan 2013 01:49:00 -0800
Received: by mail-lb0-f182.google.com with SMTP id gg6so3660845lbb.27 for <bug-DBIx-Class [...] rt.cpan.org>; Mon, 21 Jan 2013 01:48:57 -0800 (PST)
Received: by 10.112.80.10 with HTTP; Mon, 21 Jan 2013 01:48:57 -0800 (PST)
Delivered-To: cpan-bug+DBIx-Class [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #81378] Calling 'delete' on a search resultset generates SQL which is incompatible with MySQL (5.0)
Return-Path: <ser.khomutov [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=hTumfiiEgYFlpif2kfkGTjKBn2zYDq9Bl45d6qGGOug=; b=0KH3Jx25kIU/rCdW820IwaZfbK6S6izmJJU8j4C6uAabBLcC53qRYjnJIg3oaIbMAy PwhNPgAPzAlCT/BHIV0u9n52XC8iorhqfPM8c/UDVcW/8HnKpr8e5QJRUuJh9P638XD1 xF09W4/+cEtSSR5ihRB0hscf30GFbS/5tM5jVUGPzD8mhOoriYjXNRq14uPd1SKIIwyp b7MjnWrlRmjONatlC8uMpraJkqgxpdXYVbhyk5YXScGE65bTt/1V8eTeu1iDkJTP7Xn8 spZTlbnCJq91zvyqiHqeIwLC9hD2qyuhPP3hEqSLaOh/IKKhXi02fWtqXWdo+HppsmoD S9uQ==
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: cpan-bug+DBIx-Class [...] hipster.bestpractical.com
X-RT-Mail-Extension: dbix-class
Date: Mon, 21 Jan 2013 13:48:57 +0400
X-Spam-Level:
To: bug-DBIx-Class [...] rt.cpan.org
From: Сергей Хомутов <ser.khomutov [...] gmail.com>
RT-Message-ID: <rt-3.8.HEAD-1225-1358761747-571.81378-0-0 [...] rt.cpan.org>
Content-Length: 0
Content-Type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Content-Length: 154
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. > >
Content-Type: text/html; charset="utf-8"
X-RT-Original-Encoding: utf-8
Content-Length: 552


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.