Jump to content

Integrity Check for a Nested Set


marone42

Recommended Posts

Hello guys,

 

I have here a Database with a Nested Set (Nested Tree) Structure, with id, lft, rgt, root_id and parent_id. I think that the structure is not ok.I found some duplicate nodes and other inconsistencies.

 

So my question: does anyone of you guys have a hint (or maybe some test algos) for doing an integrity check of the tree? Maybe using the parent_ids (which are assigned correct) or so.

 

Thanks!

Link to comment
Share on other sites

Hello,

 

i'm sorry, i wasn't precise enough. I want to check the integrity of the Nested Set structure, which has nothing to do with the parent_ids. Its structure consists only of the left and right nodes.

 

I know that the parent_id-Structure is ok, but this system works mainly with the nodes, i think the parent_id and root_id structure is only in the db for "backup".

 

I'm looking for a script that checks the integrity of the left and right nodes, if all trees are correct, maybe if the tree structure matches the parent_id-structure.

 

Regards

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.