Bugs item #1644556, was opened at 2007-01-25 17:03
Message generated for change (Settings changed) made by mvankeulen
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=1644556&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/compiler
Group: Pathfinder CVS Head
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Maurice van Keulen (mvankeulen)
>Assigned to: Jan Rittinger (tsheyar)
Summary: for-at-in combined with recursion counts wrong

Initial Comment:
The "for $var at $pos in $seq return ..." construct gives wrong values for $pos 
when recursion is involved. Consider the following query:

declare function test($l1 as node()*, $l2 as node()*)
{
   <test>{$l1}<with/>{$l2}<returns>{
      for $e1 at $p1 in $l1
         ,$e2 at $p2 in $l2
      where ($e1/name() eq $e2/name())
      return (
         <found>{$e1}<with/>{$e2}
            <cand a="{$p1}" b="{$p2}"/>
         </found>
         ,if ($e1/* or $e2/*)
          then <rec>{test($e1/*,$e2/*)}</rec>
          else ()
      )
   }</returns></test>
};

let $l1 := (<a/>,<b/>,<d><y/></d>,<c><x/></c>)
   ,$l2 := (<b/>,<b/>,<d><x/><y/></d>,<a/>,<c><x/><y/></c>)
return
<a>{
   test($l1,$l2)
}</a>

This query tries to find positions of elements with the same name in two 
sequences and does this recursively for their children. Below an excerpt of the 
output

        <test>
          <x/>
          <with/>
          <x/>
          <y/>
          <returns>
            <found>
              <x/>
              <with/>
              <x/>
              <cand b="3" a="1"/>
            </found>
          </returns>
        </test>

Note the b="3" there, while we are testing a sequence of one element with a 
sequence of two elements. This is clearly wrong, because the position should 
never exceed 2 here.

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

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

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to