Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@katzyn
Copy link
Contributor

@katzyn katzyn commented Jan 28, 2024

  1. CTEs are extracted from TableView into own class, their code is too different from each other.
  2. WITH and WITH RECURSIVE now have a different meaning. When RECURSIVE is specified, column names are mandatory (actually they were always required for recursive queries). When RECURSIVE is not specified, queries may not be recursive (and we can compile them faster without any quirks). WITH RECURSIVE clause cannot be used inside another WITH RECURSIVE clause. These requirements are described in the SQL Standard anyway.
  3. Unnecessary recompilations during parsing of CTEs are removed.

@manticore-projects
Copy link
Contributor

I just want to say a big Thank You for working on this.
Please do let me know if I can assist with anything, e.g. testing or documentation.

@katzyn
Copy link
Contributor Author

katzyn commented Jan 28, 2024

I can't correct grammar of WITH clause in documentation due to #3372, documentation of table references is also outdated.

@manticore-projects
Copy link
Contributor

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");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why potentially? I'm ok with making it a requirement for this keyword to be correctly used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@katzyn katzyn merged commit 2a29f47 into h2database:master Jan 29, 2024
@katzyn katzyn deleted the cte branch January 29, 2024 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants