Bugs item #2153245, was opened at 2008-10-08 15:53
Message generated for change (Comment added) made by sjoerd
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2153245&group_id=56967

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: PF/runtime
Group: Pathfinder CVS Head
Status: Open
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Lefteris Sidirourgos (lsidir)
Assigned to: Nobody/Anonymous (nobody)
Summary: XQ: corrupted document after replace node

Initial Comment:
After shredding the attached document2.xml and running the 4 update queries in 
the attached xquery2.xq file the document gets corrupted.

Update query #3 tries to replace a node with a new one. However it fails to do 
so, the resulting document has at the end:

<folder name="lsidir">
<bookmark-definition name="Third comment" project="*" shared="true">
<query/>
</bookmark-definition>
</folder>

when it should have:

<folder name="lsidir">
<bookmark-definition name="Third comment" project="*" shared="true">
<query/>
<description>Description One</description>
<note>Note 1</note>
</bookmark-definition>
</folder>

The forth query mess up the document even more, but most notable it makes 
description and note elements to re-appear with wrong attributes and wrong 
nesting:

<folder name="lsidir">
<bookmark-definition name="Third comment" project="*" shared="true">
<query/>
<bookmark-definition shared="true" project="*" name="CopyOf Third comment">
<query/>
<description name="Third comment" project="*" shared="true">Description 
One</description>
<note>Note 1</note>
</bookmark-definition>
</bookmark-definition>
</folder>

the correct output should be:
folder name="lsidir">
<bookmark-definition name="Third comment" project="*" shared="true">
<query/>
<description>Description One</description>
<note>Note 1</note>
</bookmark-definition>
<bookmark-definition shared="true" project="*" name="CopyOf Third comment">
<query/>
<description>Description One</description>
<note>Note 1</note>
</bookmark-definition>
</folder>


----------------------------------------------------------------------

>Comment By: Sjoerd Mullender (sjoerd)
Date: 2008-10-09 11:44

Message:
Fixed.

The problem was indeed the replace query.  Internally it first deletes the
node being replaced and then inserts the new node.  When inserting the new
node, it didn't adjust the ancestor sizes since all ancestors now ended
with a hole which was created by the deletion, and the check whether the
ancestor sizes needed to be adjusted didn't cater for them ending with a
hole.

Lefteris can you check the stable output that I provided with the test. 
The test was added in tests/Update as replacenode-corruption.SF-2153245.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2153245&group_id=56967

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to