Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Chris 1 post 71 karma points
    May 15, 2019 @ 11:01
    Chris
    0

    Cannot insert duplicate key row in object 'dbo.cmsPropertyData' with unique index 'IX_cmsPropertyData_1'.

    Hello,

    This is one of those unreproducable occasional error in the log questions. Hoping maybe someone has encountered it.

    We are setting a custom member property and then saving that member. Every so often we see an exception updating the index. Interestingly it's not always the same value in the property type id (the 3rd value in the index). I assume saving the member saves all properties though.

    Code:

    var member = _memberService.GetByEmail(model.LoginEmail);
    member.SetValue(alias, value);
    _memberService.Save(member);
    

    Stack Trace:

    ERROR Umbraco.Core.Persistence.UmbracoDatabase - Exception (3afecff6).
    System.Data.SqlClient.SqlException (0x80131904): Cannot insert duplicate key row in object 'dbo.cmsPropertyData' with unique index 'IX_cmsPropertyData_1'. The duplicate key value is (271867, 9b728635-eae4-4616-8b48-c34bd0838c77, 412).
    The statement has been terminated.
    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
    at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
    at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
    at System.Data.SqlClient.SqlDataReader.get_MetaData()
    at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
    at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
    at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
    at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
    at System.Data.SqlClient.SqlCommand.ExecuteScalar()
    at Umbraco.Core.Persistence.PetaPocoCommandExtensions.<>c_DisplayClass11_0.<ExecuteScalarWithRetry>b_0()
    at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
    at Umbraco.Core.Persistence.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco)
    ClientConnectionId:c0bd8da9-065d-4129-8422-90e799aed638
    

    Has anyone else seen this?

    Cheers Chris.

    Umbraco Version: 7.10.4

  • Ali 20 posts 112 karma points
    Sep 28, 2019 @ 18:06
    Ali
    0

    Hi

    When I have two different member types in Member section, both with same custom property alias (of type textbox), I get that error when trying to insert value and save it using MemberService in a controller.

    Umbraco version 7.12.4

    Br Ali

  • AddWeb Solution Pvt. Ltd 89 posts 329 karma points
    Sep 30, 2019 @ 08:04
    AddWeb Solution Pvt. Ltd
    0

    There is a duplicate value being generated / inserted in DB for unique field

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies