Add code to handle non-recursive CTEs in the same way as SQL views.
Fix some memory leaks and crashes that could follow an OOM condition during WITH clause parsing.