Great job done! Compared to guaranteeing the order of query cursor numbers and subquery cursor numbers, this is indeed a bit more targeted and have potentially less code modification, although this is already quite a lot of work. I 'm trying to fuzz with testcases similar to this one and no further problems occurred yet. Thank you for your explanation and hard work.