Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sql): fix stack overflow exception in WITH clause parsing #2965

Merged
merged 6 commits into from
Feb 16, 2023

Conversation

bziobrowski
Copy link
Contributor

Fixes #2954

PR prevents stack overflow on table resolution by using the same list of WITH clauses for each use (and re-evaluation) of WITH alias.

Example:

CREATE TABLE balance (
  address LONG,
  balance DOUBLE
);

WITH balance as ( SELECT * FROM balance WHERE address = 1 ),
          balance_other as ( SELECT * FROM balance )
SELECT * FROM balance;

@puzpuzpuz puzpuzpuz self-requested a review February 14, 2023 12:11
@puzpuzpuz puzpuzpuz added Bug Incorrect or unexpected behavior SQL Issues or changes relating to SQL execution labels Feb 14, 2023
@ideoma ideoma added this pull request to the merge queue Feb 15, 2023
@ideoma ideoma removed this pull request from the merge queue due to a manual request Feb 15, 2023
@ideoma ideoma added this pull request to the merge queue Feb 15, 2023
@ideoma ideoma removed this pull request from the merge queue due to a manual request Feb 15, 2023
@bluestreak01 bluestreak01 added this pull request to the merge queue Feb 15, 2023
@bluestreak01 bluestreak01 removed this pull request from the merge queue due to the queue being cleared Feb 15, 2023
@ideoma
Copy link
Collaborator

ideoma commented Feb 15, 2023

[PR Coverage check]

😍 pass : 36 / 36 (100.00%)

file detail

path covered line new line coverage
🔵 io/questdb/griffin/SqlParser.java 12 12 100.00%
🔵 io/questdb/griffin/model/WithClauseModel.java 23 23 100.00%
🔵 io/questdb/griffin/ExpressionParser.java 1 1 100.00%

@ideoma ideoma merged commit 503beb7 into master Feb 16, 2023
@ideoma ideoma deleted the fix_stack_overflow_in_with_clause_parsing branch February 16, 2023 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Incorrect or unexpected behavior SQL Issues or changes relating to SQL execution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Uh-oh. Error! in logs on questdb 6.7
4 participants