Subject: | DBIx-Class-0.08121 - update_all uses wrong value for primary key in WHERE clause |
Date: | Tue, 11 May 2010 18:17:12 +0200 |
To: | bug-DBIx-Class [...] rt.cpan.org |
From: | Christian Koetschan <christian.koetschan [...] googlemail.com> |
Hi,
I'm using update_all in a Catalyst/Postgres environment from
DBIx-Class-0.08121.tar.gz on a x86_64 GNU/Linux.
The following hashreference is passed to update_all():
[debug] $VAR1 = {
'magazine' => 'Magazine TEST',
'pubdate' => '2010-04-21T00:00:00',
'id' => 18
};
The resulting error:
( I executed "my $success =
$c->model('DBModel::Pressrelease')->update_all($c->request->data->{jsonresponse});")
[error] DBIx::Class::ResultSet::update_all(): DBI Exception: DBD::Pg::st
execute failed: ERROR: duplicate key violates unique constraint
"pressreleases_pkey" [for Statement "UPDATE pressreleases SET id =?,
magazine = ?, pubdate = ? WHERE ( id = ? )" with ParamValues: 1='18',
2='Magazine TEST', 3='2010-04-21T00:00:00', 4='10']
The Problem in the generated SQL statement is that ParamValue 4 (the one in
the WHERE clause) is 10 and not 18. I have no clue where this 10 is coming
from. My primary key is set to "id", and the structure of the statement
looks correct to me.