Menu

integrity constraint violation: foreign key no parent

Help
lqn
2015-03-09
2015-03-10
  • lqn

    lqn - 2015-03-09

    Hello,

    When connecting to an Access database, this exception is thrown.

    The cause is that LoadJet loads the tables with a TableImpl iterator that
    does not read the rows in the order in which they were created ... When the
    error occurs, the table being read has a constraint on itself (a folder
    table, with a parent_folder_id).

    The database is not inconsistent.

    How to cope with this situation ?

    Thanks for any help.

    Best regards

    Loïc

     
    • Gord Thompson

      Gord Thompson - 2015-03-09

      Marco: In case it helps, I was able to recreate the issue with the attached .accdb file. It opens okay in Access 2010.

       
  • Marco Amadei

    Marco Amadei - 2015-03-09

    May you post along a test database with a copy of the table (with a subset of the data to reproduce the issue)?
    Cheers Marco

     

    Last edit: Marco Amadei 2015-03-09
    • Gord Thompson

      Gord Thompson - 2015-03-09

      (See my reply to the original post, above.)

       
  • Marco Amadei

    Marco Amadei - 2015-03-09

    Thank you Gord!
    It looks like you were able to reproduce the worst case (the first row references the second, so it isn't a loading order problem).
    It's a side effect of a recent optimisation(I think in the 2.0.9.1), but we are still in time, it will be fixed in the 2.0.9.4.

     
  • lqn

    lqn - 2015-03-10

    Here is a database with the problem.

     
  • Marco Amadei

    Marco Amadei - 2015-03-10

    The above bug reported by Gord will be fixed in the 2.0.9.4, I'm going to release in the next hours.
    Nevetheless, the 2.0.9.4 will mark as readonly the folders table, for another violated FK constraint. But checking the data, the constraint violation doesn't exist: your database is strongly corrupted for misalignment between data and metadata.
    Don't worry, you just have to:

    -use the compact and repair access tool before re-opening your database.
    -upgrade to ucanaccess 2.0.9.4 when available

    THE SECOND STEP IS JUST A SUGGESTION, BECAUSE THE FIRST ONE WILL SOLVE THE ISSUE.

    Cheers Marco

     

    Last edit: Marco Amadei 2015-03-10
  • lqn

    lqn - 2015-03-10

    Compact and repair solves the problem, you are right, thanks.

    Is there a means to trigger this from Java ?

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.