Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: m.e [...] acm.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.08008
Fixed in: (no value)



Subject: 'Uninitialized value' when update fails
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Type: text/plain
Charset: utf8
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 271
Download (untitled) / with headers
text/plain 271b
Error message: Use of uninitialized value in numeric eq (==) at /usr/lib/perl5/site_perl/5.8.8/DBIx/Class/Row.pm line 335. I get this when I try an update that violates a UNIQUE KEY constraint. Details: MySQL 5.0.45 perl, v5.8.8 built for x86_64-linux-thread-multi
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Charset: utf8
Message-Id: <rt-3.6.HEAD-2766-1202190065-710.32931-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Content-Transfer-Encoding: binary
From: m.e [...] acm.org
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 395
Download (untitled) / with headers
text/plain 395b
Actually, as it happens, I was trying to overwrite the primary key (UPDATE mytable SET mykey = 0, somevalue = 'whatever' WHERE mykey = 1234;). The primary key was AUTOINCREMENT, and so declared in my schema module: __PACKAGE__->add_column( mykey => { is_auto_increment => 1 } ); but I consider this to still be a bug -- the module should do something more helpful such as throw an exception.
MIME-Version: 1.0
In-Reply-To: <rt-3.6.HEAD-2766-1202190065-710.32931-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Charset: utf8
References: <rt-3.6.HEAD-2766-1202190065-710.32931-0-0 [...] rt.cpan.org>
Message-Id: <rt-3.6.HEAD-2782-1202190420-783.32931-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Content-Transfer-Encoding: binary
From: m.e [...] acm.org
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 139
Download (untitled) / with headers
text/plain 139b
The actual SQL error is: ERROR 1062 (23000): Duplicate entry '0' for key 1 so it is still a duplicate key error, though on the primary key.
MIME-Version: 1.0
X-Spam-Status: No, hits=-2.5 required=8.0 tests=BAYES_00,RDNS_NONE
In-Reply-To: <rt-3.6.HEAD-2782-1202190420-783.32931-5-0 [...] rt.cpan.org>
Content-Disposition: inline
References: <RT-Ticket-32931 [...] rt.cpan.org> <rt-3.6.HEAD-2766-1202190065-710.32931-5-0 [...] rt.cpan.org> <rt-3.6.HEAD-2782-1202190420-783.32931-5-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
X-RT-Original-Encoding: us-ascii
Received: from x1.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id B9A984D8004 for <bug-DBIx-Class [...] rt.cpan.org>; Tue, 5 Feb 2008 03:46:55 -0500 (EST)
Received: (qmail 30221 invoked from network); 5 Feb 2008 08:46:54 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 5 Feb 2008 08:46:54 -0000
Received: from Unknown (HELO agaton.scsys.co.uk) (217.168.150.167) by 16.mx.develooper.com (qpsmtpd/0.40-dev) with ESMTP; Tue, 05 Feb 2008 00:46:50 -0800
Received: from matthewt by agaton.scsys.co.uk with local (Exim 4.60) (envelope-from <mst [...] shadowcatsystems.co.uk>) id 1JMJRm-00061Z-7w for bug-DBIx-Class [...] rt.cpan.org; Tue, 05 Feb 2008 08:46:30 +0000
Delivered-To: cpan-bug+DBIx-Class [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #32931] 'Uninitialized value' when update fails
User-Agent: Mutt/1.5.11
Return-Path: <mst [...] shadowcatsystems.co.uk>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-DBIx-Class [...] rt.cpan.org
Date: Tue, 5 Feb 2008 08:46:30 +0000
X-Spam-Level: *
Message-Id: <20080205084630.GR5801 [...] agaton.scsys.co.uk>
To: Martin via RT <bug-DBIx-Class [...] rt.cpan.org>
From: Matt S Trout <mst [...] shadowcatsystems.co.uk>
X-RT-Original-Encoding: utf-8
RT-Message-ID: <rt-3.6.HEAD-2788-1202201224-453.32931-0-0 [...] rt.cpan.org>
Content-Length: 869
Download (untitled) / with headers
text/plain 869b
On Tue, Feb 05, 2008 at 12:47:02AM -0500, Martin via RT wrote: Show quoted text
> > Queue: DBIx-Class > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=32931 > > > The actual SQL error is: > ERROR 1062 (23000): Duplicate entry '0' for key 1 > so it is still a duplicate key error, though on the primary key.
If you write a standalone test script, do you still get the uninit warning? Since we set RaiseError to 1 on the dbh I'd expect an exception to be thrown. Do you have anything like Catalyst::Plugin::StackTrace loaded that sets a SIGDIE handler? -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Director http://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
MIME-Version: 1.0
In-Reply-To: <rt-3.6.HEAD-2788-1202201224-453.32931-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Charset: utf8
References: <RT-Ticket-32931 [...] rt.cpan.org> <rt-3.6.HEAD-2766-1202190065-710.32931-5-0 [...] rt.cpan.org> <rt-3.6.HEAD-2782-1202190420-783.32931-5-0 [...] rt.cpan.org> <20080205084630.GR5801 [...] agaton.scsys.co.uk> <rt-3.6.HEAD-2788-1202201224-453.32931-0-0 [...] rt.cpan.org>
Message-Id: <rt-3.6.HEAD-2797-1202287766-104.32931-0-0 [...] rt.cpan.org>
Content-Type: multipart/mixed; boundary="----------=_1202287767-2797-16"
From: m.e [...] acm.org
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 83
I have created a test case but that works fine. I will need to investigate further.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Type: multipart/mixed; boundary="----------=_1202287766-2797-15"
Charset: utf8
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
X-RT-Original-Encoding: iso-8859-1
Content-Length: 0
Content-Type: application/x-perl; name="MyTable.pm"
Content-Disposition: inline; filename="MyTable.pm"
Content-Transfer-Encoding: base64
Content-Length: 316
Download MyTable.pm
text/x-perl 316b
use strict; use warnings; package DB::Main::MyTable; use base qw/DBIx::Class/; __PACKAGE__->load_components(qw/PK::Auto Core/); __PACKAGE__->table('mytable'); __PACKAGE__->add_columns(qw/something altkey/); __PACKAGE__->add_column( mykey => { is_auto_increment => 1 } ); __PACKAGE__->set_primary_key('mykey'); 1;
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----------=_1202287687-2797-13"
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Charset: utf8
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
X-RT-Original-Encoding: iso-8859-1
Content-Length: 0
Content-Type: text/x-sql; name="mk-db.sql"
Content-Disposition: inline; filename="mk-db.sql"
Content-Transfer-Encoding: binary
Content-Length: 568
Download mk-db.sql
text/x-sql 568b
DROP DATABASE IF EXISTS testdbix; CREATE DATABASE testdbix; USE testdbix; CREATE TABLE mytable ( mykey SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, something VARCHAR(16) NOT NULL DEFAULT '???', altkey SMALLINT UNSIGNED NOT NULL, PRIMARY KEY (mykey), UNIQUE KEY altkey (altkey) ); INSERT into mytable SET something = 'alpha', altkey = 10; INSERT into mytable SET something = 'beta', altkey = 11; INSERT into mytable SET something = 'gamma', altkey = 12; SELECT * FROM mytable; UPDATE mytable SET altkey = 10 WHERE mykey = 2;
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----------=_1202287702-2797-14"
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Charset: utf8
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
X-RT-Original-Encoding: iso-8859-1
Content-Length: 0
Content-Type: application/x-perl; name="case.pl"
Content-Disposition: inline; filename="case.pl"
Content-Transfer-Encoding: base64
Content-Length: 782
Download case.pl
text/x-perl 782b
#!/usr/bin/perl use strict; use warnings; use DB::Main; my ( $dbi_dsn, $user, $pass ) = ( q{dbi:mysql:testdbix}, q{root}, q{} ); my $schema = DB::Main->connect( $dbi_dsn, $user, $pass, {} ); my @rows = $schema->resultset(q{MyTable})->all; for my $r (@rows) { print join( q{/}, $r->mykey, $r->something, $r->altkey ), qq{\n}; } print qq{case 1\n}; eval { $schema->resultset(q{MyTable})->search({mykey=> 2})->update( { altkey => 10 } ); print qq{update done\n}; }; if ($@) { print qq{exception: $@\n}; } else { print qq{no exception}; } print qq{case 2\n}; eval { $schema->resultset(q{MyTable})->search({mykey=> 2})->update( { mykey => 1 } ); print qq{update done\n}; }; if ($@) { print qq{exception: $@\n}; } else { print qq{no exception}; }
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----------=_1202287721-2788-4"
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Charset: utf8
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
X-RT-Original-Encoding: iso-8859-1
Content-Length: 0
Content-Type: application/x-perl; name="Main.pm"
Content-Disposition: inline; filename="Main.pm"
Content-Transfer-Encoding: base64
Content-Length: 114
Download Main.pm
text/x-perl 114b
use strict; use warnings; package DB::Main; use base qw/DBIx::Class::Schema/; __PACKAGE__->load_classes(); 1;
MIME-Version: 1.0
X-Spam-Status: No, hits=-2.6 required=8.0 tests=BAYES_00,HTML_MESSAGE,SPF_PASS
In-Reply-To: <rt-3.6.HEAD-2788-1202201224-453.32931-6-0 [...] rt.cpan.org>
References: <RT-Ticket-32931 [...] rt.cpan.org> <rt-3.6.HEAD-2766-1202190065-710.32931-5-0 [...] rt.cpan.org> <rt-3.6.HEAD-2782-1202190420-783.32931-5-0 [...] rt.cpan.org> <20080205084630.GR5801 [...] agaton.scsys.co.uk> <rt-3.6.HEAD-2788-1202201224-453.32931-6-0 [...] rt.cpan.org>
X-Virus-Checked: Checked by ClamAV on 16.mx.develooper.com
Content-Type: multipart/alternative; boundary="----=_Part_13775_15129931.1202287489341"
Received: from x1.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 393C84D8017 for <bug-DBIx-Class [...] rt.cpan.org>; Fri, 8 Feb 2008 13:42:18 -0500 (EST)
Received: (qmail 10983 invoked from network); 8 Feb 2008 18:42:17 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 8 Feb 2008 18:42:17 -0000
Received: from wx-out-0506.google.com (HELO wx-out-0506.google.com) (66.249.82.229) by 16.mx.develooper.com (qpsmtpd/0.40-dev) with ESMTP; Fri, 08 Feb 2008 10:42:12 -0800
Received: by wx-out-0506.google.com with SMTP id h29so3451464wxd.27 for <bug-DBIx-Class [...] rt.cpan.org>; Fri, 08 Feb 2008 10:42:08 -0800 (PST)
Received: by 10.140.251.1 with SMTP id y1mr6410212rvh.195.1202287489362; Wed, 06 Feb 2008 00:44:49 -0800 (PST)
Received: by 10.141.83.16 with HTTP; Wed, 6 Feb 2008 00:44:49 -0800 (PST)
Delivered-To: cpan-bug+DBIx-Class [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #32931] 'Uninitialized value' when update fails
Return-Path: <martin.ellison [...] gmail.com>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-DBIx-Class [...] rt.cpan.org
X-Google-Sender-Auth: ca19f6f1c3f15212
Sender: martin.ellison [...] gmail.com
Date: Wed, 6 Feb 2008 16:44:49 +0800
X-Spam-Level: *
Message-Id: <7093a26c0802060044x7988351fu62a394475da54bf4 [...] mail.gmail.com>
To: bug-DBIx-Class [...] rt.cpan.org
From: "Martin Ellison" <m.e [...] acm.org>
RT-Message-ID: <rt-3.6.HEAD-25245-1202496144-72.32931-0-0 [...] rt.cpan.org>
Content-Length: 0
Content-Type: text/plain; charset=UTF-8
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 1342
Download (untitled) / with headers
text/plain 1.3k
I've done a test case and everything works fine there, so I'm not sure then what the problem was with my program. It's New Year here so I am not sure whether I will have time in the next few days to investigate further. On 05/02/2008, Matt S Trout via RT <bug-DBIx-Class@rt.cpan.org> wrote: Show quoted text
> > > <URL: http://rt.cpan.org/Ticket/Display.html?id=32931 > > > On Tue, Feb 05, 2008 at 12:47:02AM -0500, Martin via RT wrote:
> > > > Queue: DBIx-Class > > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=32931 > > > > > The actual SQL error is: > > ERROR 1062 (23000): Duplicate entry '0' for key 1 > > so it is still a duplicate key error, though on the primary key.
> > If you write a standalone test script, do you still get the uninit > warning? > > Since we set RaiseError to 1 on the dbh I'd expect an exception to be > thrown. > > Do you have anything like Catalyst::Plugin::StackTrace loaded that sets a > SIGDIE handler? > > -- > Matt S Trout Need help with your Catalyst or DBIx::Class > project? > Technical Director > http://www.shadowcat.co.uk/catalyst/ > Shadowcat Systems Ltd. Want a managed development or deployment platform? > http://chainsawblues.vox.com/ > http://www.shadowcat.co.uk/servers/ > >
-- Regards, Martin (m.e@acm.org) IT: http://methodsupport.com Personal: http://thereisnoend.org
Content-Type: text/html; charset=UTF-8
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 2436
MIME-Version: 1.0
X-Spam-Status: No, hits=-2.5 required=8.0 tests=BAYES_00,RDNS_NONE
In-Reply-To: <rt-3.6.HEAD-25245-1202496144-72.32931-5-0 [...] rt.cpan.org>
Content-Disposition: inline
References: <RT-Ticket-32931 [...] rt.cpan.org> <rt-3.6.HEAD-2766-1202190065-710.32931-5-0 [...] rt.cpan.org> <rt-3.6.HEAD-2782-1202190420-783.32931-5-0 [...] rt.cpan.org> <20080205084630.GR5801 [...] agaton.scsys.co.uk> <rt-3.6.HEAD-2788-1202201224-453.32931-6-0 [...] rt.cpan.org> <7093a26c0802060044x7988351fu62a394475da54bf4 [...] mail.gmail.com> <rt-3.6.HEAD-25245-1202496144-72.32931-5-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
X-RT-Original-Encoding: us-ascii
Received: from x1.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 5B1634D815C for <bug-DBIx-Class [...] rt.cpan.org>; Sat, 9 Feb 2008 08:08:50 -0500 (EST)
Received: (qmail 7718 invoked from network); 9 Feb 2008 13:08:49 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 9 Feb 2008 13:08:49 -0000
Received: from Unknown (HELO agaton.scsys.co.uk) (217.168.150.167) by 16.mx.develooper.com (qpsmtpd/0.40-dev) with ESMTP; Sat, 09 Feb 2008 05:08:46 -0800
Received: from matthewt by agaton.scsys.co.uk with local (Exim 4.60) (envelope-from <dbix-class [...] trout.me.uk>) id 1JNpRF-00049h-RL for bug-DBIx-Class [...] rt.cpan.org; Sat, 09 Feb 2008 13:08:13 +0000
Delivered-To: cpan-bug+DBIx-Class [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #32931] 'Uninitialized value' when update fails
User-Agent: Mutt/1.5.11
Return-Path: <dbix-class [...] trout.me.uk>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-DBIx-Class [...] rt.cpan.org
Date: Sat, 9 Feb 2008 13:08:13 +0000
X-Spam-Level: *
Message-Id: <20080209130813.GQ5801 [...] agaton.scsys.co.uk>
To: Martin via RT <bug-DBIx-Class [...] rt.cpan.org>
From: Matt S Trout <dbix-class [...] trout.me.uk>
X-RT-Original-Encoding: utf-8
RT-Message-ID: <rt-3.6.HEAD-25245-1202562536-1186.32931-0-0 [...] rt.cpan.org>
Content-Length: 797
Download (untitled) / with headers
text/plain 797b
On Fri, Feb 08, 2008 at 01:42:28PM -0500, Martin via RT wrote: Show quoted text
> > Queue: DBIx-Class > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=32931 > > > I've done a test case and everything works fine there, so I'm not sure then > what the problem was with my program. It's New Year here so I am not sure > whether I will have time in the next few days to investigate further.
I'd bet on something eating the exception. Gimme a shout if you can reproduce it otherwise3. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Director http://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
MIME-Version: 1.0
X-Mailer: MIME-tools 5.426 (Entity 5.426)
Content-Disposition: inline
Charset: utf8
Message-Id: <rt-3.6.HEAD-5473-1212007596-200.32931-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 147
Download (untitled) / with headers
text/plain 147b
Since it's been three months, I'm going to assume it was working fine after all. Please reply to re-open the ticket if you do get a test together.


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.