<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
I'm using Catalyst along with DBIC, and I recently got this error:<br>
<font color="#000000"><br>
</font>
<div class="moz-signature"><code class="error"><font color="#000000">DBIx::Class::ResultSet::create():
DBI Exception: DBD::mysql::st execute failed: Cannot add or update a
child row: a foreign key constraint fails (`WebStmt/users_roles`,
CONSTRAINT `users_roles_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES
`roles` (`id`)) [for Statement "INSERT INTO users_roles ( role_id,
user_id) VALUES ( ?, ? )" with ParamValues: 0='HASH(0xb57f080)',
1='66'] at
/home/steve/Catalyst/WebStmt/script/../lib/FSUstmt/Controller/WebUsers.pm
line 109<br>
</font><br>
<font color="#000000">The interesting thing is that even though this
error was thrown, the insert worked.&nbsp; The use case is simply that I've
just created a new 'User', and I now want to give that user a 'Role'.&nbsp;
I'm using a join table to do so.&nbsp; That table has the id's of both the
User and Role(s) associated.<br>
<br>
Is this a bug?&nbsp; The problem I have is that even though the insert
works, it blows up my Catalyst application.<br>
<br>
Thoughts?<br>
</font></code></div>
</body>
</html>