Author Topic: problem adding identity  (Read 4733 times)

Offline mdh

  • Newbie
  • *
  • Posts: 4
problem adding identity
« on: August 08, 2010, 11:36:59 PM »
I'm using CentOS-installed MySQL (which is 5.0.77 but with their patches) and roundcube 0.4beta.  When I go to save an identity, it fails, and the following is logged to my roundcube log file:

Code: [Select]

[08-Aug-2010 23:28:35] MDB2 Error: constraint violation (-3): _doQuery: [Error message: Could not execute statement]
[Last executed query: EXECUTE mdb2_statement_mysql_3fc664595d3ea536ec7eb834725e8f865807db484 USING @0, @1, @2, @3, @4, @5, @6, @7, @8]
[Native code: 1452]
[Native message: Cannot add or update a child row: a foreign key constraint fails (`email_database/rc_identities`, CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE)]

[08-Aug-2010 23:28:35 -0400]: DB Error: MDB2 Error: constraint violation Query: _doQuery: [Error message: Could not execute statement] [Last executed query: EXECUTE mdb2_statement_mysql_3fc664595d3ea536ec7eb834725e8f865807db484 USING @0, @1, @2, @3, @4, @5, @6, @7, @8] [Native code: 1452] [Native message: Cannot add or update a child row: a foreign key constraint fails (`email_prod/rc_identities`, CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE)]  in /scrubbed/program/include/rcube_mdb2.php on line 658 (POST /?_task=settings&_action=save-identity)


Thanks for any help you can render.

Online SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
problem adding identity
« Reply #1 on: August 08, 2010, 11:49:25 PM »
Try upgrading to 0.4 stable.

Offline mdh

  • Newbie
  • *
  • Posts: 4
problem adding identity
« Reply #2 on: August 09, 2010, 08:15:54 AM »
Here's the log output from 0.4 stable.  I believe it's essentially the same error still.  

Code: [Select]

[09-Aug-2010 08:13:32] MDB2 Error: constraint violation (-3): _doQuery: [Error message: Could not execute statement]
[Last executed query: EXECUTE mdb2_statement_mysql_3108593453f049ab8cd5311a8d7f1c0db9645db15 USING @0, @1, @2, @3, @4, @5, @6, @7, @8]
[Native code: 1452]
[Native message: Cannot add or update a child row: a foreign key constraint fails (`email_prod/rc_identities`, CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE)]

[09-Aug-2010 08:13:32 -0400]: DB Error: MDB2 Error: constraint violation Query: _doQuery: [Error message: Could not execute statement] [Last executed query: EXECUTE mdb2_statement_mysql_3108593453f049ab8cd5311a8d7f1c0db9645db15 USING @0, @1, @2, @3, @4, @5, @6, @7, @8] [Native code: 1452] [Native message: Cannot add or update a child row: a foreign key constraint fails (`email_database/rc_identities`, CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE)]  in /scrubbed/program/include/rcube_mdb2.php on line 644 (POST /?_task=settings&_action=save-identity)


Thanks for the help!

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
problem adding identity
« Reply #3 on: August 09, 2010, 08:26:43 AM »
it looks like you have added a prefix to your tables names (eg rc_identities) does that mean you also changed the users table to rc_users? if so then in your sql i think you forgot to update the table names in the foreign key constraints and so its looking for a table called users not rc_users.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦

Offline mdh

  • Newbie
  • *
  • Posts: 4
problem adding identity
« Reply #4 on: August 09, 2010, 08:35:15 AM »
In my db.inc.php file, I have the following lines:

Code: [Select]
$rcmail_config['db_table_users'] = 'rc_users';

$rcmail_config['db_table_identities'] = 'rc_identities';

I think you may be right about the error, but where in roundcube does it use the name 'users' like that without checking its config file?  
What's the fix?  

Thanks!

Online SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
problem adding identity
« Reply #5 on: August 09, 2010, 09:18:26 AM »
The problem would be with MySQL witch doesn't have any access to the config files. To fix the problem go to into PHPMyAdmin then go to the identity's table then go to structure. Near the bottom they should be a link titled "Relation view" click on it. Under "user_id" select the drop down and find the users table and the the user_id it should look something like this:
Code: [Select]

`database`.`users_table`.`user_id`

and set ON DELETE and ON UPDATE to CASCADE. identity_id should be blank.

Offline mdh

  • Newbie
  • *
  • Posts: 4
problem adding identity
« Reply #6 on: August 09, 2010, 09:29:38 AM »
Thanks guys, works like a charm!  

Have a good day and thanks for making roundcube.  

Slogan idea, by the way - "Roundcube - webmail that doesn't have a crap UI or require deprecated versions of php."  :)