Unable to create subscription Error: External exception. SQLSTATE[23000]: Integrity constraint violation

Refers to:

  • Plesk Onyx for Linux
  • Plesk 11.0 for Windows
  • Plesk 12.0 for Windows
  • Plesk 12.0 for Linux
  • Plesk 12.5 for Windows

Created:

2016-11-16 13:08:49 UTC

Modified:

2016-12-21 20:03:21 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Unable to create subscription Error: External exception. SQLSTATE[23000]: Integrity constraint violation

Symptoms

Creation of new subscription fails with message:

Error: External exception. SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4842-domain' for key 'object_id_and_type'

Cause

Database inconsistency.

Resolution

  1. Create database dump using article #213904125 .

  2. Login to Plesk database using article #213412709 .

  3. From error message find domain id (in this example it is 4842).

  4. Make sure that there is no such domain in Plesk database:

    mysql> select * from domains where id=4842;
    Empty set (0.00 sec)
  5. Remove entry from Subscriptions table:

    mysql> delete from Subscriptions where object_id=4842;
    Query OK, 1 row affected (0.03 sec)
    1. Create new subscription.

In case there is more than one incorrect entries in database:

mysql> select count(*) from Subscriptions where object_id NOT IN (select id from domains);
+----------+
| count(*) |
+----------+
| 196 |
+----------+
1 row in set (0.00 sec)

Remove all such entries using the following query:

mysql> delete from Subscriptions where object_id NOT IN (select id from domains);
Query OK, 196 row affected (0.03 sec)
Have more questions? Submit a request
Please sign in to leave a comment.