Refactor CTE-related code and reduce recompilations#3989
Refactor CTE-related code and reduce recompilations#3989katzyn merged 2 commits intoh2database:masterfrom
Conversation
|
I just want to say a big Thank You for working on this. |
|
I can't correct grammar of WITH clause in documentation due to #3372, documentation of table references is also outdated. |
I will look into this next week and would tell you what I get working and what not. |
| Query query; | ||
| if (readIf(WITH)) { | ||
| queryScope = new QueryScope(outerQueryScope); | ||
| boolean isPotentiallyRecursive = readIf("RECURSIVE"); |
There was a problem hiding this comment.
why potentially? I'm ok with making it a requirement for this keyword to be correctly used
There was a problem hiding this comment.
This is a definition from the SQL Standard. When RECURSIVE is specified, a with list and its elements are potentially recursive, when it isn't specified they are non-recursive.
Elements of a potentially recursive list aren't required to be recursive, but they have the same restrictions as recursive (such as mandatory column names).
TableViewinto own class, their code is too different from each other.WITHandWITH RECURSIVEnow have a different meaning. WhenRECURSIVEis specified, column names are mandatory (actually they were always required for recursive queries). WhenRECURSIVEis not specified, queries may not be recursive (and we can compile them faster without any quirks).WITH RECURSIVEclause cannot be used inside anotherWITH RECURSIVEclause. These requirements are described in the SQL Standard anyway.