I'm getting the following error when I try to edit and save a group node:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '6-6-670' for key 'PRIMARY': UPDATE {og_users_roles} SET rid=:db_update_placeholder_0 WHERE (rid = :db_condition_placeholder_0) AND (group_type = :db_condition_placeholder_1) AND (gid = :db_condition_placeholder_2) ; Array ( [:db_update_placeholder_0] => 6 [:db_condition_placeholder_0] => 249 [:db_condition_placeholder_1] => node [:db_condition_placeholder_2] => 670 ) in og_delete_user_roles_by_group() (line 2980 of /var/www/html/mysite/docroot/profiles/commons/modules/contrib/og/og.module).

Comments

jlea9378’s picture

Component: og_access.module » og.module
jlea9378’s picture

hefox’s picture

Category: Support request » Bug report

That seems like a bug

ranroz’s picture

@jlea9378

Can you please give more information regarding how to reproduce this?

jlea9378’s picture

  1. Go to existing State group
  2. Go to Node Edit
  3. Click Save
  4. Encounter Unexpected Error

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '6-6-670' for key 'PRIMARY': UPDATE {og_users_roles} SET rid=:db_update_placeholder_0 WHERE (rid = :db_condition_placeholder_0) AND (group_type = :db_condition_placeholder_1) AND (gid = :db_condition_placeholder_2) ; Array ( [:db_update_placeholder_0] => 6 [:db_condition_placeholder_0] => 249 [:db_condition_placeholder_1] => node [:db_condition_placeholder_2] => 670 ) in og_delete_user_roles_by_group() (line 2980 of /var/www/html/mysite/docroot/profiles/commons/modules/contrib/og/og.module).

This error doesn't appear when saving other group types on our site. So it seems like something is wrong with the State group type.

hefox’s picture

Forgot to update, had a similar error I fixed via #2411041: Group manager always given default default role as og_is_member arguments wrong

If I recall correctly, a update rid from one to another doesn't check if the user already has the role, producing an error -- may be the same situation but not necessarily triggered via the same way.

jlea9378’s picture

Thanks that patch appears to have solved the problem! I can't seem to reproduce the error now.

Blanca.Esqueda’s picture

I was getting the same error, followed the next steps.
1.- create a group and select the option 'override default roles and permissions'
2.- after assign group content to that group, then edit the group and select the option 'use default roles and permissions'

As @hefox mentioned patch #5 https://www.drupal.org/node/2411041 resolved the issue.