Android.database.sqlite.SQLiteConstraintException: contacts.pinned may not be NULL (code 19)


  • developer

    Still no idea what the reason could be.

    @S2- @chiisama Which exact Android version do you use? The stock version (of which brand)? CyanogenMod?

    At the moment, I guess this is an issue with a few manufacturer-adapted Android versions.



  • i’m on cyanogenmod. latest stable.
    deleting the contact that generated the error and recreating it solved the problem for me. it never happened again.



  • Cyanogenmod last 11-20141115-SNAPSHOT-M12-i9300 (4.4.4)
    S2 - How you now which one cause the error ?



  • @chiisama i watched the logs with adb while syncing, and the last one that appeared before the exception was the guilty one.



  • The last one was Bengali Ottenau in the log above. Deleting this does not help.
    I removed the carddav account in davdroid and readded it. Error gone.
    The only thing that I did that may can corrupt the database is the SDMaid app.
    This app has the option to “optimize” the database. I tried to reproduce the error running sdmaid again but no problem wiht davdroid yet.



  • This bug just hit me and was gone after deleting the affected contact from the server. I believe i triggered the issue by adding the contact first and moving it into a contacts group using the ownCloud webinterface later after syncing.



  • I’m having the same issue with Alcatel 5038D stock rom, DAVdroid 0.7.2.



  • I fixed the problem starring the contact and syncing. Then I can unstar it and it syncs OK from now on.


  • developer

    And again with 0.7.5 (from Play Store):

    Moto X (ghost) with Android 4.4:

    android.database.sqlite.SQLiteConstraintException: contacts.pinned may not be NULL (code 19)
    at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:173)
    at android.database.DatabaseUtils.readExceptionWithOperationApplicationExceptionFromParcel(DatabaseUtils.java:160)
    at android.content.ContentProviderProxy.applyBatch(ContentProviderNative.java:512)
    at android.content.ContentProviderClient.applyBatch(ContentProviderClient.java:377)
    at at.bitfire.davdroid.resource.LocalCollection.commit(LocalCollection.java:327)
    at at.bitfire.davdroid.resource.LocalAddressBook.commit(LocalAddressBook.java:156)
    at at.bitfire.davdroid.syncadapter.SyncManager.pullChanged(SyncManager.java:210)
    at at.bitfire.davdroid.syncadapter.SyncManager.synchronize(SyncManager.java:91)
    at at.bitfire.davdroid.syncadapter.DavSyncAdapter.onPerformSync(DavSyncAdapter.java:146)
    at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:259)
    

  • developer

    According to https://github.com/android/platform_packages_providers_contactsprovider/blob/android-5.1.1_r4/src/com/android/providers/contacts/ContactsDatabaseHelper.java#L1213, the RawContact’s PINNED is always DEFAULT unpinned, so there should be no need to set it explicitly.


 

Maybe you're interested in these topics?