+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Duplicate entry for key 'PRIMARY' when editing Generic content

Duplicate entry for key 'PRIMARY' when editing Generic content

4 posts, 0 answered
  1. Gaurav Mehta
    Gaurav Mehta avatar
    43 posts
    Registered:
    09 Dec 2009
    25 Oct 2010
    Link to this post
    Hi There,

    We are using Sitefinity 3.6 SP1
    Backend is MySql.

    Recently when we were changing URL of hyperlink in Generic content item we got following error :

    Duplicate entry '/-2d1d5708-fafd-4301-877a-f3cc33848b82-127-35-ParentID' for key 'PRIMARY'

    Please do let us know what may caused this error and how to fix it.

    Regards,
    Gaurav
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    25 Oct 2010
    Link to this post
    Hello Gaurav,

    1. You have made some manual changes to the database structure and now the stored procedures are affected.

    2. You have two or more projects with different version connected to the same database.

    We are using a data layer that handles all request to the database, so getting errors for duplicate keys cannot be caused by our code and there is no such a bug in the edition you are using.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Gaurav Mehta
    Gaurav Mehta avatar
    43 posts
    Registered:
    09 Dec 2009
    26 Oct 2010
    Link to this post
    Hi Ivan,

    We have checked following things as per you reply and found none of them is the case in our situation:

    1. You have made some manual changes to the database structure and now the stored procedures are affected.
    There is no manual change in Database structure.

    2. You have two or more projects with different version connected to the same database.
    We check other projects, they don't connect to the problem database (e.g problem - duplicate entry) .

    Can you help us to fix this problem ? Is there any way to check for duplicate entry ID in database table and fix it ?

    Here is our situation:

    We have one generic content item called "XYZContent"  that is shared in site pages.
    This item is having hyperlink. We have to change the URL of the link to something else as per the requirement.
    When we try to do this by following, we get duplicate entry error and changes are not saved :

    1. Editing the particular page - e.g. Sitefinity Admin - Pages - select particular page and edit
    2. Editing Generic Content Item "XYZContent" - e.g Sitefinity Admin - Modules - Generic Content - Edit "XYZContent"


    Regards,
    Gaurav
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    26 Oct 2010
    Link to this post
    Hello Gaurav,

    There is no such a bug in our code and the options for this error are changes in the database tables, stored procedures or you have two or more different versions of Sitefinity connected to the same database. The transactions are controlled by data layer and since there is no bug in our code related to "duplicate primary" keys in the database, you have made some changes without using the API to cause it.

    You can observe [sf_CmsContentBase] table to find the duplicate entry and try to remove it. Then re create the same content again and see whether the issue will appear. You can use SQL Profiler to see the actual queries to the database.

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
4 posts, 0 answered